xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ return_struct_vc3();
int /*<<< orphan*/ take_struct_vc3(int /*<<< orphan*/);
void test_struct_vc3() { take_struct_vc3(return_struct_vc3()); }


x86 assembly (clang, -O0):
<test_struct_vc3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <return_struct_vc3@plt>
mov    %eax,%edi
call   1030 <take_struct_vc3@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_vc3>:
push   %rax
xor    %eax,%eax
call   1040 <return_struct_vc3@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <take_struct_vc3@plt>

LLVM IR (-O0):
define void @test_struct_vc3() {
%1 = call i32 (...) @return_struct_vc3()
%2 = call i32 @take_struct_vc3(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_vc3() {
%1 = tail call i32 (...) @return_struct_vc3()
%2 = tail call i32 @take_struct_vc3(i32 %1)
ret void
}
void test_vsub_f32(float *dest, float *a, float *b) {
  int i;
  for (i = 0; i < 4; i++) {
    dest[i] = a[i] - b[i];
  }
}


x86 assembly (clang, -O0):
<test_vsub_f32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1156 <test_vsub_f32+0x56>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <test_vsub_f32+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_vsub_f32>:
movss  (%rsi),%xmm0
subss  (%rdx),%xmm0
movss  %xmm0,(%rdi)
movss  0x4(%rsi),%xmm0
subss  0x4(%rdx),%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
subss  0x8(%rdx),%xmm0
movss  %xmm0,0x8(%rdi)
movss  0xc(%rsi),%xmm0
subss  0xc(%rdx),%xmm0
movss  %xmm0,0xc(%rdi)
ret

LLVM IR (-O0):
define void @test_vsub_f32(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
store i32 0, i32* %7
br label %8
8: ; preds = %27, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load float*, float** %5
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds float, float* %12, i64 %14
%16 = load float, float* %15
%17 = load float*, float** %6
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds float, float* %17, i64 %19
%21 = load float, float* %20
%22 = fsub float %16, %21
%23 = load float*, float** %4
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %23, i64 %25
store float %22, float* %26
br label %27
27: ; preds = %11
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %8
30: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @test_vsub_f32(float* nocapture writeonly %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %1
%5 = load float, float* %2
%6 = fsub float %4, %5
store float %6, float* %0
%7 = getelementptr inbounds float, float* %1, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %2, i64 1
%10 = load float, float* %9
%11 = fsub float %8, %10
%12 = getelementptr inbounds float, float* %0, i64 1
store float %11, float* %12
%13 = getelementptr inbounds float, float* %1, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %2, i64 2
%16 = load float, float* %15
%17 = fsub float %14, %16
%18 = getelementptr inbounds float, float* %0, i64 2
store float %17, float* %18
%19 = getelementptr inbounds float, float* %1, i64 3
%20 = load float, float* %19
%21 = getelementptr inbounds float, float* %2, i64 3
%22 = load float, float* %21
%23 = fsub float %20, %22
%24 = getelementptr inbounds float, float* %0, i64 3
store float %23, float* %24
ret void
}
/* Variables and functions */
int f165(int *);
int f166(int *p) { return f165(p); }


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

x86 assembly (clang, -O2):
<f166>:
jmp    1030 <f165@plt>

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

LLVM IR (-O2):
define i32 @f166(i32* %0) {
%2 = tail call i32 @f165(i32* %0)
ret i32 %2
}
void im_a_dummy(void) {}


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

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

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

LLVM IR (-O2):
define void @im_a_dummy() {
ret void
}
int eb_int_to_bcd(int src, unsigned char *tgt) {
  if (src > 99) {
    *tgt = (unsigned char)(0xFF);
    return 0;
  } else {
    *tgt = (unsigned char)(((src / 10) << 4) | (src % 10));
    return 1;
  }
}


x86 assembly (clang, -O0):
<eb_int_to_bcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x63,-0x8(%rbp)
jle    1128 <eb_int_to_bcd+0x28>
mov    -0x10(%rbp),%rax
movb   $0xff,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1158 <eb_int_to_bcd+0x58>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
or     %edx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eb_int_to_bcd>:
cmp    $0x63,%edi
jle    110e <eb_int_to_bcd+0xe>
xor    %eax,%eax
mov    $0xff,%dil
mov    %dil,(%rsi)
ret
movslq %edi,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
or     %ecx,%edi
mov    $0x1,%eax
mov    %dil,(%rsi)
ret

LLVM IR (-O0):
define i32 @eb_int_to_bcd(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 99
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i8*, i8** %5
store i8 -1, i8* %9
store i32 0, i32* %3
br label %19
10: ; preds = %2
%11 = load i32, i32* %4
%12 = sdiv i32 %11, 10
%13 = shl i32 %12, 4
%14 = load i32, i32* %4
%15 = srem i32 %14, 10
%16 = or i32 %13, %15
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %5
store i8 %17, i8* %18
store i32 1, i32* %3
br label %19
19: ; preds = %10, %8
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @eb_int_to_bcd(i32 %0, i8* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 99
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = sdiv i32 %0, 10
%6 = shl i32 %5, 4
%7 = srem i32 %0, 10
%8 = or i32 %6, %7
%9 = trunc i32 %8 to i8
br label %10
10: ; preds = %2, %4
%11 = phi i8 [ %9, %4 ], [ -1, %2 ]
%12 = phi i32 [ 1, %4 ], [ 0, %2 ]
store i8 %11, i8* %1
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ prime();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("The prime numbers are\n");
  prime();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <prime@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <prime@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"The prime numbers are\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @prime()
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"The prime numbers are\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @prime()
ret i32 0
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
int main() {
  int in;
  while ((in = getchar()) != EOF) {
    putchar(in);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1155 <main+0x35>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rbx
cmp    (%rbx),%eax
je     1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @putchar(i32 %8)
br label %3
10: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @putchar(i32 %5)
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ raise(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void __attribute__((__noreturn__)) __stack_chk_fail(void) {
  char msg[] = "*** stack smashing detected ***: terminated\n";
  write(2, msg, strlen(msg));
  raise(SIGABRT);
  _exit(127);
}


x86 assembly (clang, -O0):
<__stack_chk_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x2d,%edx
call   1070 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
mov    $0x2,%edi
call   1050 <write@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    $0x7f,%edi
call   1040 <_exit@plt>

x86 assembly (clang, -O2):
<__stack_chk_fail>:
push   %rbx
sub    $0x30,%rsp
movups 0xed1(%rip),%xmm0
movups %xmm0,0x1d(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <write@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    $0x7f,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
@__const.__stack_chk_fail.msg = [45 x i8] c"*** stack smashing detected ***: terminated\0A\00"
@SIGABRT = global i32 0
define void @__stack_chk_fail() {
%1 = alloca [45 x i8]
%2 = bitcast [45 x i8]* %1 to i8*
%3 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i32 2, i8* %3, i32 %5)
%7 = load i32, i32* @SIGABRT
%8 = call i32 @raise(i32 %7)
%9 = call i32 @_exit(i32 127)
unreachable
}

LLVM IR (-O2):
@__const.__stack_chk_fail.msg = [45 x i8] c"*** stack smashing detected ***: terminated\0A\00"
@SIGABRT = global i32 0
define void @__stack_chk_fail() {
%1 = alloca [45 x i8]
%2 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = call i32 @write(i32 2, i8* %2, i32 %3)
%5 = load i32, i32* @SIGABRT
%6 = call i32 @raise(i32 %5)
%7 = call i32 @_exit(i32 127)
unreachable
}
/* Type definitions */
struct AnimationList {
  int dummy;
};

/* Variables and functions */
void *FindAnimation(char *, struct AnimationList *);
int _GetVisibility(void *, double);
int GetVisibility(struct AnimationList *al, char *name, double time) {
  void *a = FindAnimation(name, al);
  if (a)
    return _GetVisibility(a, time);
  return 1;
}


x86 assembly (clang, -O0):
<GetVisibility>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <FindAnimation@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1167 <GetVisibility+0x47>
mov    -0x28(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1040 <_GetVisibility@plt>
mov    %eax,-0x4(%rbp)
jmp    116e <GetVisibility+0x4e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetVisibility>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <FindAnimation@plt>
test   %rax,%rax
je     1147 <GetVisibility+0x27>
mov    %rax,%rdi
movsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <_GetVisibility@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.AnimationList = type { i32 }
define i32 @GetVisibility(%struct.AnimationList* %0, i8* %1, double %2) {
%4 = alloca i32
%5 = alloca %struct.AnimationList*
%6 = alloca i8*
%7 = alloca double
%8 = alloca i8*
store %struct.AnimationList* %0, %struct.AnimationList** %5
store i8* %1, i8** %6
store double %2, double* %7
%9 = load i8*, i8** %6
%10 = load %struct.AnimationList*, %struct.AnimationList** %5
%11 = call i8* @FindAnimation(i8* %9, %struct.AnimationList* %10)
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i8*, i8** %8
%16 = load double, double* %7
%17 = call i32 @_GetVisibility(i8* %15, double %16)
store i32 %17, i32* %4
br label %19
18: ; preds = %3
store i32 1, i32* %4
br label %19
19: ; preds = %18, %14
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
%struct.AnimationList = type { i32 }
define i32 @GetVisibility(%struct.AnimationList* %0, i8* %1, double %2) {
%4 = tail call i8* @FindAnimation(i8* %1, %struct.AnimationList* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @_GetVisibility(i8* %4, double %2)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ 1, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ function3();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello from program.c\n");
  function3();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <function3@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <function3@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Hello from program.c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @function3()
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"Hello from program.c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @function3()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ set_bit_true(int /*<<< orphan*/ volatile *,
                                int /*<<< orphan*/);
void turn_led_on(volatile uint8_t *buffer) { set_bit_true(buffer, 0); }


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

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

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

LLVM IR (-O2):
define void @turn_led_on(i32* %0) {
%2 = tail call i32 @set_bit_true(i32* %0, i32 0)
ret void
}
unsigned int rand(unsigned int seed) { return (1103515245 * seed + 12345); }


x86 assembly (clang, -O0):
<rand>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x41c64e6d,-0x4(%rbp),%eax
add    $0x3039,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand>:
imul   $0x41c64e6d,%edi,%eax
add    $0x3039,%eax
ret

LLVM IR (-O0):
define i32 @rand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 1103515245, %3
%5 = add i32 %4, 12345
ret i32 %5
}

LLVM IR (-O2):
define i32 @rand(i32 %0) {
%2 = mul i32 %0, 1103515245
%3 = add i32 %2, 12345
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
int is_root(char *p) { return (!strcmp(p, "/")); }


x86 assembly (clang, -O0):
<is_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_root>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
define i32 @is_root(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define i32 @is_root(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int cbmarch_untalk(int);
int cbm_untalk(int HandleDevice) {
  ;
  return cbmarch_untalk(HandleDevice);
}


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

x86 assembly (clang, -O2):
<cbm_untalk>:
jmp    1030 <cbmarch_untalk@plt>

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

LLVM IR (-O2):
define i32 @cbm_untalk(i32 %0) {
%2 = tail call i32 @cbmarch_untalk(i32 %0)
ret i32 %2
}
int OS_loadMusic(char *desc) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @OS_loadMusic(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
unsigned int gcd(unsigned int, int);
unsigned int roundup(unsigned int, unsigned int);
unsigned int sgx_buffer_align(unsigned stride, unsigned size) {
  unsigned lcm;
  if (!stride || !size)
    return 0;
  lcm = stride * 4096 / gcd(stride, 4096);
  return roundup(size, lcm);
}


x86 assembly (clang, -O0):
<sgx_buffer_align>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1142 <sgx_buffer_align+0x22>
cmpl   $0x0,-0xc(%rbp)
jne    114e <sgx_buffer_align+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    117e <sgx_buffer_align+0x5e>
mov    -0x8(%rbp),%eax
shl    $0xc,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1000,%esi
call   1040 <gcd@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <roundup@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgx_buffer_align>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     1153 <sgx_buffer_align+0x33>
mov    %esi,%ebx
test   %esi,%esi
je     1153 <sgx_buffer_align+0x33>
mov    %edi,%ebp
shl    $0xc,%ebp
mov    $0x1000,%esi
call   1040 <gcd@plt>
mov    %eax,%ecx
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %ebx,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <roundup@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sgx_buffer_align(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9, %2
store i32 0, i32* %3
br label %22
13: ; preds = %9
%14 = load i32, i32* %4
%15 = mul i32 %14, 4096
%16 = load i32, i32* %4
%17 = call i32 @gcd(i32 %16, i32 4096)
%18 = udiv i32 %15, %17
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = call i32 @roundup(i32 %19, i32 %20)
store i32 %21, i32* %3
br label %22
22: ; preds = %13, %12
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @sgx_buffer_align(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, 0
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = shl i32 %0, 12
%8 = tail call i32 @gcd(i32 %0, i32 4096)
%9 = udiv i32 %7, %8
%10 = tail call i32 @roundup(i32 %1, i32 %9)
br label %11
11: ; preds = %2, %6
%12 = phi i32 [ %10, %6 ], [ 0, %2 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(void) {
  int i = 0;
  if (i != 0)
    abort();
  i++;
  if (i != 1)
    abort();
  int j = i;
  if (j != 1)
    abort();
  struct foo {
    int i0;
  } k = {4};
  if (k.i0 != 4)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1147 <main+0x27>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     1161 <main+0x41>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1178 <main+0x58>
mov    $0x0,%al
call   1030 <abort@plt>
mov    0xe82(%rip),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
je     1192 <main+0x72>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
%struct.foo = type { i32 }
@__const.main.k = %struct.foo { i32 4 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.foo
store i32 0, i32* %1
store i32 0, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %9
%17 = load i32, i32* %2
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %16
%23 = bitcast %struct.foo* %4 to i8*
%24 = getelementptr inbounds %struct.foo, %struct.foo* %4, i32 0, i32 0
%25 = load i32, i32* %24
%26 = icmp ne i32 %25, 4
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %22
%30 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint32_t;
typedef scalar_t__ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ dma_do(int, scalar_t__, int);
void vdp_dma_vsram(uint32_t from, uint16_t to, uint16_t len) {
  dma_do(from, len,
         ((0x4000 + (((uint32_t)to) & 0x3FFF)) << 16) +
             ((((uint32_t)to) >> 14) | 0x90));
}


x86 assembly (clang, -O0):
<vdp_dma_vsram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
and    $0x3fff,%edx
add    $0x4000,%edx
shl    $0x10,%edx
mov    -0x10(%rbp),%rax
sar    $0xe,%eax
or     $0x90,%eax
add    %eax,%edx
call   1030 <dma_do@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vdp_dma_vsram>:
mov    %esi,%eax
shl    $0x10,%eax
and    $0x3fff0000,%eax
sar    $0xe,%esi
or     $0x90,%esi
add    %esi,%eax
add    $0x40000000,%eax
mov    %rdx,%rsi
mov    %eax,%edx
jmp    1030 <dma_do@plt>

LLVM IR (-O0):
define void @vdp_dma_vsram(i32 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i64, i64* %6
%9 = load i64, i64* %5
%10 = trunc i64 %9 to i32
%11 = and i32 %10, 16383
%12 = add nsw i32 16384, %11
%13 = shl i32 %12, 16
%14 = load i64, i64* %5
%15 = trunc i64 %14 to i32
%16 = ashr i32 %15, 14
%17 = or i32 %16, 144
%18 = add nsw i32 %13, %17
%19 = call i32 @dma_do(i32 %7, i64 %8, i32 %18)
ret void
}

LLVM IR (-O2):
define void @vdp_dma_vsram(i32 %0, i64 %1, i64 %2) {
%4 = trunc i64 %1 to i32
%5 = shl i32 %4, 16
%6 = and i32 %5, 1073676288
%7 = or i32 %6, 1073741824
%8 = ashr i32 %4, 14
%9 = or i32 %8, 144
%10 = add nsw i32 %7, %9
%11 = tail call i32 @dma_do(i32 %0, i64 %2, i32 %10)
ret void
}
void glUniform2i(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glUniform2i() {
ret void
}
/* Variables and functions */
double M_PI;
double cos(double);
double dv_dz(double L, double a_vz, double v_z, double z) {
  return M_PI * a_vz * v_z * cos(M_PI * a_vz * z / L) / L;
}


x86 assembly (clang, -O0):
<dv_dz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    0x2eb5(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e9b(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dv_dz>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mulsd  (%rax),%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
mulsd  %xmm3,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @dv_dz(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* @M_PI
%10 = load double, double* %6
%11 = fmul double %9, %10
%12 = load double, double* %7
%13 = fmul double %11, %12
%14 = load double, double* @M_PI
%15 = load double, double* %6
%16 = fmul double %14, %15
%17 = load double, double* %8
%18 = fmul double %16, %17
%19 = load double, double* %5
%20 = fdiv double %18, %19
%21 = call double @cos(double %20)
%22 = fmul double %13, %21
%23 = load double, double* %5
%24 = fdiv double %22, %23
ret double %24
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @dv_dz(double %0, double %1, double %2, double %3) {
%5 = load double, double* @M_PI
%6 = fmul double %5, %1
%7 = fmul double %6, %2
%8 = fmul double %6, %3
%9 = fdiv double %8, %0
%10 = tail call double @cos(double %9)
%11 = fmul double %10, %7
%12 = fdiv double %11, %0
ret double %12
}
const char *_String() { return "This is a string"; }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"This is a string\00"
define i8* @_String() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [17 x i8] c"This is a string\00"
define i8* @_String() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main(void) {
  char *str = "123";
  int str_int = atoi(str);
  printf("string %s is integer %d\n", str, str_int);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x7b,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"123\00"
@.str.1 = [25 x i8] c"string %s is integer %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @atoi(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"123\00"
@.str.1 = [25 x i8] c"string %s is integer %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 123)
ret i32 0
}
/* Variables and functions */
double RAND_MAX;
scalar_t__ rand();
int rand_upto(int max) {
  return (int)(max * (double)rand() / (RAND_MAX + 1.0));
}


x86 assembly (clang, -O0):
<rand_upto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebe(%rip),%xmm1
mov    0x2e9f(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_upto>:
push   %rax
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2eb8(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xec4(%rip),%xmm1
mulsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @rand_upto(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = call i64 (...) @rand()
%6 = sitofp i64 %5 to double
%7 = fmul double %4, %6
%8 = load double, double* @RAND_MAX
%9 = fadd double %8, 1.000000e+00
%10 = fdiv double %7, %9
%11 = fptosi double %10 to i32
ret i32 %11
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @rand_upto(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call i64 (...) @rand()
%4 = sitofp i64 %3 to double
%5 = fmul double %2, %4
%6 = load double, double* @RAND_MAX
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double %5, %7
%9 = fptosi double %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *get_token(char const *);
int process_file(char *);
int cmd_include(const char *args) {
  int ret;
  char *t = get_token(args);
  ret = process_file(t);
  free(t);
  return ret;
}


x86 assembly (clang, -O0):
<cmd_include>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_token@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <process_file@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_include>:
push   %rbp
push   %rbx
push   %rax
call   1050 <get_token@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <process_file@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cmd_include(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @get_token(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @process_file(i8* %7)
store i32 %8, i32* %3
%9 = load i8*, i8** %4
%10 = call i32 @free(i8* %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmd_include(i8* %0) {
%2 = tail call i8* @get_token(i8* %0)
%3 = tail call i32 @process_file(i8* %2)
%4 = tail call i32 @free(i8* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ clean();
char getchar();
char readchar() {
  clean();
  char c = getchar();
  return c;
}


x86 assembly (clang, -O0):
<readchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <clean@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readchar>:
push   %rax
xor    %eax,%eax
call   1040 <clean@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <getchar@plt>

LLVM IR (-O0):
define signext i8 @readchar() {
%1 = alloca i8
%2 = call i32 (...) @clean()
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = load i8, i8* %1
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @readchar() {
%1 = tail call i32 (...) @clean()
%2 = tail call signext i8 (...) @getchar()
ret i8 %2
}
/* Variables and functions */
int CHAR_BIT;
void __set_bit(unsigned idx, unsigned long *bmap) {
  bmap[((idx) / (CHAR_BIT * sizeof(unsigned long)))] |=
      (1UL << ((idx) % (CHAR_BIT * sizeof(unsigned long))));
}


x86 assembly (clang, -O0):
<__set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ecb(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x3,%rcx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e9e(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x3,%rcx
xor    %edx,%edx
div    %rcx
mov    -0x20(%rbp),%rdx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
or     (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__set_bit>:
mov    %edi,%ecx
mov    0x2ed7(%rip),%rax
movslq (%rax),%rdi
shl    $0x3,%rdi
cmp    %rdi,%rcx
jb     111f <__set_bit+0x1f>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
mov    %edx,%ecx
jmp    1121 <__set_bit+0x21>
xor    %eax,%eax
mov    $0x1,%edx
shl    %cl,%rdx
or     %rdx,(%rsi,%rax,8)
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define void @__set_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i32, i32* %3
%6 = zext i32 %5 to i64
%7 = load i32, i32* @CHAR_BIT
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 8
%10 = urem i64 %6, %9
%11 = shl i64 1, %10
%12 = load i64*, i64** %4
%13 = load i32, i32* %3
%14 = zext i32 %13 to i64
%15 = load i32, i32* @CHAR_BIT
%16 = sext i32 %15 to i64
%17 = mul i64 %16, 8
%18 = udiv i64 %14, %17
%19 = getelementptr inbounds i64, i64* %12, i64 %18
%20 = load i64, i64* %19
%21 = or i64 %20, %11
store i64 %21, i64* %19
ret void
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define void @__set_bit(i32 %0, i64* nocapture %1) {
%3 = zext i32 %0 to i64
%4 = load i32, i32* @CHAR_BIT
%5 = sext i32 %4 to i64
%6 = shl nsw i64 %5, 3
%7 = urem i64 %3, %6
%8 = shl nuw i64 1, %7
%9 = udiv i64 %3, %6
%10 = getelementptr inbounds i64, i64* %1, i64 %9
%11 = load i64, i64* %10
%12 = or i64 %11, %8
store i64 %12, i64* %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void dummy() { printf("dummy\n"); }


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

x86 assembly (clang, -O2):
<dummy>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"dummy\0A\00"
define void @dummy() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"dummy\00"
define void @dummy() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
OP(fd, b7) { op_b7(); }


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

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

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @op_b7()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_b7()
ret i32 undef
}
/* Variables and functions */
double Tak(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int n = 10;
  printf("%d\n", (int)(1000000.0 * Tak(n * 3.0, n * 2.0, n * 1.0)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xeb1(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
call   1030 <Tak@plt>
movaps %xmm0,%xmm1
movsd  0xe74(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1e,%edi
mov    $0x14,%esi
mov    $0xa,%edx
call   1030 <Tak@plt>
mulsd  0xec3(%rip),%xmm0
cvttsd2si %xmm0,%esi
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = fmul double %8, 3.000000e+00
%10 = fptosi double %9 to i32
%11 = load i32, i32* %6
%12 = sitofp i32 %11 to double
%13 = fmul double %12, 2.000000e+00
%14 = fptosi double %13 to i32
%15 = load i32, i32* %6
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 1.000000e+00
%18 = fptosi double %17 to i32
%19 = call double @Tak(i32 %10, i32 %14, i32 %18)
%20 = fmul double 1.000000e+06, %19
%21 = fptosi double %20 to i32
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double @Tak(i32 30, i32 20, i32 10)
%4 = fmul double %3, 1.000000e+06
%5 = fptosi double %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
char tostring(int n) {
  int num = n - 0;
  printf("11.check in tostring()------num=%d,n=%d\n", num, n);
  printf("12.check char in tostring():c=%c\n", (num + '0'));
  return num + '0';
}


x86 assembly (clang, -O0):
<tostring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
add    $0x30,%esi
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tostring>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x30,%ebx
lea    0xefa(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"11.check in tostring()------num=%d,n=%d\0A\00"
@.str.1 = [34 x i8] c"12.check char in tostring():c=%c\0A\00"
define signext i8 @tostring(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 0
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 48
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 48
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
@.str = [41 x i8] c"11.check in tostring()------num=%d,n=%d\0A\00"
@.str.1 = [34 x i8] c"12.check char in tostring():c=%c\0A\00"
define signext i8 @tostring(i32 %0) {
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %0)
%3 = add nsw i32 %0, 48
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = trunc i32 %3 to i8
ret i8 %5
}
int state_cmp(void *a, void *b) {
  if (a == b)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<state_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <state_cmp+0x26>
movl   $0x0,-0x4(%rbp)
jmp    112d <state_cmp+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<state_cmp>:
xor    %eax,%eax
cmp    %rsi,%rdi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @state_cmp(i8* readnone %0, i8* readnone %1) {
%3 = icmp ne i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *);
void addTimestamp(char *str) {
  if (str != NULL) {
    const char *noTm = "<no timestamp on host>  ";
    sprintf(str, "%s", noTm);
    str[25 - 1] = 0x20;
  }
}


x86 assembly (clang, -O0):
<addTimestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114e <addTimestamp+0x3e>
lea    0xed2(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed8(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x8(%rbp),%rax
movb   $0x20,0x18(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addTimestamp>:
test   %rdi,%rdi
je     1121 <addTimestamp+0x21>
movups 0xef4(%rip),%xmm0
movups %xmm0,(%rdi)
movabs $0x20203e74736f6820,%rax
3e 20 20
mov    %rax,0x10(%rdi)
movb   $0x20,0x18(%rdi)
ret

LLVM IR (-O0):
@.str = [25 x i8] c"<no timestamp on host> \00"
@.str.1 = [3 x i8] c"%s\00"
define void @addTimestamp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8** %3
%7 = load i8*, i8** %2
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 24
store i8 32, i8* %11
br label %12
12: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"<no timestamp on host> \00"
define void @addTimestamp(i8* writeonly %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(25) %0, i8* align 1 dereferenceable(25) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 24, i1 false)
%4 = getelementptr inbounds i8, i8* %0, i64 24
store i8 32, i8* %4
br label %5
5: ; preds = %3, %1
ret void
}
int switch_hexa(int x) {
  if (0 <= x && x <= 9)
    return (48 + x);
  if (x >= 10 && x <= 15) {
    x = x - 10;
    return (97 + x);
  }
  return (0);
}


x86 assembly (clang, -O0):
<switch_hexa>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jg     112a <switch_hexa+0x2a>
cmpl   $0x9,-0x8(%rbp)
jg     112a <switch_hexa+0x2a>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    115c <switch_hexa+0x5c>
cmpl   $0xa,-0x8(%rbp)
jl     1155 <switch_hexa+0x55>
cmpl   $0xf,-0x8(%rbp)
jg     1155 <switch_hexa+0x55>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    115c <switch_hexa+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<switch_hexa>:
mov    %edi,%eax
cmp    $0x9,%edi
ja     110b <switch_hexa+0xb>
add    $0x30,%eax
ret
lea    -0xa(%rax),%ecx
add    $0x57,%eax
xor    %edx,%edx
cmp    $0x6,%ecx
cmovb  %eax,%edx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @switch_hexa(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 0, %4
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 9
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 48, %10
store i32 %11, i32* %2
br label %24
12: ; preds = %6, %1
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 10
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 15
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 10
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = add nsw i32 97, %21
store i32 %22, i32* %2
br label %24
23: ; preds = %15, %12
store i32 0, i32* %2
br label %24
24: ; preds = %23, %18, %9
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @switch_hexa(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = add nuw nsw i32 %0, 48
br label %10
5: ; preds = %1
%6 = add i32 %0, -10
%7 = icmp ult i32 %6, 6
%8 = add nsw i32 %0, 87
%9 = select i1 %7, i32 %8, i32 0
br label %10
10: ; preds = %5, %3
%11 = phi i32 [ %4, %3 ], [ %9, %5 ]
ret i32 %11
}