Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Cohsider the following program listing that is written in the C Language: finclu

ID: 3705681 • Letter: C

Question

Cohsider the following program listing that is written in the C Language: finclude void main(void); WDTCTL WDTPWWDTHOLD unsigned char a-0x14; unsigned char b-0xCC unsigned char c,d,e,f c=a"b; d-ajb; e=-d; f--e, while(1); 898558 a) Are the declared data types local or global variables? b) Perform bitwise logical analysis to determine the unknown values of the given logi expressions. c) Show the correct addresses and contents for all variables in the code listing. Hint Draw/Illustrate the proper order of placing data into the specified memory locat to the man n c afe na

Explanation / Answer

a)

As per the declared variables are local since they are exists in the main method only

And they will lost their scope once they entered into the other function or anything else.....

b)

value of a= 20 00010100

value of b = 204; 11001100

value of c=216; 11011000

value of d=220;   1011100

value of e=35; 0100011

value of c=220; 11011100

c)

$LC0:

        .ascii "%d %d %d %d %d %d"

        .text

        .align 2

        .globl main

        .set    nomips16

        .set    nomicromips

      .ent    main

        .type   main, @function

        .frame $fp,56,$31              # vars= 8, regs= 2/0, args= 32, gp= 8

        .mask   0xc0000000,-4

        .fmask 0x00000000,0

        .set    noreorder

        .cpload $25

        .set    nomacro

        addiu   $sp,$sp,-56

        sw      $31,52($sp)

        sw      $fp,48($sp)

        move    $fp,$sp

        .cprestore      32

        movz    $31,$31,$0

        li      $2,20                   # 0x14

        sb      $2,40($fp)

        li     $2,-52                  # 0xffffffffffffffcc

        sb      $2,41($fp)

        lbu     $3,40($fp)

        lbu     $2,41($fp)

        nop

        xor     $2,$3,$2

        sb      $2,42($fp)

        lbu     $3,40($fp)

        lbu     $2,41($fp)

        nop

        or      $2,$3,$2

        sb      $2,43($fp)

        lbu     $2,43($fp)

        nop

        nor     $2,$0,$2

        sb      $2,44($fp)

        lbu     $2,44($fp)

        nop

        nor     $2,$0,$2

        sb      $2,45($fp)

        lbu     $5,40($fp)

        lbu     $6,41($fp)

        lbu     $7,42($fp)

        lbu     $2,43($fp)

        lbu     $3,44($fp)

        lbu     $4,45($fp)

        nop

        sw      $4,24($sp)

        sw      $3,20($sp)

        sw      $2,16($sp)

        lw     $2,%got($LC0)($28)

        nop

        addiu   $4,$2,%lo($LC0)

        lw      $2,%call16(printf)($28)

        nop

        move    $25,$2

        .reloc 1f,R_MIPS_JALR,printf

         jalr    $25

        nop

        lw      $28,32($fp)

        nop

      move    $sp,$fp

        lw      $31,52($sp)

        lw      $fp,48($sp)

        addiu   $sp,$sp,56

        j       $31

        nop