xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *name) {
  printf("Usage %s [num_threads] [total_iterations]\n", name);
  printf("%s will call sys_getuid() total_iterations [default 2,000,000]\n",
         name);
  printf("times divided across num_threads [default 1].\n\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Usage %s [num_threads] [total_iterations]\0A\00"
@.str.1 = [64 x i8] c"%s will call sys_getuid() total_iterations [default 2,000,000]\0A\00"
@.str.2 = [48 x i8] c"times divided across num_threads [default 1].\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [43 x i8] c"Usage %s [num_threads] [total_iterations]\0A\00"
@.str.1 = [64 x i8] c"%s will call sys_getuid() total_iterations [default 2,000,000]\0A\00"
@str = [47 x i8] c"times divided across num_threads [default 1].\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
int /*<<< orphan*/ free(void *);
void deallocate(void *value) {
  assert(value);
  free(value);
}


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

x86 assembly (clang, -O2):
<deallocate>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @deallocate(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @assert(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @deallocate(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int **);
scalar_t__ malloc(int);
int main() {
  int **pa;
  pa = (int **)malloc(5 * 8);
  free(pa);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
store i32 0, i32* %1
%3 = call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to i32**
store i32** %4, i32*** %2
%5 = load i32**, i32*** %2
%6 = call i32 @free(i32** %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to i32**
%3 = tail call i32 @free(i32** %2)
ret i32 0
}
double areaDoTriangulo(double a, double b, double c) { return (a + b) * c / 2; }


x86 assembly (clang, -O0):
<areaDoTriangulo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<areaDoTriangulo>:
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @areaDoTriangulo(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fadd double %7, %8
%10 = load double, double* %6
%11 = fmul double %9, %10
%12 = fdiv double %11, 2.000000e+00
ret double %12
}

LLVM IR (-O2):
define double @areaDoTriangulo(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fmul double %4, %2
%6 = fmul double %5, 5.000000e-01
ret double %6
}
void f(int a, int b) {}


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

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

LLVM IR (-O0):
define void @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @f(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int av_clipl_int32_c(scalar_t__);
int av_sat_add32_c(int a, int b) { return av_clipl_int32_c((int64_t)a + b); }


x86 assembly (clang, -O0):
<av_sat_add32_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rdi
movslq -0x8(%rbp),%rax
add    %rax,%rdi
call   1030 <av_clipl_int32_c@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_sat_add32_c>:
movslq %edi,%rax
movslq %esi,%rdi
add    %rax,%rdi
jmp    1030 <av_clipl_int32_c@plt>

LLVM IR (-O0):
define i32 @av_sat_add32_c(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = add nsw i64 %6, %8
%10 = call i32 @av_clipl_int32_c(i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @av_sat_add32_c(i32 %0, i32 %1) {
%3 = sext i32 %0 to i64
%4 = sext i32 %1 to i64
%5 = add nsw i64 %4, %3
%6 = tail call i32 @av_clipl_int32_c(i64 %5)
ret i32 %6
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *strnsave(const char *str, int n) {
  char *neww;
  neww = malloc(n + 1);
  strncpy(neww, str, n);
  neww[n] = '\0';
  return neww;
}


x86 assembly (clang, -O0):
<strnsave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnsave>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strnsave(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @strncpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @strnsave(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
store i8 0, i8* %7
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ test_setenv_p();
int /*<<< orphan*/ test_unsetenv_p();
int main() {
  test_setenv_p();
  test_unsetenv_p();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_setenv_p@plt>
mov    $0x0,%al
call   1040 <test_unsetenv_p@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_setenv_p@plt>
xor    %eax,%eax
call   1040 <test_unsetenv_p@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test_setenv_p()
%2 = call i32 (...) @test_unsetenv_p()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_setenv_p()
%2 = tail call i32 (...) @test_unsetenv_p()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Menus_ActivateByName(char const *);
void Menus_OpenByName(const char *p) { Menus_ActivateByName(p); }


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

x86 assembly (clang, -O2):
<Menus_OpenByName>:
jmp    1030 <Menus_ActivateByName@plt>

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

LLVM IR (-O2):
define void @Menus_OpenByName(i8* %0) {
%2 = tail call i32 @Menus_ActivateByName(i8* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ wait(int /*<<< orphan*/);
void process(int n, void (*func)(int, void *)) {
  for (int i = 0; i < n; i++) {
    pid_t pid = fork();
    if (pid == 0) {
      continue;
    } else {
      func(i, NULL);
      wait(0);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1184 <process+0x64>
mov    $0x0,%al
call   1040 <fork@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115d <process+0x3d>
jmp    1176 <process+0x56>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
xor    %ecx,%ecx
mov    %ecx,%esi
call   *%rax
xor    %edi,%edi
call   1030 <wait@plt>
jmp    1184 <process+0x64>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <process+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1143 <process+0x23>
mov    %rsi,%r14
mov    %edi,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
jne    1148 <process+0x28>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1130 <process+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebx,%edi
xor    %esi,%esi
call   *%r14
xor    %edi,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <wait@plt>

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

LLVM IR (-O2):
define void @process(i32 %0, void (i32, i8*)* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %10
%5 = phi i32 [ %11, %10 ], [ 0, %2 ]
%6 = tail call i64 (...) @fork()
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
tail call void %1(i32 %5, i8* null)
%9 = tail call i32 @wait(i32 0)
br label %13
10: ; preds = %4
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, %0
br i1 %12, label %13, label %4
13: ; preds = %10, %2, %8
ret void
}
long double sll2ld(s)
long long int s;
{ return s; }


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

x86 assembly (clang, -O2):
<sll2ld>:
mov    %rdi,-0x8(%rsp)
fildll -0x8(%rsp)
ret

LLVM IR (-O0):
define x86_fp80 @sll2ld(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sitofp i64 %3 to x86_fp80
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @sll2ld(i64 %0) {
%2 = sitofp i64 %0 to x86_fp80
ret x86_fp80 %2
}
int sbi_remote_fence_i(const unsigned long *hart_mask) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @sbi_remote_fence_i(i64* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0x24() {
  Assert_real((isupper(36) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isupper.c",
              185, ("isupper should be 0 for $"));
}


x86 assembly (clang, -O0):
<t_isupper_0x24>:
push   %rbp
mov    %rsp,%rbp
mov    $0x24,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0xb9,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0x24>:
push   %rax
mov    $0x24,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xb9,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 0 for $\00"
define void @t_isupper_0x24() {
%1 = call i64 @isupper(i32 36)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 185, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 0 for $\00"
define void @t_isupper_0x24() {
%1 = tail call i64 @isupper(i32 36)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 185, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int main() {
  struct mystruct {
    int a;
    int b;
  } m;
  int local;
  int arr[3];
  int *ptr;
  ptr = &local;
  m.a = local + sizeof(m) + arr[2];
  return m.a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
add    $0x8,%rax
movslq -0x18(%rbp),%rcx
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mystruct = type { i32, i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.mystruct
%3 = alloca i32
%4 = alloca [3 x i32]
%5 = alloca i32*
store i32 0, i32* %1
store i32* %3, i32** %5
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = add i64 %7, 8
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = add i64 %8, %11
%13 = trunc i64 %12 to i32
%14 = getelementptr inbounds %struct.mystruct, %struct.mystruct* %2, i32 0, i32 0
store i32 %13, i32* %14
%15 = getelementptr inbounds %struct.mystruct, %struct.mystruct* %2, i32 0, i32 0
%16 = load i32, i32* %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *);
int /*<<< orphan*/ output_byte(int);
void emit_fsqrt() {
  assem_debug("fsqrt\n");
  output_byte(0xd9);
  output_byte(0xfa);
}


x86 assembly (clang, -O0):
<emit_fsqrt>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xfa,%edi
call   1040 <output_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fsqrt>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xfa,%edi
pop    %rax
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"fsqrt\0A\00"
define void @emit_fsqrt() {
%1 = call i32 @assem_debug(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @output_byte(i32 217)
%3 = call i32 @output_byte(i32 250)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"fsqrt\0A\00"
define void @emit_fsqrt() {
%1 = tail call i32 @assem_debug(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_byte(i32 217)
%3 = tail call i32 @output_byte(i32 250)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hostapi_putc(int /*<<< orphan*/);
void put_s(const char *str) {
  while (*str)
    hostapi_putc(*str++);
}


x86 assembly (clang, -O0):
<put_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <put_s+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <hostapi_putc@plt>
jmp    111c <put_s+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_s>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <put_s+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <hostapi_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <put_s+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @put_s(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @hostapi_putc(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
int fun269() { return 269; }


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

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

LLVM IR (-O0):
define i32 @fun269() {
ret i32 269
}

LLVM IR (-O2):
define i32 @fun269() {
ret i32 269
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void va_overload2(int p1, int p2) { printf("va_overload2 %d %d\n", p1, p2); }


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

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

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

LLVM IR (-O2):
@.str = [20 x i8] c"va_overload2 %d %d\0A\00"
define void @va_overload2(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
/* Type definitions */
struct map {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ *map_find(struct map const *, unsigned int);
int map_contains(const struct map *map, unsigned int key) {
  return (map_find(map, key) == NULL) ? 0 : 1;
}


x86 assembly (clang, -O0):
<map_contains>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <map_find@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_contains>:
push   %rax
call   1030 <map_find@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.map = type { i32 }
define i32 @map_contains(%struct.map* %0, i32 %1) {
%3 = alloca %struct.map*
%4 = alloca i32
store %struct.map* %0, %struct.map** %3
store i32 %1, i32* %4
%5 = load %struct.map*, %struct.map** %3
%6 = load i32, i32* %4
%7 = call i32* @map_find(%struct.map* %5, i32 %6)
%8 = icmp eq i32* %7, null
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
%struct.map = type { i32 }
define i32 @map_contains(%struct.map* %0, i32 %1) {
%3 = tail call i32* @map_find(%struct.map* %0, i32 %1)
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t;

/* Variables and functions */
int /*<<< orphan*/ *bitvector_resize(int /*<<< orphan*/ *, size_t);
u_int32_t *mk_bitvector(size_t n) { return bitvector_resize(NULL, n); }


x86 assembly (clang, -O0):
<mk_bitvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <bitvector_resize@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_bitvector>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <bitvector_resize@plt>

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

LLVM IR (-O2):
define i32* @mk_bitvector(i64 %0) {
%2 = tail call i32* @bitvector_resize(i32* null, i64 %0)
ret i32* %2
}
int maxi(int a, int b) {
  if (b > a)
    return b;
  return a;
}


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

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

LLVM IR (-O0):
define i32 @maxi(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* %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %5
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
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 @maxi(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
void foo_1_2_1_2_2_2_1_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_1_2_2_2_1_2_2() {
ret void
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct fileinfo_list_link {
  int dummy;
};
struct fileinfo_list {
  int dummy;
};
struct fileinfo {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_search(struct genlist const *, struct fileinfo const *);
struct fileinfo_list_link *
fileinfo_list_search(const struct fileinfo_list *tthis,
                     const struct fileinfo *pfoo) {
  return ((struct fileinfo_list_link *)genlist_search(
      (const struct genlist *)tthis, pfoo));
}


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

x86 assembly (clang, -O2):
<fileinfo_list_search>:
jmp    1030 <genlist_search@plt>

LLVM IR (-O0):
%struct.fileinfo_list_link = type { i32 }
%struct.fileinfo_list = type { i32 }
%struct.fileinfo = type { i32 }
%struct.genlist = type { i32 }
define %struct.fileinfo_list_link* @fileinfo_list_search(%struct.fileinfo_list* %0, %struct.fileinfo* %1) {
%3 = alloca %struct.fileinfo_list*
%4 = alloca %struct.fileinfo*
store %struct.fileinfo_list* %0, %struct.fileinfo_list** %3
store %struct.fileinfo* %1, %struct.fileinfo** %4
%5 = load %struct.fileinfo_list*, %struct.fileinfo_list** %3
%6 = bitcast %struct.fileinfo_list* %5 to %struct.genlist*
%7 = load %struct.fileinfo*, %struct.fileinfo** %4
%8 = call i64 @genlist_search(%struct.genlist* %6, %struct.fileinfo* %7)
%9 = inttoptr i64 %8 to %struct.fileinfo_list_link*
ret %struct.fileinfo_list_link* %9
}

LLVM IR (-O2):
%struct.fileinfo_list_link = type { i32 }
%struct.fileinfo_list = type { i32 }
%struct.fileinfo = type { i32 }
%struct.genlist = type { i32 }
define %struct.fileinfo_list_link* @fileinfo_list_search(%struct.fileinfo_list* %0, %struct.fileinfo* %1) {
%3 = bitcast %struct.fileinfo_list* %0 to %struct.genlist*
%4 = tail call i64 @genlist_search(%struct.genlist* %3, %struct.fileinfo* %1)
%5 = inttoptr i64 %4 to %struct.fileinfo_list_link*
ret %struct.fileinfo_list_link* %5
}
void mysysex(leng, mess) int leng;
char *mess;
{
  prtime();
  printf("SysEx");
  prhex(mess, leng);
}


x86 assembly (clang, -O0):
<mysysex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <prtime@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x0,%al
call   1040 <prhex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysysex>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <prtime@plt>
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <prhex@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"SysEx\00"
define void @mysysex(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = call i32 (...) @prtime()
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %4
%8 = load i32, i32* %3
%9 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @prhex to i32 (i8*, i32, ...)*)(i8* %7, i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"SysEx\00"
define void @mysysex(i32 %0, i8* %1) {
%3 = tail call i32 (...) @prtime()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @prhex to i32 (i8*, i32, ...)*)(i8* %1, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_client_conf_env() {
  printf("NOT IMPLEMENTED:"
         "pa_client_conf_env"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"NOT IMPLEMENTED:pa_client_conf_env\0A\00"
define i32 @pa_client_conf_env() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [35 x i8] c"NOT IMPLEMENTED:pa_client_conf_env\00"
define i32 @pa_client_conf_env() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
double my_fmin(double a, double b) { return b < a ? b : a; }


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

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

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

LLVM IR (-O2):
define double @my_fmin(double %0, double %1) {
%3 = fcmp olt double %1, %0
%4 = select i1 %3, double %1, double %0
ret double %4
}
int meow() {
  int i = 10;
  while (i > 0) {
    if (i % 3 == 2)
      break;
    i = i - 1;
  }
  int x[i];
  return i;
}


x86 assembly (clang, -O0):
<meow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xa,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1140 <meow+0x40>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    1132 <meow+0x32>
jmp    1140 <meow+0x40>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110f <meow+0xf>
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @meow() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
store i32 10, i32* %1
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %1
%9 = srem i32 %8, 3
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %7
br label %15
12: ; preds = %7
%13 = load i32, i32* %1
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %1
br label %4
15: ; preds = %11, %4
%16 = load i32, i32* %1
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %2
%19 = alloca i32, i64 %17
store i64 %17, i64* %3
%20 = load i32, i32* %1
%21 = load i8*, i8** %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @meow() {
ret i32 8
}
/* Variables and functions */
int round(float number) {
  return number > 0 ? (number + 0.5f) : (number - 0.5f);
}


x86 assembly (clang, -O0):
<round>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1131 <round+0x31>
movss  0xede(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1147 <round+0x47>
movss  -0x4(%rbp),%xmm0
movss  0xec2(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round>:
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
lea    0xeee(%rip),%rcx
addss  (%rcx,%rax,4),%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @round(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp ogt float %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load float, float* %2
%7 = fadd float %6, 5.000000e-01
br label %11
8: ; preds = %1
%9 = load float, float* %2
%10 = fsub float %9, 5.000000e-01
br label %11
11: ; preds = %8, %5
%12 = phi float [ %7, %5 ], [ %10, %8 ]
%13 = fptosi float %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @round(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
%3 = select i1 %2, float 5.000000e-01, float -5.000000e-01
%4 = fadd float %3, %0
%5 = fptosi float %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("main\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"main\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int main() {
  int i;
  int b = 1;
#pragma pomp inst init
#pragma pomp inst off
#pragma pomp inst begin(foo)
#pragma omp parallel
  i = 1;
#pragma pomp inst on
#pragma pomp noinstrument
#pragma omp parallel
  i = 2;
#pragma pomp instrument
#pragma omp parallel
  i = 3;
  if (b) {
#pragma pomp inst altend(foo)
    return 0;
  }
#pragma omp parallel
  {
#pragma pomp inst begin(phase1)
    i = 4;
#pragma omp barrier
    i = 5;
#pragma pomp inst end(phase1)
  }
  if (b) {
#pragma pomp inst altend(foo)
    return 0;
  }
#pragma pomp inst end(foo)
#pragma pomp inst finalize
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113d <main+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1168 <main+0x68>
movl   $0x4,-0x8(%rbp)
movl   $0x5,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1161 <main+0x61>
movl   $0x0,-0x4(%rbp)
jmp    1168 <main+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int __isalpha_ascii(int ch) { return (unsigned int)((ch | 0x20) - 'a') < 26u; }


x86 assembly (clang, -O0):
<__isalpha_ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x20,%eax
sub    $0x61,%eax
cmp    $0x1a,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__isalpha_ascii>:
or     $0x20,%edi
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @__isalpha_ascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = or i32 %3, 32
%5 = sub nsw i32 %4, 97
%6 = icmp ult i32 %5, 26
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @__isalpha_ascii(i32 %0) {
%2 = or i32 %0, 32
%3 = add nsw i32 %2, -97
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
void ft_striter(char *s, void (*f)(char *)) {
  if (!s || !f)
    return;
  while (*s)
    f(s++);
}


x86 assembly (clang, -O0):
<ft_striter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1126 <ft_striter+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    112b <ft_striter+0x2b>
jmp    1157 <ft_striter+0x57>
jmp    1130 <ft_striter+0x30>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1157 <ft_striter+0x57>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    %rdi,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
call   *%rax
jmp    1130 <ft_striter+0x30>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striter>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1133 <ft_striter+0x33>
mov    %rsi,%r14
test   %rsi,%rsi
je     1133 <ft_striter+0x33>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1133 <ft_striter+0x33>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%r15
mov    %rbx,%rdi
call   *%r14
cmpb   $0x0,0x1(%rbx)
mov    %r15,%rbx
jne    1120 <ft_striter+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striter(i8* %0, void (i8*)* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne void (i8*)* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %6, %9
%10 = phi i8* [ %11, %9 ], [ %0, %6 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
tail call void %1(i8* %10)
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %9
14: ; preds = %9, %6, %2
ret void
}
float clip_value(float x, float lo, float hi) {
  float clip;
  clip = x;
  if (x < lo) {
    clip = lo;
  }
  if (x > hi) {
    clip = hi;
  }
  return clip;
}


x86 assembly (clang, -O0):
<clip_value>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    113a <clip_value+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1153 <clip_value+0x53>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clip_value>:
maxss  %xmm0,%xmm1
movaps %xmm2,%xmm3
cmpltss %xmm0,%xmm3
movaps %xmm3,%xmm0
andnps %xmm1,%xmm0
andps  %xmm2,%xmm3
orps   %xmm0,%xmm3
movaps %xmm3,%xmm0
ret

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

LLVM IR (-O2):
define float @clip_value(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
%5 = select i1 %4, float %1, float %0
%6 = fcmp ogt float %0, %2
%7 = select i1 %6, float %2, float %5
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ __tracing_path_set(char *, char const *);
char *debugfs__mount();
const char *tracing_path_debugfs_mount(void) {
  const char *mnt;
  mnt = debugfs__mount();
  if (!mnt)
    return NULL;
  __tracing_path_set("tracing/", mnt);
  return mnt;
}


x86 assembly (clang, -O0):
<tracing_path_debugfs_mount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <debugfs__mount@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <tracing_path_debugfs_mount+0x2b>
movq   $0x0,-0x8(%rbp)
jmp    1163 <tracing_path_debugfs_mount+0x43>
mov    -0x10(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <__tracing_path_set@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tracing_path_debugfs_mount>:
push   %rbx
xor    %eax,%eax
call   1040 <debugfs__mount@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113f <tracing_path_debugfs_mount+0x1f>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <__tracing_path_set@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"tracing/\00"
define i8* @tracing_path_debugfs_mount() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* (...) @debugfs__mount()
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %0
store i8* null, i8** %1
br label %11
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @__tracing_path_set(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %2
store i8* %10, i8** %1
br label %11
11: ; preds = %7, %6
%12 = load i8*, i8** %1
ret i8* %12
}

LLVM IR (-O2):
@.str = [9 x i8] c"tracing/\00"
define i8* @tracing_path_debugfs_mount() {
%1 = tail call i8* (...) @debugfs__mount()
%2 = icmp eq i8* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @__tracing_path_set(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %5
5: ; preds = %0, %3
ret i8* %1
}
char *my_index(str, chr) const char *str;
int chr;
{
  while (*str) {
    if (*str == chr)
      return str;
    str++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<my_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <my_index+0x46>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1135 <my_index+0x35>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114e <my_index+0x4e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <my_index+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_index>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <my_index+0x23>
mov    %rdi,%rax
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %esi,%ecx
je     1125 <my_index+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <my_index+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @my_index(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}
/* Variables and functions */
int strcmp(char const *, char const *);
int string_compare(const char *s1, const char *s2) { return strcmp(s1, s2); }


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

x86 assembly (clang, -O2):
<string_compare>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @string_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
print_ack_blck_mismatch_error(int bnum, int e_bnum) {
  printf("ACK packet with block number %d received, %d expected\n", bnum,
         e_bnum);
}


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

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

LLVM IR (-O0):
@.str = [55 x i8] c"ACK packet with block number %d received, %d expected\0A\00"
define i32 @print_ack_blck_mismatch_error(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 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@.str = [55 x i8] c"ACK packet with block number %d received, %d expected\0A\00"
define i32 @print_ack_blck_mismatch_error(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 undef
}