xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage_get(void) {
  printf("Usage:\t%s get [options] <field> <path>\n\nDescription:\n\tExtract a "
         "field from a data file.\n\nOptions:\n\t-o <path>\tSaves output at "
         "the given path.\n",
         "corpus");
}


x86 assembly (clang, -O0):
<usage_get>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf6c(%rip),%rsi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage_get>:
lea    0xee9(%rip),%rdi
lea    0xf70(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [142 x i8] c"Usage:\09%s get [options] <field> <path>\0A\0ADescription:\0A\09Extract a field from a data file.\0A\0AOptions:\0A\09-o <path>\09Saves output at the given path.\0A\00"
@.str.1 = [7 x i8] c"corpus\00"
define void @usage_get() {
%1 = call i32 @printf(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [142 x i8] c"Usage:\09%s get [options] <field> <path>\0A\0ADescription:\0A\09Extract a field from a data file.\0A\0AOptions:\0A\09-o <path>\09Saves output at the given path.\0A\00"
@.str.1 = [7 x i8] c"corpus\00"
define void @usage_get() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct ArrayList {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ArrayList_indexOf(struct ArrayList const *, void *);
void *ArrayList_removeAt(struct ArrayList const *, int /*<<< orphan*/);
int /*<<< orphan*/ ArrayList_setError(struct ArrayList const *, int);
void *ArrayList_remove(const struct ArrayList *this, void *item) {
  do {
  } while (0);
  void *ret = ArrayList_removeAt(this, ArrayList_indexOf(this, item));
  ArrayList_setError(this, 1);
  do {
  } while (0);
  return ret;
}


x86 assembly (clang, -O0):
<ArrayList_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
jmp    1145 <ArrayList_remove+0x15>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <ArrayList_indexOf@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <ArrayList_removeAt@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <ArrayList_setError@plt>
jmp    117c <ArrayList_remove+0x4c>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ArrayList_remove>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <ArrayList_indexOf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <ArrayList_removeAt@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <ArrayList_setError@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ArrayList = type { i32 }
define i8* @ArrayList_remove(%struct.ArrayList* %0, i8* %1) {
%3 = alloca %struct.ArrayList*
%4 = alloca i8*
%5 = alloca i8*
store %struct.ArrayList* %0, %struct.ArrayList** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %2
br label %7
7: ; preds = %6
%8 = load %struct.ArrayList*, %struct.ArrayList** %3
%9 = load %struct.ArrayList*, %struct.ArrayList** %3
%10 = load i8*, i8** %4
%11 = call i32 @ArrayList_indexOf(%struct.ArrayList* %9, i8* %10)
%12 = call i8* @ArrayList_removeAt(%struct.ArrayList* %8, i32 %11)
store i8* %12, i8** %5
%13 = load %struct.ArrayList*, %struct.ArrayList** %3
%14 = call i32 @ArrayList_setError(%struct.ArrayList* %13, i32 1)
br label %15
15: ; preds = %7
br label %16
16: ; preds = %15
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
%struct.ArrayList = type { i32 }
define i8* @ArrayList_remove(%struct.ArrayList* %0, i8* %1) {
%3 = tail call i32 @ArrayList_indexOf(%struct.ArrayList* %0, i8* %1)
%4 = tail call i8* @ArrayList_removeAt(%struct.ArrayList* %0, i32 %3)
%5 = tail call i32 @ArrayList_setError(%struct.ArrayList* %0, i32 1)
ret i8* %4
}
/* Type definitions */
struct hash {
  int dummy;
};

/* Variables and functions */
struct hash *chainReadAllSwap(char *, int /*<<< orphan*/);
struct hash *chainReadAll(char *fileName) {
  return chainReadAllSwap(fileName, 0);
}


x86 assembly (clang, -O0):
<chainReadAll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <chainReadAllSwap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chainReadAll>:
xor    %esi,%esi
jmp    1030 <chainReadAllSwap@plt>

LLVM IR (-O0):
%struct.hash = type { i32 }
define %struct.hash* @chainReadAll(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call %struct.hash* @chainReadAllSwap(i8* %3, i32 0)
ret %struct.hash* %4
}

LLVM IR (-O2):
%struct.hash = type { i32 }
define %struct.hash* @chainReadAll(i8* %0) {
%2 = tail call %struct.hash* @chainReadAllSwap(i8* %0, i32 0)
ret %struct.hash* %2
}
void g_unichar_isupper() {}


x86 assembly (clang, -O0):
<g_unichar_isupper>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_unichar_isupper>:
ret

LLVM IR (-O0):
define void @g_unichar_isupper() {
ret void
}

LLVM IR (-O2):
define void @g_unichar_isupper() {
ret void
}
/* Variables and functions */
int dup2f(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int);
scalar_t__ getpid();
int /*<<< orphan*/ stderr;
int dup2(int old, int new) {
  fprintf(stderr, "[%d] dup2-ing %d to %d\n", (int)getpid(), old, new);
  return dup2f(old, new);
}


x86 assembly (clang, -O0):
<dup2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%edx
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <dup2f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dup2>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2ea1(%rip),%rax
mov    (%rax),%r14d
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb0(%rip),%rsi
mov    %r14d,%edi
mov    %eax,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
call   1040 <fprintf@plt>
mov    %ebp,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <dup2f@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"[%d] dup2-ing %d to %d\0A\00"
define i32 @dup2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i64 (...) @getpid()
%7 = trunc i64 %6 to i32
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @dup2f(i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"[%d] dup2-ing %d to %d\0A\00"
define i32 @dup2(i32 %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i64 (...) @getpid()
%5 = trunc i64 %4 to i32
%6 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %0, i32 %1)
%7 = tail call i32 @dup2f(i32 %0, i32 %1)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ LcdWriteCmd(int);
void LcdXY(int x, int y) {
  LcdWriteCmd(0x80 | x);
  LcdWriteCmd(0x40 | y);
}


x86 assembly (clang, -O0):
<LcdXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
or     $0x80,%edi
call   1030 <LcdWriteCmd@plt>
mov    -0x8(%rbp),%edi
or     $0x40,%edi
call   1030 <LcdWriteCmd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LcdXY>:
push   %rbx
mov    %esi,%ebx
or     $0x80,%edi
call   1030 <LcdWriteCmd@plt>
or     $0x40,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <LcdWriteCmd@plt>

LLVM IR (-O0):
define void @LcdXY(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = or i32 128, %5
%7 = call i32 @LcdWriteCmd(i32 %6)
%8 = load i32, i32* %4
%9 = or i32 64, %8
%10 = call i32 @LcdWriteCmd(i32 %9)
ret void
}

LLVM IR (-O2):
define void @LcdXY(i32 %0, i32 %1) {
%3 = or i32 %0, 128
%4 = tail call i32 @LcdWriteCmd(i32 %3)
%5 = or i32 %1, 64
%6 = tail call i32 @LcdWriteCmd(i32 %5)
ret void
}
int is_utf8_locale(void) { return 0; }


x86 assembly (clang, -O0):
<is_utf8_locale>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_utf8_locale>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_utf8_locale() {
ret i32 0
}

LLVM IR (-O2):
define i32 @is_utf8_locale() {
ret i32 0
}
unsigned int liberty_hash_name_hash(char *name, int size) {
  unsigned int h = 0;
  for (; *name; name++)
    h = 13 * h + (int)(*name);
  h = (h % size);
  return h;
}


x86 assembly (clang, -O0):
<liberty_hash_name_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1140 <liberty_hash_name_hash+0x40>
imul   $0xd,-0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1112 <liberty_hash_name_hash+0x12>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<liberty_hash_name_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <liberty_hash_name_hash+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
lea    (%rax,%rax,2),%edx
lea    (%rax,%rdx,4),%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <liberty_hash_name_hash+0x10>
jmp    112a <liberty_hash_name_hash+0x2a>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @liberty_hash_name_hash(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32, i32* %5
%12 = mul i32 13, %11
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = add i32 %12, %15
store i32 %16, i32* %5
br label %17
17: ; preds = %10
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
br label %6
20: ; preds = %6
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = urem i32 %21, %22
store i32 %23, i32* %5
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
define i32 @liberty_hash_name_hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %0, %2 ]
%9 = mul i32 %7, 13
%10 = sext i8 %6 to i32
%11 = add i32 %9, %10
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %11, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
int test_imm_E5int32_reg(int val) { return ((val) & (0xE5 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_E5int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xe5,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E5int32_reg>:
test   $0xe5,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E5int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 229
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_E5int32_reg(i32 %0) {
%2 = and i32 %0, 229
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ GPIO_Configuration();
int /*<<< orphan*/ NVIC_Configuration();
int /*<<< orphan*/ No_Configuration();
int /*<<< orphan*/ RCC_Configuration();
int /*<<< orphan*/ SysTick_Configuration();
int /*<<< orphan*/ USART_Configuration();
int peripherals_init(void) {
  RCC_Configuration();
  GPIO_Configuration();
  SysTick_Configuration();
  NVIC_Configuration();
  USART_Configuration();
  No_Configuration();
  return 0;
}


x86 assembly (clang, -O0):
<peripherals_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <RCC_Configuration@plt>
mov    $0x0,%al
call   1030 <GPIO_Configuration@plt>
mov    $0x0,%al
call   1040 <SysTick_Configuration@plt>
mov    $0x0,%al
call   1060 <NVIC_Configuration@plt>
mov    $0x0,%al
call   1080 <USART_Configuration@plt>
mov    $0x0,%al
call   1050 <No_Configuration@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<peripherals_init>:
push   %rax
xor    %eax,%eax
call   1070 <RCC_Configuration@plt>
xor    %eax,%eax
call   1030 <GPIO_Configuration@plt>
xor    %eax,%eax
call   1040 <SysTick_Configuration@plt>
xor    %eax,%eax
call   1060 <NVIC_Configuration@plt>
xor    %eax,%eax
call   1080 <USART_Configuration@plt>
xor    %eax,%eax
call   1050 <No_Configuration@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @peripherals_init() {
%1 = call i32 (...) @RCC_Configuration()
%2 = call i32 (...) @GPIO_Configuration()
%3 = call i32 (...) @SysTick_Configuration()
%4 = call i32 (...) @NVIC_Configuration()
%5 = call i32 (...) @USART_Configuration()
%6 = call i32 (...) @No_Configuration()
ret i32 0
}

LLVM IR (-O2):
define i32 @peripherals_init() {
%1 = tail call i32 (...) @RCC_Configuration()
%2 = tail call i32 (...) @GPIO_Configuration()
%3 = tail call i32 (...) @SysTick_Configuration()
%4 = tail call i32 (...) @NVIC_Configuration()
%5 = tail call i32 (...) @USART_Configuration()
%6 = tail call i32 (...) @No_Configuration()
ret i32 0
}
int fat_hook_check(struct fs_st *fs) {
  if (!fs)
    return 0;
  return 0;
}


x86 assembly (clang, -O0):
<fat_hook_check>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <fat_hook_check+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    1126 <fat_hook_check+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fat_hook_check>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.fs_st = type opaque
define i32 @fat_hook_check(%struct.fs_st* %0) {
%2 = alloca i32
%3 = alloca %struct.fs_st*
store %struct.fs_st* %0, %struct.fs_st** %3
%4 = load %struct.fs_st*, %struct.fs_st** %3
%5 = icmp ne %struct.fs_st* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 0, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
%struct.fs_st = type opaque
define i32 @fat_hook_check(%struct.fs_st* nocapture readnone %0) {
ret i32 0
}
void init_status_led() {
  (*(volatile unsigned long *)0x01C20808) = 0x77 << 16;
  (*(volatile unsigned long *)0x01C20808) |= 0x77 << 8;
  (*(volatile unsigned long *)0x01C20808) |= 0x17 << 0;
}


x86 assembly (clang, -O0):
<init_status_led>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1c20808,%eax
movq   $0x770000,(%rax)
mov    $0x1c20808,%eax
mov    (%rax),%rcx
or     $0x7700,%rcx
mov    $0x1c20808,%eax
mov    %rcx,(%rax)
mov    $0x1c20808,%eax
mov    (%rax),%rcx
or     $0x17,%rcx
mov    $0x1c20808,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_status_led>:
movq   $0x770000,0x1c20808
orq    $0x7700,0x1c20808
orq    $0x17,0x1c20808
01 17
ret

LLVM IR (-O0):
define void @init_status_led() {
store volatile i64 7798784, i64* inttoptr (i64 29493256 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 29493256 to i64*)
%2 = or i64 %1, 30464
store volatile i64 %2, i64* inttoptr (i64 29493256 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 29493256 to i64*)
%4 = or i64 %3, 23
store volatile i64 %4, i64* inttoptr (i64 29493256 to i64*)
ret void
}

LLVM IR (-O2):
define void @init_status_led() {
store volatile i64 7798784, i64* inttoptr (i64 29493256 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 29493256 to i64*)
%2 = or i64 %1, 30464
store volatile i64 %2, i64* inttoptr (i64 29493256 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 29493256 to i64*)
%4 = or i64 %3, 23
store volatile i64 %4, i64* inttoptr (i64 29493256 to i64*)
ret void
}
void XtSetSubvalues() {}


x86 assembly (clang, -O0):
<XtSetSubvalues>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XtSetSubvalues>:
ret

LLVM IR (-O0):
define void @XtSetSubvalues() {
ret void
}

LLVM IR (-O2):
define void @XtSetSubvalues() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print(const char *message) { printf("%s\n", message); }


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dmeanpw(int, double *, int);
int main() {
  double x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dmeanpw(N, x, stride);
  printf("mean: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
movl   $0x4,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
call   1050 <stdlib_strided_dmeanpw@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dmeanpw@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x double]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dmeanpw(i32 %6, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dmeanpw(i32 4, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Variables and functions */
int rand();
int generateNum(void) {
  if (rand() % 2 == 0) {
    return 2;
  } else {
    return 4;
  }
}


x86 assembly (clang, -O0):
<generateNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    113c <generateNum+0x2c>
movl   $0x2,-0x4(%rbp)
jmp    1143 <generateNum+0x33>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateNum>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x1,%eax
add    %eax,%eax
add    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @generateNum() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 2, i32* %1
br label %7
6: ; preds = %0
store i32 4, i32* %1
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
define i32 @generateNum() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 2, i32 4
ret i32 %4
}
int iRCCE_get_max_tagged_len(void) { return ((1 << 5) - sizeof(int)); }


x86 assembly (clang, -O0):
<iRCCE_get_max_tagged_len>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1c,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iRCCE_get_max_tagged_len>:
mov    $0x1c,%eax
ret

LLVM IR (-O0):
define i32 @iRCCE_get_max_tagged_len() {
ret i32 28
}

LLVM IR (-O2):
define i32 @iRCCE_get_max_tagged_len() {
ret i32 28
}
int ishouse(char h) { return ((h >= 'A') && (h <= 'P')); }


x86 assembly (clang, -O0):
<ishouse>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <ishouse+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x50,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishouse>:
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x10,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @ishouse(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 80
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @ishouse(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 16
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int setgid(gid_t gid) { return 0; }


x86 assembly (clang, -O0):
<setgid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setgid>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @setgid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @setgid(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ min_down(int *, int, int);
void build_min_heap(int arr[], int n) {
  int i;
  for (i = n / 2; i >= 1; i--)
    min_down(arr, i, n);
}


x86 assembly (clang, -O0):
<build_min_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jl     1154 <build_min_heap+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <min_down@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <build_min_heap+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_min_heap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1146 <build_min_heap+0x36>
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <min_down@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1130 <build_min_heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @build_min_heap(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sdiv i32 %6, 2
store i32 %7, i32* %5
br label %8
8: ; preds = %16, %2
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 1
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = call i32 @min_down(i32* %12, i32 %13, i32 %14)
br label %16
16: ; preds = %11
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %8
19: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @build_min_heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = lshr i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %5, %4 ]
%8 = tail call i32 @min_down(i32* %0, i32 %7, i32 %1)
%9 = add nsw i32 %7, -1
%10 = icmp ugt i32 %7, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fopen(char *, char *);
void main(int argc, char *argv[]) { fopen("f2", "w"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <fopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
lea    0xee5(%rip),%rsi
jmp    1030 <fopen@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"f2\00"
@.str.1 = [2 x i8] c"w\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @fopen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"f2\00"
@.str.1 = [2 x i8] c"w\00"
define void @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @fopen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SerialWriteChar(int);
void iRobot_FullMode() { SerialWriteChar(132); }


x86 assembly (clang, -O0):
<iRobot_FullMode>:
push   %rbp
mov    %rsp,%rbp
mov    $0x84,%edi
call   1030 <SerialWriteChar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<iRobot_FullMode>:
mov    $0x84,%edi
jmp    1030 <SerialWriteChar@plt>

LLVM IR (-O0):
define void @iRobot_FullMode() {
%1 = call i32 @SerialWriteChar(i32 132)
ret void
}

LLVM IR (-O2):
define void @iRobot_FullMode() {
%1 = tail call i32 @SerialWriteChar(i32 132)
ret void
}
int main(void) {
  int x = 1;
  return *((char *)&x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
void XShmQueryVersion() {}


x86 assembly (clang, -O0):
<XShmQueryVersion>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XShmQueryVersion>:
ret

LLVM IR (-O0):
define void @XShmQueryVersion() {
ret void
}

LLVM IR (-O2):
define void @XShmQueryVersion() {
ret void
}
/* Variables and functions */
int dlink_get(int /*<<< orphan*/);
int dlink_get_first() { return dlink_get(0); }


x86 assembly (clang, -O0):
<dlink_get_first>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <dlink_get@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlink_get_first>:
xor    %edi,%edi
jmp    1030 <dlink_get@plt>

LLVM IR (-O0):
define i32 @dlink_get_first() {
%1 = call i32 @dlink_get(i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @dlink_get_first() {
%1 = tail call i32 @dlink_get(i32 0)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void UTIL_fclose(FILE *file) { fclose(file); }


x86 assembly (clang, -O0):
<UTIL_fclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UTIL_fclose>:
jmp    1030 <fclose@plt>

LLVM IR (-O0):
define void @UTIL_fclose(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fclose(i32* %3)
ret void
}

LLVM IR (-O2):
define void @UTIL_fclose(i32* nocapture %0) {
%2 = tail call i32 @fclose(i32* %0)
ret void
}
/* Variables and functions */
int close(int);
int socket_close(int s) { return close(s); }


x86 assembly (clang, -O0):
<socket_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_close>:
jmp    1030 <close@plt>

LLVM IR (-O0):
define i32 @socket_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @close(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @socket_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
double min(double a, double b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <min+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <min+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
minsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @min(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @min(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int test_imm_5Eint64_highword_reg(long long val) {
  return ((val >> 32) & (0x5E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Eint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0x5e,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_5Eint64_highword_reg>:
movabs $0x5e00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_5Eint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 94
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_5Eint64_highword_reg(i64 %0) {
%2 = and i64 %0, 403726925824
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void chan(char *s) {
  char *d = "dd";
  s = d;
}


x86 assembly (clang, -O0):
<chan>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<chan>:
ret

LLVM IR (-O0):
@.str = [3 x i8] c"dd\00"
define void @chan(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
store i8* %4, i8** %2
ret void
}

LLVM IR (-O2):
define void @chan(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_last_digit(int);
int main(void) {
  print_last_digit(98);
  print_last_digit(0);
  print_last_digit(-402);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x62,%edi
call   1030 <print_last_digit@plt>
xor    %edi,%edi
call   1030 <print_last_digit@plt>
mov    $0xfffffe6e,%edi
call   1030 <print_last_digit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x62,%edi
call   1030 <print_last_digit@plt>
xor    %edi,%edi
call   1030 <print_last_digit@plt>
mov    $0xfffffe6e,%edi
call   1030 <print_last_digit@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @print_last_digit(i32 98)
%3 = call i32 @print_last_digit(i32 0)
%4 = call i32 @print_last_digit(i32 -402)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_last_digit(i32 98)
%2 = tail call i32 @print_last_digit(i32 0)
%3 = tail call i32 @print_last_digit(i32 -402)
ret i32 0
}
/* Variables and functions */
int syscall_cp(int, int);
int close(int fd) { return syscall_cp(6, fd); }


x86 assembly (clang, -O0):
<close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x6,%edi
call   1030 <syscall_cp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close>:
mov    %edi,%esi
mov    $0x6,%edi
jmp    1030 <syscall_cp@plt>

LLVM IR (-O0):
define i32 @close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @syscall_cp(i32 6, i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @close(i32 %0) {
%2 = tail call i32 @syscall_cp(i32 6, i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void yyerror(const char *msg) { printf("ERROR(PARSER): %s\n", msg); }


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yyerror>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"ERROR(PARSER): %s\0A\00"
define void @yyerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"ERROR(PARSER): %s\0A\00"
define void @yyerror(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen_op_store_xer();
void spr_write_xer(void *opaque, int sprn) { gen_op_store_xer(); }


x86 assembly (clang, -O0):
<spr_write_xer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <gen_op_store_xer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spr_write_xer>:
xor    %eax,%eax
jmp    1030 <gen_op_store_xer@plt>

LLVM IR (-O0):
define void @spr_write_xer(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 (...) @gen_op_store_xer()
ret void
}

LLVM IR (-O2):
define void @spr_write_xer(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (...) @gen_op_store_xer()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print(int a[], int len) {
  for (int i = 0; i < len; i++) {
    printf("%d ", a[i]);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <print+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <print+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @print(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
size_t multilple_formulas(char *);
char bin(char *g) { return g[multilple_formulas(g)]; }


x86 assembly (clang, -O0):
<bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <multilple_formulas@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movsbl (%rax,%rcx,1),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin>:
push   %rbx
mov    %rdi,%rbx
call   1030 <multilple_formulas@plt>
mov    (%rbx,%rax,1),%al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @bin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @multilple_formulas(i8* %4)
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = load i8, i8* %6
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @bin(i8* %0) {
%2 = tail call i64 @multilple_formulas(i8* %0)
%3 = getelementptr inbounds i8, i8* %0, i64 %2
%4 = load i8, i8* %3
ret i8 %4
}
/* Variables and functions */
double fabs(double);
double dist1d_c(double x1, double x2) { return fabs(x1 - x2); }


x86 assembly (clang, -O0):
<dist1d_c>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movaps 0xee1(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist1d_c>:
subsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @dist1d_c(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
%8 = call double @llvm.fabs.f64(double %7)
ret double %8
}

LLVM IR (-O2):
define double @dist1d_c(double %0, double %1) {
%3 = fsub double %0, %1
%4 = tail call double @llvm.fabs.f64(double %3)
ret double %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long serial;
};
typedef TYPE_1__ XFocusOutEvent;

/* Variables and functions */
void set_XFocusOutEvent_serial(void *_p, unsigned long _v) {
  ((XFocusOutEvent *)_p)->serial = (unsigned long)_v;
}


x86 assembly (clang, -O0):
<set_XFocusOutEvent_serial>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XFocusOutEvent_serial>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XFocusOutEvent_serial(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XFocusOutEvent_serial(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430InterruptP__Port14__disable();
void Msp430InterruptC__0__HplInterrupt__disable(void) {
  HplMsp430InterruptP__Port14__disable();
}


x86 assembly (clang, -O0):
<Msp430InterruptC__0__HplInterrupt__disable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HplMsp430InterruptP__Port14__disable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Msp430InterruptC__0__HplInterrupt__disable>:
xor    %eax,%eax
jmp    1030 <HplMsp430InterruptP__Port14__disable@plt>

LLVM IR (-O0):
define void @Msp430InterruptC__0__HplInterrupt__disable() {
%1 = call i32 (...) @HplMsp430InterruptP__Port14__disable()
ret void
}

LLVM IR (-O2):
define void @Msp430InterruptC__0__HplInterrupt__disable() {
%1 = tail call i32 (...) @HplMsp430InterruptP__Port14__disable()
ret void
}
void wait_ready(void) {
  while (((*((volatile unsigned long *)0x70200028)) & 0x1) == 0)
    ;
}


x86 assembly (clang, -O0):
<wait_ready>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <wait_ready+0x9>
mov    $0x70200028,%eax
mov    (%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    1124 <wait_ready+0x24>
jmp    1109 <wait_ready+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_ready>:
testq  $0x1,0x70200028
je     1100 <wait_ready>
ret

LLVM IR (-O0):
define void @wait_ready() {
br label %1
1: ; preds = %5, %0
%2 = load volatile i64, i64* inttoptr (i64 1881145384 to i64*)
%3 = and i64 %2, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @wait_ready() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i64, i64* inttoptr (i64 1881145384 to i64*)
%3 = and i64 %2, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ck_assert_str_eq(char *, char *);
void do_printf(char *formatted_message) {
  ck_assert_str_eq("There are 33 Monkeys.", formatted_message);
}


x86 assembly (clang, -O0):
<do_printf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <ck_assert_str_eq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_printf>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <ck_assert_str_eq@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"There are 33 Monkeys.\00"
define void @do_printf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @ck_assert_str_eq(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"There are 33 Monkeys.\00"
define void @do_printf(i8* %0) {
%2 = tail call i32 @ck_assert_str_eq(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SetStateDelayUnattached();
void InitializeTypeC(void) { SetStateDelayUnattached(); }


x86 assembly (clang, -O0):
<InitializeTypeC>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <SetStateDelayUnattached@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitializeTypeC>:
xor    %eax,%eax
jmp    1030 <SetStateDelayUnattached@plt>

LLVM IR (-O0):
define void @InitializeTypeC() {
%1 = call i32 (...) @SetStateDelayUnattached()
ret void
}

LLVM IR (-O2):
define void @InitializeTypeC() {
%1 = tail call i32 (...) @SetStateDelayUnattached()
ret void
}
/* Variables and functions */
void strcpy(char *dest, char *source) {
  while (*dest++ = *source++)
    ;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     113b <strcpy+0x3b>
jmp    110c <strcpy+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strcpy+0x10>
ret

LLVM IR (-O0):
define void @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %12, %2
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %4
%8 = load i8, i8* %6
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
store i8 %8, i8* %9
%11 = icmp ne i8 %8, 0
br i1 %11, label %12, label %13
12: ; preds = %5
br label %5
13: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @strcpy(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
void foo367(int p) {}


x86 assembly (clang, -O0):
<foo367>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo367>:
ret

LLVM IR (-O0):
define void @foo367(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @foo367(i32 %0) {
ret void
}
const char *mg_version(void) { return "3.1"; }


x86 assembly (clang, -O0):
<mg_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"3.1\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"3.1\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}