#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 exp_a(int);
int exp_b(int);
int exp_c(int);
int exp_d(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int all_bit_1 = ~0;
  int all_bit_0 = ~all_bit_1;
  int high_byte_1 = 0xFF000000;
  int high_byte_not_1 = 0xF0000000;
  int low_byte_0 = 0xFFFFFF00;
  int low_byte_not_0 = 0xFFFFFF0F;
  printf("exp_a now should be 1 and the result is %d\n", exp_a(all_bit_1));
  printf("exp_a now should be 0 and the result is %d\n", exp_a(all_bit_0));
  printf("exp_b now should be 1 and the result is %d\n", exp_b(all_bit_0));
  printf("exp_b now should be 0 and the result is %d\n", exp_b(all_bit_1));
  printf("exp_c now should be 1 and the result is %d\n", exp_c(high_byte_1));
  printf("exp_c now should be 0 and the result is %d\n",
         exp_c(high_byte_not_1));
  printf("exp_d now should be 1 and the result is %d\n", exp_d(low_byte_0));
  printf("exp_d now should be 0 and the result is %d\n", exp_d(low_byte_not_0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
movl   $0xff000000,-0x10(%rbp)
movl   $0xf0000000,-0x14(%rbp)
movl   $0xffffff00,-0x18(%rbp)
movl   $0xffffff0f,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <exp_a@plt>
mov    %eax,%esi
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
call   1030 <exp_a@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
call   1070 <exp_b@plt>
mov    %eax,%esi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1070 <exp_b@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
call   1050 <exp_c@plt>
mov    %eax,%esi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1050 <exp_c@plt>
mov    %eax,%esi
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
call   1060 <exp_d@plt>
mov    %eax,%esi
lea    0xee8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <exp_d@plt>
mov    %eax,%esi
lea    0xefe(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <exp_a@plt>
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <exp_a@plt>
lea    0xeb5(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exp_b@plt>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exp_b@plt>
lea    0xee0(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xff000000,%edi
call   1050 <exp_c@plt>
lea    0xef4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xf0000000,%edi
call   1050 <exp_c@plt>
lea    0xf08(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xffffff00,%edi
call   1060 <exp_d@plt>
lea    0xf1c(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xffffff0f,%edi
call   1060 <exp_d@plt>
lea    0xf30(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"exp_a now should be 1 and the result is %d\0A\00"
@.str.1 = [44 x i8] c"exp_a now should be 0 and the result is %d\0A\00"
@.str.2 = [44 x i8] c"exp_b now should be 1 and the result is %d\0A\00"
@.str.3 = [44 x i8] c"exp_b now should be 0 and the result is %d\0A\00"
@.str.4 = [44 x i8] c"exp_c now should be 1 and the result is %d\0A\00"
@.str.5 = [44 x i8] c"exp_c now should be 0 and the result is %d\0A\00"
@.str.6 = [44 x i8] c"exp_d now should be 1 and the result is %d\0A\00"
@.str.7 = [44 x i8] c"exp_d now should be 0 and the result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%8 = load i32, i32* %2
%9 = xor i32 %8, -1
store i32 %9, i32* %3
store i32 -16777216, i32* %4
store i32 -268435456, i32* %5
store i32 -256, i32* %6
store i32 -241, i32* %7
%10 = load i32, i32* %2
%11 = call i32 @exp_a(i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @exp_a(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
%17 = call i32 @exp_b(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %2
%20 = call i32 @exp_b(i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %4
%23 = call i32 @exp_c(i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %5
%26 = call i32 @exp_c(i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %6
%29 = call i32 @exp_d(i32 %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %7
%32 = call i32 @exp_d(i32 %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"exp_a now should be 1 and the result is %d\0A\00"
@.str.1 = [44 x i8] c"exp_a now should be 0 and the result is %d\0A\00"
@.str.2 = [44 x i8] c"exp_b now should be 1 and the result is %d\0A\00"
@.str.3 = [44 x i8] c"exp_b now should be 0 and the result is %d\0A\00"
@.str.4 = [44 x i8] c"exp_c now should be 1 and the result is %d\0A\00"
@.str.5 = [44 x i8] c"exp_c now should be 0 and the result is %d\0A\00"
@.str.6 = [44 x i8] c"exp_d now should be 1 and the result is %d\0A\00"
@.str.7 = [44 x i8] c"exp_d now should be 0 and the result is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @exp_a(i32 -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @exp_a(i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @exp_b(i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @exp_b(i32 -1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @exp_c(i32 -16777216)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @exp_c(i32 -268435456)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = tail call i32 @exp_d(i32 -256)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = tail call i32 @exp_d(i32 -241)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i32 %15)
ret i32 0
}