#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ Display_Byte(unsigned char);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned char x = 0xFE;
  unsigned int y = 0x0A0B;
  printf("%-35s", "x");
  Display_Byte(x);
  printf("%-35s", "1s complement [~x]");
  Display_Byte(~x);
  printf("%-35s", "Bitwise AND [x & 0x0f]");
  Display_Byte(x & 0x0f);
  printf("%-35s", "Bitwise OR [x | 0x0f]");
  Display_Byte(x | 0x0f);
  printf("%-35s", "Bitwise XOR [x ^ 0x0f]");
  Display_Byte(x ^ 0x0f);
  printf("%-35s", "Left shift, 1 place [x <<= 1] ");
  Display_Byte(x <<= 1);
  x = 0xfe;
  printf("%-35s", "Right shift, 4 places [x >>= 4]");
  Display_Byte(x >>= 4);
  printf("\n\n");
  printf("%-35s", "Display MS byte of unsigned int y");
  Display_Byte((unsigned char)(y >> 8));
  printf("%-35s", "Display LS byte of unsigned int y");
  Display_Byte((unsigned char)(y & 0xFF));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xfe,-0x5(%rbp)
movl   $0xa0b,-0xc(%rbp)
lea    0xebf(%rip),%rdi
lea    0xebe(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%edi
call   1040 <Display_Byte@plt>
lea    0xea1(%rip),%rdi
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
xor    $0xffffffff,%eax
movzbl %al,%edi
call   1040 <Display_Byte@plt>
lea    0xe7d(%rip),%rdi
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
and    $0xf,%eax
movzbl %al,%edi
call   1040 <Display_Byte@plt>
lea    0xe59(%rip),%rdi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
or     $0xf,%eax
movzbl %al,%edi
call   1040 <Display_Byte@plt>
lea    0xe35(%rip),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
xor    $0xf,%eax
movzbl %al,%edi
call   1040 <Display_Byte@plt>
lea    0xe11(%rip),%rdi
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x5(%rbp)
movzbl %al,%edi
call   1040 <Display_Byte@plt>
movb   $0xfe,-0x5(%rbp)
lea    0xde6(%rip),%rdi
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0x5(%rbp)
movzbl %al,%edi
call   1040 <Display_Byte@plt>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb1(%rip),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
movzbl %al,%edi
call   1040 <Display_Byte@plt>
lea    0xd8e(%rip),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0xff,%eax
movzbl %al,%edi
call   1040 <Display_Byte@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfe,%edi
call   1050 <Display_Byte@plt>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <Display_Byte@plt>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xe,%edi
call   1050 <Display_Byte@plt>
lea    0xea2(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xff,%edi
call   1050 <Display_Byte@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xf1,%edi
call   1050 <Display_Byte@plt>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfc,%edi
call   1050 <Display_Byte@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xf,%edi
call   1050 <Display_Byte@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1050 <Display_Byte@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xb,%edi
call   1050 <Display_Byte@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%-35s\00"
@.str.1 = [2 x i8] c"x\00"
@.str.2 = [19 x i8] c"1s complement [~x]\00"
@.str.3 = [23 x i8] c"Bitwise AND [x & 0x0f]\00"
@.str.4 = [22 x i8] c"Bitwise OR [x | 0x0f]\00"
@.str.5 = [23 x i8] c"Bitwise XOR [x ^ 0x0f]\00"
@.str.6 = [31 x i8] c"Left shift, 1 place [x <<= 1] \00"
@.str.7 = [32 x i8] c"Right shift, 4 places [x >>= 4]\00"
@.str.8 = [3 x i8] c"\0A\0A\00"
@.str.9 = [34 x i8] c"Display MS byte of unsigned int y\00"
@.str.10 = [34 x i8] c"Display LS byte of unsigned int y\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 -2, i8* %2
store i32 2571, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8, i8* %2
%6 = call i32 @Display_Byte(i8 zeroext %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = xor i32 %9, -1
%11 = trunc i32 %10 to i8
%12 = call i32 @Display_Byte(i8 zeroext %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%14 = load i8, i8* %2
%15 = zext i8 %14 to i32
%16 = and i32 %15, 15
%17 = trunc i32 %16 to i8
%18 = call i32 @Display_Byte(i8 zeroext %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%20 = load i8, i8* %2
%21 = zext i8 %20 to i32
%22 = or i32 %21, 15
%23 = trunc i32 %22 to i8
%24 = call i32 @Display_Byte(i8 zeroext %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%26 = load i8, i8* %2
%27 = zext i8 %26 to i32
%28 = xor i32 %27, 15
%29 = trunc i32 %28 to i8
%30 = call i32 @Display_Byte(i8 zeroext %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%32 = load i8, i8* %2
%33 = zext i8 %32 to i32
%34 = shl i32 %33, 1
%35 = trunc i32 %34 to i8
store i8 %35, i8* %2
%36 = call i32 @Display_Byte(i8 zeroext %35)
store i8 -2, i8* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%38 = load i8, i8* %2
%39 = zext i8 %38 to i32
%40 = ashr i32 %39, 4
%41 = trunc i32 %40 to i8
store i8 %41, i8* %2
%42 = call i32 @Display_Byte(i8 zeroext %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%45 = load i32, i32* %3
%46 = lshr i32 %45, 8
%47 = trunc i32 %46 to i8
%48 = call i32 @Display_Byte(i8 zeroext %47)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
%50 = load i32, i32* %3
%51 = and i32 %50, 255
%52 = trunc i32 %51 to i8
%53 = call i32 @Display_Byte(i8 zeroext %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%-35s\00"
@.str.1 = [2 x i8] c"x\00"
@.str.2 = [19 x i8] c"1s complement [~x]\00"
@.str.3 = [23 x i8] c"Bitwise AND [x & 0x0f]\00"
@.str.4 = [22 x i8] c"Bitwise OR [x | 0x0f]\00"
@.str.5 = [23 x i8] c"Bitwise XOR [x ^ 0x0f]\00"
@.str.6 = [31 x i8] c"Left shift, 1 place [x <<= 1] \00"
@.str.7 = [32 x i8] c"Right shift, 4 places [x >>= 4]\00"
@.str.9 = [34 x i8] c"Display MS byte of unsigned int y\00"
@.str.10 = [34 x i8] c"Display LS byte of unsigned int y\00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @Display_Byte(i8 zeroext -2)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @Display_Byte(i8 zeroext 1)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @Display_Byte(i8 zeroext 14)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @Display_Byte(i8 zeroext -1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @Display_Byte(i8 zeroext -15)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%12 = tail call i32 @Display_Byte(i8 zeroext -4)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%14 = tail call i32 @Display_Byte(i8 zeroext 15)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%17 = tail call i32 @Display_Byte(i8 zeroext 10)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
%19 = tail call i32 @Display_Byte(i8 zeroext 11)
ret i32 0
}