xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  void *buf = malloc(100);
  char *str = (char *)buf;
  strcpy(str, "hello");
  printf("str from malloc space:%s\n", str);
  free(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
lea    0xea2(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [26 x i8] c"str from malloc space:%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* @malloc(i32 100)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @free(i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [26 x i8] c"str from malloc space:%s\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = tail call i32 @free(i8* %1)
ret i32 0
}
/* Variables and functions */
int get_data_int();
int /*<<< orphan*/ send_int_to_srv(int);
int get_bitrate() {
  send_int_to_srv(0x16);
  return get_data_int();
}


x86 assembly (clang, -O0):
<get_bitrate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x16,%edi
call   1030 <send_int_to_srv@plt>
mov    $0x0,%al
call   1040 <get_data_int@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bitrate>:
push   %rax
mov    $0x16,%edi
call   1030 <send_int_to_srv@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <get_data_int@plt>

LLVM IR (-O0):
define i32 @get_bitrate() {
%1 = call i32 @send_int_to_srv(i32 22)
%2 = call i32 (...) @get_data_int()
ret i32 %2
}

LLVM IR (-O2):
define i32 @get_bitrate() {
%1 = tail call i32 @send_int_to_srv(i32 22)
%2 = tail call i32 (...) @get_data_int()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ c(int);
int /*<<< orphan*/ printf(char *, int);
void b(int x) {
  printf("b(%d)\n", x);
  c(x - 1);
}


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <c@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <c@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"b(%d)\0A\00"
define void @b(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = add nsw i32 %0, -1
%4 = tail call i32 @c(i32 %3)
ret void
}
void test_isgreater(double x, double y, int true) {
  if (__builtin_isgreater(x, y)) {
    if (!true)
      abort();
  } else {
    if (true)
      abort();
  }
}


x86 assembly (clang, -O0):
<test_isgreater>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1149 <test_isgreater+0x39>
cmpl   $0x0,-0x14(%rbp)
jne    1144 <test_isgreater+0x34>
call   1030 <abort@plt>
jmp    115d <test_isgreater+0x4d>
cmpl   $0x0,-0x14(%rbp)
je     1158 <test_isgreater+0x48>
call   1030 <abort@plt>
jmp    115d <test_isgreater+0x4d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isgreater>:
push   %rax
ucomisd %xmm1,%xmm0
jbe    1120 <test_isgreater+0x10>
test   %edi,%edi
jne    1124 <test_isgreater+0x14>
call   1030 <abort@plt>
test   %edi,%edi
jne    111b <test_isgreater+0xb>
pop    %rax
ret

LLVM IR (-O0):
define void @test_isgreater(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store double %0, double* %4
store double %1, double* %5
store i32 %2, i32* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fcmp ogt double %7, %8
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %10
unreachable
14: ; preds = %10
br label %20
15: ; preds = %3
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
unreachable
19: ; preds = %15
br label %20
20: ; preds = %19, %14
ret void
}

LLVM IR (-O2):
define void @test_isgreater(double %0, double %1, i32 %2) {
%4 = fcmp ogt double %0, %1
%5 = icmp eq i32 %2, 0
br i1 %4, label %6, label %8
6: ; preds = %3
br i1 %5, label %7, label %10
7: ; preds = %6
tail call void @abort()
unreachable
8: ; preds = %3
br i1 %5, label %10, label %9
9: ; preds = %8
tail call void @abort()
unreachable
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void printVector(double *vector, int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%f\n", vector[i]);
}


x86 assembly (clang, -O0):
<printVector>:
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    1159 <printVector+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printVector+0x16>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define void @printVector(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %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 double*, double** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
%15 = load double, double* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %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"%f\0A\00"
define void @printVector(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mdea_error(char **, char *);
int mdea_null_node_get_string(void *p, const char **string, char **error) {
  mdea_error(error, "Expected string, got null");
  return -1;
}


x86 assembly (clang, -O0):
<mdea_null_node_get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <mdea_error@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdea_null_node_get_string>:
push   %rax
mov    %rdx,%rdi
lea    0xee5(%rip),%rsi
call   1030 <mdea_error@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Expected string, got null\00"
define i32 @mdea_null_node_get_string(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i8**, i8*** %6
%8 = call i32 @mdea_error(i8** %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [26 x i8] c"Expected string, got null\00"
define i32 @mdea_null_node_get_string(i8* nocapture readnone %0, i8** nocapture readnone %1, i8** %2) {
%4 = tail call i32 @mdea_error(i8** %2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
void dlm_debug_shutdown(struct dlm_ctxt *dlm) {}


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

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

LLVM IR (-O0):
%struct.dlm_ctxt = type opaque
define void @dlm_debug_shutdown(%struct.dlm_ctxt* %0) {
%2 = alloca %struct.dlm_ctxt*
store %struct.dlm_ctxt* %0, %struct.dlm_ctxt** %2
ret void
}

LLVM IR (-O2):
%struct.dlm_ctxt = type opaque
define void @dlm_debug_shutdown(%struct.dlm_ctxt* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_crt_join_sched();
int /*<<< orphan*/ test_grpwait(int, int);
int /*<<< orphan*/ test_multisend(int);
int /*<<< orphan*/ test_perf();
int /*<<< orphan*/ test_perf_async_steam(int);
int /*<<< orphan*/ test_perf_channels(int /*<<< orphan*/);
int main(void) {
  test_perf();
  test_crt_join_sched();
  test_perf_channels(0);
  test_multisend(0);
  test_perf_async_steam(10000 / 10 < 100 ? 10000 / 10 : 100);
  test_multisend(10000 / 10 < 100 ? 10000 / 10 : 100);
  test_grpwait(0, 3);
  test_grpwait(3, 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <test_perf@plt>
mov    $0x0,%al
call   1060 <test_crt_join_sched@plt>
xor    %edi,%edi
call   1080 <test_perf_channels@plt>
xor    %edi,%edi
call   1050 <test_multisend@plt>
mov    $0x64,%edi
call   1030 <test_perf_async_steam@plt>
mov    $0x64,%edi
call   1050 <test_multisend@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1070 <test_grpwait@plt>
mov    $0x3,%esi
mov    %esi,%edi
call   1070 <test_grpwait@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_perf@plt>
xor    %eax,%eax
call   1060 <test_crt_join_sched@plt>
xor    %edi,%edi
call   1080 <test_perf_channels@plt>
xor    %edi,%edi
call   1050 <test_multisend@plt>
mov    $0x64,%edi
call   1030 <test_perf_async_steam@plt>
mov    $0x64,%edi
call   1050 <test_multisend@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1070 <test_grpwait@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1070 <test_grpwait@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_perf()
%3 = call i32 (...) @test_crt_join_sched()
%4 = call i32 @test_perf_channels(i32 0)
%5 = call i32 @test_multisend(i32 0)
%6 = call i32 @test_perf_async_steam(i32 100)
%7 = call i32 @test_multisend(i32 100)
%8 = call i32 @test_grpwait(i32 0, i32 3)
%9 = call i32 @test_grpwait(i32 3, i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_perf()
%2 = tail call i32 (...) @test_crt_join_sched()
%3 = tail call i32 @test_perf_channels(i32 0)
%4 = tail call i32 @test_multisend(i32 0)
%5 = tail call i32 @test_perf_async_steam(i32 100)
%6 = tail call i32 @test_multisend(i32 100)
%7 = tail call i32 @test_grpwait(i32 0, i32 3)
%8 = tail call i32 @test_grpwait(i32 3, i32 3)
ret i32 0
}
double ho_recognize_font_1_six(const double *array_in) {
  double return_value = 0.0;
  return return_value;
}


x86 assembly (clang, -O0):
<ho_recognize_font_1_six>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ho_recognize_font_1_six>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @ho_recognize_font_1_six(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
store double 0.000000e+00, double* %3
%4 = load double, double* %3
ret double %4
}

LLVM IR (-O2):
define double @ho_recognize_font_1_six(double* nocapture readnone %0) {
ret double 0.000000e+00
}
/* Variables and functions */
double log(int /*<<< orphan*/);
int /*<<< orphan*/ tan(double);
long lat_deg_to_mm(double x) {
  return (
      long)(6356752.3142 *
            log(tan((x * 0.017453292 + 3.14159265358979323846 / 2.0) / 2.0)));
}


x86 assembly (clang, -O0):
<lat_deg_to_mm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <tan@plt>
mov    %eax,%edi
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe93(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lat_deg_to_mm>:
push   %rax
mulsd  0xed7(%rip),%xmm0
addsd  0xed7(%rip),%xmm0
mulsd  0xed7(%rip),%xmm0
call   1030 <tan@plt>
mov    %eax,%edi
call   1040 <log@plt>
mulsd  0xecb(%rip),%xmm0
cvttsd2si %xmm0,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @lat_deg_to_mm(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fmuladd.f64(double %3, double 0x3F91DF469963E11D, double 0x3FF921FB54442D18)
%5 = fdiv double %4, 2.000000e+00
%6 = call i32 @tan(double %5)
%7 = call double @log(i32 %6)
%8 = fmul double 0x41583FC4141BDA51, %7
%9 = fptosi double %8 to i64
ret i64 %9
}

LLVM IR (-O2):
define i64 @lat_deg_to_mm(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 0x3F91DF469963E11D, double 0x3FF921FB54442D18)
%3 = fmul double %2, 5.000000e-01
%4 = tail call i32 @tan(double %3)
%5 = tail call double @log(i32 %4)
%6 = fmul double %5, 0x41583FC4141BDA51
%7 = fptosi double %6 to i64
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ response_body();
int /*<<< orphan*/ response_headers();
int /*<<< orphan*/ response_line();
void respond() {
  response_line();
  response_headers();
  response_body();
}


x86 assembly (clang, -O0):
<respond>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <response_line@plt>
mov    $0x0,%al
call   1030 <response_headers@plt>
mov    $0x0,%al
call   1050 <response_body@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<respond>:
push   %rax
xor    %eax,%eax
call   1040 <response_line@plt>
xor    %eax,%eax
call   1030 <response_headers@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <response_body@plt>

LLVM IR (-O0):
define void @respond() {
%1 = call i32 (...) @response_line()
%2 = call i32 (...) @response_headers()
%3 = call i32 (...) @response_body()
ret void
}

LLVM IR (-O2):
define void @respond() {
%1 = tail call i32 (...) @response_line()
%2 = tail call i32 (...) @response_headers()
%3 = tail call i32 (...) @response_body()
ret void
}
void foo504(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo504(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ f();
int open(char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int fd;
  printf("hello\n");
  fd = open("abc", "r");
  close(fd);
  f();
  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)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1060 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    $0x0,%al
call   1030 <f@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1060 <open@plt>
mov    %eax,%edi
call   1050 <close@plt>
xor    %eax,%eax
call   1040 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [2 x i8] c"r\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
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = call i32 @close(i32 %9)
%11 = call i32 (...) @f()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [2 x i8] c"r\00"
@str = [6 x i8] c"hello\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @close(i32 %4)
%6 = tail call i32 (...) @f()
ret i32 0
}
int getChallengeScore(int challengeLevel) {
  return 75 + 25 * (challengeLevel - 1);
}


x86 assembly (clang, -O0):
<getChallengeScore>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
imul   $0x19,%eax,%eax
add    $0x4b,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getChallengeScore>:
lea    (%rdi,%rdi,4),%eax
lea    (%rax,%rax,4),%eax
add    $0x32,%eax
ret

LLVM IR (-O0):
define i32 @getChallengeScore(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = mul nsw i32 25, %4
%6 = add nsw i32 75, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @getChallengeScore(i32 %0) {
%2 = mul i32 %0, 25
%3 = add i32 %2, 50
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct wl_registry {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_get_version(struct wl_proxy *);
uint32_t wl_registry_get_version(struct wl_registry *wl_registry) {
  return wl_proxy_get_version((struct wl_proxy *)wl_registry);
}


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

x86 assembly (clang, -O2):
<wl_registry_get_version>:
jmp    1030 <wl_proxy_get_version@plt>

LLVM IR (-O0):
%struct.wl_registry = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_registry_get_version(%struct.wl_registry* %0) {
%2 = alloca %struct.wl_registry*
store %struct.wl_registry* %0, %struct.wl_registry** %2
%3 = load %struct.wl_registry*, %struct.wl_registry** %2
%4 = bitcast %struct.wl_registry* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_get_version(%struct.wl_proxy* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.wl_registry = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_registry_get_version(%struct.wl_registry* %0) {
%2 = bitcast %struct.wl_registry* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_get_version(%struct.wl_proxy* %2)
ret i32 %3
}
int iwl_rfkill_init(struct iwl_priv *priv) { return 0; }


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

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

LLVM IR (-O0):
%struct.iwl_priv = type opaque
define i32 @iwl_rfkill_init(%struct.iwl_priv* %0) {
%2 = alloca %struct.iwl_priv*
store %struct.iwl_priv* %0, %struct.iwl_priv** %2
ret i32 0
}

LLVM IR (-O2):
%struct.iwl_priv = type opaque
define i32 @iwl_rfkill_init(%struct.iwl_priv* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void foobar(int a) { printf("%d\n", a); }


x86 assembly (clang, -O0):
<foobar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foobar>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @foobar(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int min_n(int a, int b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}


x86 assembly (clang, -O0):
<min_n>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <min_n+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <min_n+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_n>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @min_n(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int dSeries(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int iNumber;
  scanf("%d", &iNumber);
  printf("%d\n", dSeries(iNumber));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1040 <dSeries@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <dSeries@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
%4 = call i32 @dSeries(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @dSeries(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
int Fibonacci(int n) {
  if (n < 0)
    return -1;
  else if (n == 0)
    return 0;
  else if (n == 1)
    return 1;
  else
    return (Fibonacci(n - 1) + Fibonacci(n - 2));
}


x86 assembly (clang, -O0):
<Fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1131 <Fibonacci+0x21>
movl   $0xffffffff,-0x4(%rbp)
jmp    1180 <Fibonacci+0x70>
cmpl   $0x0,-0x8(%rbp)
jne    1147 <Fibonacci+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1180 <Fibonacci+0x70>
cmpl   $0x1,-0x8(%rbp)
jne    115d <Fibonacci+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1180 <Fibonacci+0x70>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <Fibonacci@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <Fibonacci@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fibonacci>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
js     1136 <Fibonacci+0x26>
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%ebx
jb     1132 <Fibonacci+0x22>
lea    -0x1(%rbx),%edi
call   1030 <Fibonacci@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x2,%ebx
jae    1120 <Fibonacci+0x10>
add    %ebp,%ebx
jmp    113b <Fibonacci+0x2b>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Fibonacci(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1, %7
%4 = phi i32 [ %10, %7 ], [ %0, %1 ]
%5 = phi i32 [ %11, %7 ], [ 0, %1 ]
%6 = icmp ult i32 %4, 2
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = add nsw i32 %4, -1
%9 = tail call i32 @Fibonacci(i32 %8)
%10 = add nsw i32 %4, -2
%11 = add nsw i32 %9, %5
br label %3
12: ; preds = %3
%13 = add nsw i32 %4, %5
br label %14
14: ; preds = %12, %1
%15 = phi i32 [ %13, %12 ], [ -1, %1 ]
ret i32 %15
}
int __attribute__((no)) bar(int i) {
  switch (i) {
  case 4:
  case 5:
  case 6:
  case 7:
    return 0;
  default:
    return 1;
  }
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffffc,%eax
sub    $0x3,%eax
ja     1127 <bar+0x27>
jmp    111b <bar+0x1b>
movl   $0x0,-0x4(%rbp)
jmp    112e <bar+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
and    $0xfffffffc,%edi
xor    %eax,%eax
cmp    $0x4,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 4, label %5
i32 5, label %5
i32 6, label %5
i32 7, label %5
]
5: ; preds = %1, %1, %1, %1
store i32 0, i32* %2
br label %7
6: ; preds = %1
store i32 1, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = and i32 %0, -4
%3 = icmp ne i32 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}
void gtk_ui_manager_remove_action_group() {}


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

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

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

LLVM IR (-O2):
define void @gtk_ui_manager_remove_action_group() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fs_exsists(char const *);
int fs_parent_mode(char const *);
int /*<<< orphan*/ mkdir(char const *, int);
int /*<<< orphan*/ printf(char *, char const *);
int fs_mkdir(const char *restrict dirname) {
  int parent_mode;
  printf("Making %s\n", dirname);
  if (!fs_exsists(dirname)) {
    parent_mode = fs_parent_mode(dirname);
    mkdir(dirname, parent_mode);
  }
  return 1;
}


x86 assembly (clang, -O0):
<fs_mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <fs_exsists@plt>
cmp    $0x0,%eax
jne    1186 <fs_mkdir+0x46>
mov    -0x8(%rbp),%rdi
call   1030 <fs_parent_mode@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <mkdir@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_mkdir>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <fs_exsists@plt>
test   %eax,%eax
jne    1171 <fs_mkdir+0x31>
mov    %rbx,%rdi
call   1030 <fs_parent_mode@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <mkdir@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Making %s\0A\00"
define i32 @fs_mkdir(i8* noalias %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @fs_exsists(i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @fs_parent_mode(i8* %10)
store i32 %11, i32* %3
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = call i32 @mkdir(i8* %12, i32 %13)
br label %15
15: ; preds = %9, %1
ret i32 1
}

LLVM IR (-O2):
@.str = [11 x i8] c"Making %s\0A\00"
define i32 @fs_mkdir(i8* noalias %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @fs_exsists(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @fs_parent_mode(i8* %0)
%7 = tail call i32 @mkdir(i8* %0, i32 %6)
br label %8
8: ; preds = %5, %1
ret i32 1
}
/* Variables and functions */
scalar_t__ case_func(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x = 0;
  int y = 0;
  for (x = 0; x < 1000000 * 500; x++) {
    y += case_func(x);
  }
  printf("%d\n", y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1dcd6500,-0x8(%rbp)
jge    1174 <main+0x54>
mov    -0x8(%rbp),%edi
call   1030 <case_func@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <case_func@plt>
add    %eax,%ebx
add    $0x1,%ebp
cmp    $0x1dcd6500,%ebp
jne    1130 <main+0x10>
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = phi i32 [ 0, %0 ], [ %7, %1 ]
%4 = tail call i64 @case_func(i32 %3)
%5 = trunc i64 %4 to i32
%6 = add i32 %2, %5
%7 = add nuw nsw i32 %3, 1
%8 = icmp eq i32 %7, 500000000
br i1 %8, label %9, label %1
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
char *test_jump() { return 0; }


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

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

LLVM IR (-O0):
define i8* @test_jump() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @test_jump() {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int getpid();
int gettid();
int /*<<< orphan*/ printf(char *, int, int, char *);
int /*<<< orphan*/ stdout;
void whoami(char *msg) {
  printf("pid %d Thread %d %s\n", getpid(), gettid(), msg);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<whoami>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <gettid@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
mov    -0x8(%rbp),%rcx
lea    0xe93(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whoami>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <gettid@plt>
lea    0xea3(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   1050 <printf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <fflush@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"pid %d Thread %d %s\0A\00"
@stdout = global i32 0
define void @whoami(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @getpid()
%4 = call i32 (...) @gettid()
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i8* %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"pid %d Thread %d %s\0A\00"
@stdout = global i32 0
define void @whoami(i8* %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @gettid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i8* %0)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ set_pin(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int, int);
void set_pin_direction(uint8_t address, uint8_t pin, uint8_t direction) {
  set_pin(address, pin, direction, 0x00, 0x01);
}


x86 assembly (clang, -O0):
<set_pin_direction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1030 <set_pin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pin_direction>:
xor    %ecx,%ecx
mov    $0x1,%r8d
jmp    1030 <set_pin@plt>

LLVM IR (-O0):
define void @set_pin_direction(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @set_pin(i32 %7, i32 %8, i32 %9, i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @set_pin_direction(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @set_pin(i32 %0, i32 %1, i32 %2, i32 0, i32 1)
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int alpha_compare(const void *v1, const void *v2) {
  const char *s1 = *((char **)v1);
  const char *s2 = *((char **)v2);
  if (*s1 != *s2)
    return *s1 - *s2;
  return strcmp(s1, s2);
}


x86 assembly (clang, -O0):
<alpha_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1164 <alpha_compare+0x54>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <alpha_compare+0x64>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alpha_compare>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
cmp    %cl,%al
jne    1125 <alpha_compare+0x15>
jmp    1030 <strcmp@plt>
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @alpha_compare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
store i8* %10, i8** %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i8**
%13 = load i8*, i8** %12
store i8* %13, i8** %7
%14 = load i8*, i8** %6
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %16, %19
br i1 %20, label %21, label %29
21: ; preds = %2
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = load i8*, i8** %7
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = sub nsw i32 %24, %27
store i32 %28, i32* %3
br label %33
29: ; preds = %2
%30 = load i8*, i8** %6
%31 = load i8*, i8** %7
%32 = call i32 @strcmp(i8* %30, i8* %31)
store i32 %32, i32* %3
br label %33
33: ; preds = %29, %21
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @alpha_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = load i8, i8* %4
%8 = load i8, i8* %6
%9 = icmp eq i8 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = sext i8 %8 to i32
%12 = sext i8 %7 to i32
%13 = sub nsw i32 %12, %11
br label %16
14: ; preds = %2
%15 = tail call i32 @strcmp(i8* %4, i8* %6)
br label %16
16: ; preds = %14, %10
%17 = phi i32 [ %13, %10 ], [ %15, %14 ]
ret i32 %17
}
int is_not_digit(char cc) { return (cc > '9') || (cc < '0'); }


x86 assembly (clang, -O0):
<is_not_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jg     1129 <is_not_digit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
setl   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_not_digit>:
add    $0xc6,%dil
xor    %eax,%eax
cmp    $0xf6,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_not_digit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sgt i32 %4, 57
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 48
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_not_digit(i8 signext %0) {
%2 = add i8 %0, -58
%3 = icmp ult i8 %2, -10
%4 = zext i1 %3 to i32
ret i32 %4
}
void initUART(void) {
  (*(volatile unsigned int *)(0x7F008000)) =
      ((*(volatile unsigned int *)(0x7F008000)) & 0xFFFFFF00) | 0x00000022;
  (*(volatile unsigned int *)(0x7F005028)) = 34;
  (*(volatile unsigned int *)(0x7F00502C)) = 0xDFDD;
  (*(volatile unsigned int *)(0x7F005000)) = 3;
  (*(volatile unsigned int *)(0x7F005004)) =
      ((*(volatile unsigned int *)(0x7F005004)) & 0xFFFFF000) | 0x805;
  (*(volatile unsigned int *)(0x7F005008)) = 0;
  (*(volatile unsigned int *)(0x7F00500C)) = 0;
  return;
}


x86 assembly (clang, -O0):
<initUART>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f008000,%eax
mov    (%rax),%ecx
and    $0xffffff00,%ecx
or     $0x22,%ecx
mov    $0x7f008000,%eax
mov    %ecx,(%rax)
mov    $0x7f005028,%eax
movl   $0x22,(%rax)
mov    $0x7f00502c,%eax
movl   $0xdfdd,(%rax)
mov    $0x7f005000,%eax
movl   $0x3,(%rax)
mov    $0x7f005004,%eax
mov    (%rax),%ecx
and    $0xfffff000,%ecx
or     $0x805,%ecx
mov    $0x7f005004,%eax
mov    %ecx,(%rax)
mov    $0x7f005008,%eax
movl   $0x0,(%rax)
mov    $0x7f00500c,%eax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<initUART>:
mov    $0xffffff00,%eax
and    0x7f008000,%eax
or     $0x22,%eax
mov    %eax,0x7f008000
movl   $0x22,0x7f005028
movl   $0xdfdd,0x7f00502c
movl   $0x3,0x7f005000
mov    $0xfffff000,%eax
and    0x7f005004,%eax
or     $0x805,%eax
mov    %eax,0x7f005004
movl   $0x0,0x7f005008
movl   $0x0,0x7f00500c
ret

LLVM IR (-O0):
define void @initUART() {
%1 = load volatile i32, i32* inttoptr (i64 2130739200 to i32*)
%2 = and i32 %1, -256
%3 = or i32 %2, 34
store volatile i32 %3, i32* inttoptr (i64 2130739200 to i32*)
store volatile i32 34, i32* inttoptr (i64 2130726952 to i32*)
store volatile i32 57309, i32* inttoptr (i64 2130726956 to i32*)
store volatile i32 3, i32* inttoptr (i64 2130726912 to i32*)
%4 = load volatile i32, i32* inttoptr (i64 2130726916 to i32*)
%5 = and i32 %4, -4096
%6 = or i32 %5, 2053
store volatile i32 %6, i32* inttoptr (i64 2130726916 to i32*)
store volatile i32 0, i32* inttoptr (i64 2130726920 to i32*)
store volatile i32 0, i32* inttoptr (i64 2130726924 to i32*)
ret void
}

LLVM IR (-O2):
define void @initUART() {
%1 = load volatile i32, i32* inttoptr (i64 2130739200 to i32*)
%2 = and i32 %1, -256
%3 = or i32 %2, 34
store volatile i32 %3, i32* inttoptr (i64 2130739200 to i32*)
store volatile i32 34, i32* inttoptr (i64 2130726952 to i32*)
store volatile i32 57309, i32* inttoptr (i64 2130726956 to i32*)
store volatile i32 3, i32* inttoptr (i64 2130726912 to i32*)
%4 = load volatile i32, i32* inttoptr (i64 2130726916 to i32*)
%5 = and i32 %4, -4096
%6 = or i32 %5, 2053
store volatile i32 %6, i32* inttoptr (i64 2130726916 to i32*)
store volatile i32 0, i32* inttoptr (i64 2130726920 to i32*)
store volatile i32 0, i32* inttoptr (i64 2130726924 to i32*)
ret void
}
void GB_ONE_f_FP64(double *z, const double *x) { (*z) = 1; }


x86 assembly (clang, -O0):
<GB_ONE_f_FP64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xee8(%rip),%xmm0
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GB_ONE_f_FP64>:
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @GB_ONE_f_FP64(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
store double 1.000000e+00, double* %5
ret void
}

LLVM IR (-O2):
define void @GB_ONE_f_FP64(double* nocapture writeonly %0, double* nocapture readnone %1) {
store double 1.000000e+00, double* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *, int);
void *sal_malloc(size_t size) {
  if (size < 1)
    size = 1;
  void *ptr = (char *)malloc(size);
  if (ptr == NULL) {
    printf("Cannot alloc %d bytes.\n", (int)size);
    exit(1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<sal_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x1,-0x8(%rbp)
jae    114f <sal_malloc+0x1f>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1183 <sal_malloc+0x53>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sal_malloc>:
push   %rbx
test   %rdi,%rdi
mov    $0x1,%ebx
cmovne %rdi,%rbx
mov    %rbx,%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     114c <sal_malloc+0x1c>
pop    %rbx
ret
lea    0xead(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Cannot alloc %d bytes.\0A\00"
define i8* @sal_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ult i64 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 1, i64* %2
br label %7
7: ; preds = %6, %1
%8 = load i64, i64* %2
%9 = call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i64, i64* %2
%15 = trunc i64 %14 to i32
%16 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %7
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
@.str = [24 x i8] c"Cannot alloc %d bytes.\0A\00"
define i8* @sal_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i64 1, i64 %0
%4 = tail call i64 @malloc(i64 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = trunc i64 %3 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = inttoptr i64 %4 to i8*
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void sent_zero(void) { sleep(1); }


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

x86 assembly (clang, -O2):
<sent_zero>:
mov    $0x1,%edi
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @sent_zero() {
%1 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
define void @sent_zero() {
%1 = tail call i32 @sleep(i32 1)
ret void
}
/* Variables and functions */
int read(int, unsigned char *, int);
int rs232_read(int fd, unsigned char *buf, int size) {
  int n;
  n = read(fd, buf, size);
  return (n);
}


x86 assembly (clang, -O0):
<rs232_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rs232_read>:
jmp    1030 <read@plt>

LLVM IR (-O0):
define i32 @rs232_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @read(i32 %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @rs232_read(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
ret i32 %4
}