xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
void *calloc(size_t, size_t);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void *hhcalloc(size_t count, size_t size) {
  void *memory = calloc(count, size);
  if (memory == NULL) {
    perror("calloc");
    exit(EXIT_FAILURE);
  }
  return memory;
}


x86 assembly (clang, -O0):
<hhcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1176 <hhcalloc+0x46>
lea    0xe9d(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hhcalloc>:
push   %rax
call   1030 <calloc@plt>
test   %rax,%rax
je     113d <hhcalloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"calloc\00"
@EXIT_FAILURE = global i32 0
define i8* @hhcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@.str = [7 x i8] c"calloc\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @hhcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
ret i8* %3
}
long long int f13(long long int arg) { return arg; }


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

x86 assembly (clang, -O2):
<f13>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @f13(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
ret i64 %3
}

LLVM IR (-O2):
define i64 @f13(i64 returned %0) {
ret i64 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ write(int, int /*<<< orphan*/ *, int);
int __attribute__((unused)) putchar(int c) {
  write(1, (uint8_t *)&c, 1);
  return c;
}


x86 assembly (clang, -O0):
<putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edx
lea    -0x4(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putchar>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @putchar(i32 returned %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @write(i32 1, i32* %2, i32 1)
ret i32 %0
}
char *langRomTypeExtRam4mb() { return "4MB External RAM"; }


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"4MB External RAM\00"
define i8* @langRomTypeExtRam4mb() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
void up_set_gauge_mail(int current) {}


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

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

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

LLVM IR (-O2):
define void @up_set_gauge_mail(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ ftruncate;
int main(int argc, char **argv) {
  void *p;
  (void)argc;
  (void)argv;
  p = (void *)(ftruncate);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@ftruncate = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* @ftruncate
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %6
ret i32 0
}

LLVM IR (-O2):
@ftruncate = global i64 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void a_dec(volatile int *x) {
  __asm__("lock ; .byte 0x67\n\tdecl %0" : "=m"(*x) : "m"(*x) : "memory");
}


x86 assembly (clang, -O0):
<a_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
lock decl (%eax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_dec>:
lock decl (%edi)
ret

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

LLVM IR (-O2):
define void @a_dec(i32* %0) {
tail call void asm "lock ; .byte 0x67\0A\09decl $0", "=*m,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32* elementtype(i32) %0)
ret void
}
void ll_unloadlib(void *lib) { (void)lib; }


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

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

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

LLVM IR (-O2):
define void @ll_unloadlib(i8* nocapture %0) {
ret void
}
int fnCheckPrime(int iX) {
  int i, isPrime = 1;
  for (i = 2; i < iX; i++) {
    if (iX % i == 0) {
      isPrime = 0;
      break;
    }
  }
  if (isPrime)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<fnCheckPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1150 <fnCheckPrime+0x50>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113d <fnCheckPrime+0x3d>
movl   $0x0,-0x10(%rbp)
jmp    1150 <fnCheckPrime+0x50>
jmp    1142 <fnCheckPrime+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <fnCheckPrime+0x15>
cmpl   $0x0,-0x10(%rbp)
je     1166 <fnCheckPrime+0x66>
movl   $0x1,-0x4(%rbp)
jmp    116d <fnCheckPrime+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnCheckPrime>:
mov    $0x1,%eax
cmp    $0x3,%edi
jl     1139 <fnCheckPrime+0x39>
xor    %eax,%eax
test   $0x1,%dil
je     1139 <fnCheckPrime+0x39>
mov    $0x3,%eax
nopw   0x0(%rax,%rax,1)
mov    %eax,%ecx
cmp    %eax,%edi
je     1132 <fnCheckPrime+0x32>
mov    %edi,%eax
cltd
idiv   %ecx
lea    0x1(%rcx),%eax
test   %edx,%edx
jne    1120 <fnCheckPrime+0x20>
xor    %eax,%eax
cmp    %edi,%ecx
setge  %al
ret

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

LLVM IR (-O2):
define i32 @fnCheckPrime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %3, label %16
3: ; preds = %1
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %9
%7 = phi i32 [ %12, %9 ], [ 3, %3 ]
%8 = icmp eq i32 %7, %0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = srem i32 %0, %7
%11 = icmp eq i32 %10, 0
%12 = add nuw nsw i32 %7, 1
br i1 %11, label %13, label %6
13: ; preds = %6, %9
%14 = icmp sge i32 %7, %0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %13, %3, %1
%17 = phi i32 [ 1, %1 ], [ 0, %3 ], [ %15, %13 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_1();
int /*<<< orphan*/ test_2();
int /*<<< orphan*/ test_3();
int main(int argc, char **argv) {
  test_1();
  test_2();
  test_3();
  printf("OVER\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_1@plt>
xor    %eax,%eax
call   1050 <test_2@plt>
xor    %eax,%eax
call   1060 <test_3@plt>
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"OVER\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test_1()
%7 = call i32 (...) @test_2()
%8 = call i32 (...) @test_3()
%9 = 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"OVER\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_1()
%4 = tail call i32 (...) @test_2()
%5 = tail call i32 (...) @test_3()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
const char *loader_AF_get_name(void) {
  return "loader for KC85/3+4 Emulator by Arne Fitzenreiter";
}


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

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

LLVM IR (-O0):
@.str = [50 x i8] c"loader for KC85/3+4 Emulator by Arne Fitzenreiter\00"
define i8* @loader_AF_get_name() {
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [50 x i8] c"loader for KC85/3+4 Emulator by Arne Fitzenreiter\00"
define i8* @loader_AF_get_name() {
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0)
}
void mpi_finalize(void) {}


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

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

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

LLVM IR (-O2):
define void @mpi_finalize() {
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int main() {
  char c;
  printf("Enter character: ");
  c = getchar();
  printf("Character entered: %i\n", c);
  putchar(c);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl %al,%ebx
lea    0xec2(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter character: \00"
@.str.1 = [23 x i8] c"Character entered: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i8, i8* %2
%9 = call i32 @putchar(i8 signext %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter character: \00"
@.str.1 = [23 x i8] c"Character entered: %i\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = sext i8 %2 to i32
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @putchar(i8 signext %2)
ret i32 0
}
/* Variables and functions */
void *realloc(void *, size_t);
void *realloc_and_null_check(void *ptr, size_t size) {
  void *tmp = realloc(ptr, size);
  if (!tmp) {
    ;
  }
  return tmp;
}


x86 assembly (clang, -O0):
<realloc_and_null_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1141 <realloc_and_null_check+0x31>
jmp    1141 <realloc_and_null_check+0x31>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realloc_and_null_check>:
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @realloc_and_null_check(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ const int64_t;

/* Variables and functions */
scalar_t__ eb128_compose_264(int /*<<< orphan*/ const,
                             int /*<<< orphan*/ const);
bool eb128i_greater_or_equal_264(const uint64_t alo, const int64_t ahi,
                                 const uint64_t const blo, int64_t bhi) {
  return eb128_compose_264(alo, ahi) >= eb128_compose_264(blo, bhi);
}


x86 assembly (clang, -O0):
<eb128i_greater_or_equal_264>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <eb128_compose_264@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <eb128_compose_264@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eb128i_greater_or_equal_264>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
call   1030 <eb128_compose_264@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <eb128_compose_264@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
setge  %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @eb128i_greater_or_equal_264(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i64 @eb128_compose_264(i32 %9, i32 %10)
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i64 @eb128_compose_264(i32 %12, i32 %13)
%15 = icmp sge i64 %11, %14
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @eb128i_greater_or_equal_264(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @eb128_compose_264(i32 %0, i32 %1)
%6 = tail call i64 @eb128_compose_264(i32 %2, i32 %3)
%7 = icmp sge i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int sign_extend(int val, unsigned bits) {
  unsigned shift = 8 * sizeof(int) - bits;
  union {
    unsigned u;
    int s;
  } v = {(unsigned)val << shift};
  return v.s >> shift;
}


x86 assembly (clang, -O0):
<sign_extend>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    $0x20,%eax
sub    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign_extend>:
mov    %esi,%ecx
mov    %edi,%eax
neg    %cl
shl    %cl,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %union.anon
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = sub i64 32, %8
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = bitcast %union.anon* %6 to i32*
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = shl i32 %12, %13
store i32 %14, i32* %11
%15 = bitcast %union.anon* %6 to i32*
%16 = load i32, i32* %15
%17 = load i32, i32* %5
%18 = ashr i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = sub i32 32, %1
%4 = shl i32 %0, %3
%5 = ashr i32 %4, %3
ret i32 %5
}
/* Variables and functions */
size_t bgr24_sz(unsigned width, unsigned height) { return width * height * 3; }


x86 assembly (clang, -O0):
<bgr24_sz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   $0x3,%eax,%eax
mov    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bgr24_sz>:
imul   %esi,%edi
lea    (%rdi,%rdi,2),%eax
ret

LLVM IR (-O0):
define i64 @bgr24_sz(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 = mul i32 %5, %6
%8 = mul i32 %7, 3
%9 = zext i32 %8 to i64
ret i64 %9
}

LLVM IR (-O2):
define i64 @bgr24_sz(i32 %0, i32 %1) {
%3 = mul i32 %0, 3
%4 = mul i32 %3, %1
%5 = zext i32 %4 to i64
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ printf(char *);
void error(const char *msg) {
  printf("9\n");
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"9\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @perror(i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [2 x i8] c"9\00"
define void @error(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @perror(i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void show() {
  int x = 0;
  char vet[12];
  printf("vet = '%s'\n", vet);
  printf("x = %d", x);
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"vet = '%s'\0A\00"
@.str.1 = [7 x i8] c"x = %d\00"
define void @show() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  unsigned int i;
  i = 0;
  if (f)
    if (s)
      while (s[i]) {
        f(i, s + i);
        i++;
      }
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116e <ft_striteri+0x6e>
cmpq   $0x0,-0x8(%rbp)
je     1169 <ft_striteri+0x69>
jmp    1132 <ft_striteri+0x32>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     1164 <ft_striteri+0x64>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%ecx
add    %rcx,%rsi
call   *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1132 <ft_striteri+0x32>
jmp    1169 <ft_striteri+0x69>
jmp    116e <ft_striteri+0x6e>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @ft_striteri(i8* %0, void (i32, i8*)* %1) {
%3 = icmp ne void (i32, i8*)* %1, null
%4 = icmp ne i8* %0, null
%5 = and i1 %4, %3
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6, %9
%10 = phi i8* [ %14, %9 ], [ %0, %6 ]
%11 = phi i32 [ %12, %9 ], [ 0, %6 ]
tail call void %1(i32 %11, i8* %10)
%12 = add i32 %11, 1
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9, %6, %2
ret void
}
void etm_configure_gpio(void) {
  (*((volatile unsigned *)0x40048004u)) |= (1 << 13);
  (*((volatile unsigned *)0x40048004u)) |= 0x1000u;
  (((volatile unsigned *)0x4004D000u)[0]) = ((1 << 6) | (5 << 8));
  (((volatile unsigned *)0x4004D000u)[1]) = ((1 << 6) | (5 << 8));
  (((volatile unsigned *)0x4004D000u)[2]) = ((1 << 6) | (5 << 8));
  (((volatile unsigned *)0x4004D000u)[3]) = ((1 << 6) | (5 << 8));
  (((volatile unsigned *)0x4004D000u)[4]) = ((1 << 6) | (5 << 8));
}


x86 assembly (clang, -O0):
<etm_configure_gpio>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40048004,%eax
mov    (%rax),%ecx
or     $0x2000,%ecx
mov    $0x40048004,%eax
mov    %ecx,(%rax)
mov    $0x40048004,%eax
mov    (%rax),%ecx
or     $0x1000,%ecx
mov    $0x40048004,%eax
mov    %ecx,(%rax)
mov    $0x4004d000,%eax
movl   $0x540,(%rax)
mov    $0x4004d000,%eax
movl   $0x540,0x4(%rax)
mov    $0x4004d000,%eax
movl   $0x540,0x8(%rax)
mov    $0x4004d000,%eax
movl   $0x540,0xc(%rax)
mov    $0x4004d000,%eax
movl   $0x540,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<etm_configure_gpio>:
orl    $0x2000,0x40048004
orl    $0x1000,0x40048004
movl   $0x540,0x4004d000
movl   $0x540,0x4004d004
movl   $0x540,0x4004d008
movl   $0x540,0x4004d00c
movl   $0x540,0x4004d010
ret

LLVM IR (-O0):
define void @etm_configure_gpio() {
%1 = load volatile i32, i32* inttoptr (i64 1074036740 to i32*)
%2 = or i32 %1, 8192
store volatile i32 %2, i32* inttoptr (i64 1074036740 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 1074036740 to i32*)
%4 = or i32 %3, 4096
store volatile i32 %4, i32* inttoptr (i64 1074036740 to i32*)
store volatile i32 1344, i32* inttoptr (i64 1074057216 to i32*)
store volatile i32 1344, i32* getelementptr inbounds (i32, i32* inttoptr (i64 1074057216 to i32*), i64 1)
store volatile i32 1344, i32* getelementptr inbounds (i32, i32* inttoptr (i64 1074057216 to i32*), i64 2)
store volatile i32 1344, i32* getelementptr inbounds (i32, i32* inttoptr (i64 1074057216 to i32*), i64 3)
store volatile i32 1344, i32* getelementptr inbounds (i32, i32* inttoptr (i64 1074057216 to i32*), i64 4)
ret void
}

LLVM IR (-O2):
define void @etm_configure_gpio() {
%1 = load volatile i32, i32* inttoptr (i64 1074036740 to i32*)
%2 = or i32 %1, 8192
store volatile i32 %2, i32* inttoptr (i64 1074036740 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 1074036740 to i32*)
%4 = or i32 %3, 4096
store volatile i32 %4, i32* inttoptr (i64 1074036740 to i32*)
store volatile i32 1344, i32* inttoptr (i64 1074057216 to i32*)
store volatile i32 1344, i32* inttoptr (i64 1074057220 to i32*)
store volatile i32 1344, i32* inttoptr (i64 1074057224 to i32*)
store volatile i32 1344, i32* inttoptr (i64 1074057228 to i32*)
store volatile i32 1344, i32* inttoptr (i64 1074057232 to i32*)
ret void
}
/* Type definitions */
struct mg_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mg_printf(struct mg_connection *, char *, char const *);
void upload_handler(struct mg_connection *conn, const char *path) {
  mg_printf(conn, "Saved [%s]", path);
}


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

x86 assembly (clang, -O2):
<upload_handler>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <mg_printf@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
@.str = [11 x i8] c"Saved [%s]\00"
define void @upload_handler(%struct.mg_connection* %0, i8* %1) {
%3 = alloca %struct.mg_connection*
%4 = alloca i8*
store %struct.mg_connection* %0, %struct.mg_connection** %3
store i8* %1, i8** %4
%5 = load %struct.mg_connection*, %struct.mg_connection** %3
%6 = load i8*, i8** %4
%7 = call i32 @mg_printf(%struct.mg_connection* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
@.str = [11 x i8] c"Saved [%s]\00"
define void @upload_handler(%struct.mg_connection* %0, i8* %1) {
%3 = tail call i32 @mg_printf(%struct.mg_connection* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
int simplified_simulated_while_with_and_constant(int p) {
  int k = 0;
  int j = 0;
B:
  j++;
  if (k == 0 && j < 100) {
    goto B;
  }
  return k;
}


x86 assembly (clang, -O0):
<simplified_simulated_while_with_and_constant>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1137 <simplified_simulated_while_with_and_constant+0x37>
cmpl   $0x64,-0xc(%rbp)
jge    1137 <simplified_simulated_while_with_and_constant+0x37>
jmp    1115 <simplified_simulated_while_with_and_constant+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @simplified_simulated_while_with_and_constant(i32 %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ A;

/* Variables and functions */
int BinarySearch(int *, int, int const);
int /*<<< orphan*/ printf(char *, int, int);
main() {
  static int A[] = {1, 3, 5, 7, 9, 13, 15};
  const int SizeofA = sizeof(A) / sizeof(A[0]);
  int i;
  for (i = 0; i < 20; i++)
    printf("BinarySearch of %d returns %d\n", i, BinarySearch(A, i, SizeofA));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    1180 <main+0x60>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0x2ee9(%rip),%rdi
mov    $0x7,%edx
call   1040 <BinarySearch@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0x2f12(%rip),%r14
lea    0xecb(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x7,%edx
call   1040 <BinarySearch@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x14,%ebx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@main.A = internal global [7 x i32] [i32 1, i32 3, i32 5, i32 7, i32 9, i32 13, i32 15]
@.str = [31 x i8] c"BinarySearch of %d returns %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 7, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 20
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @BinarySearch(i32* getelementptr inbounds ([7 x i32], [7 x i32]* @main.A, i64 0, i64 0), i32 %9, i32 7)
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@main.A = internal global [7 x i32] [i32 1, i32 3, i32 5, i32 7, i32 9, i32 13, i32 15]
@.str = [31 x i8] c"BinarySearch of %d returns %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 @BinarySearch(i32* getelementptr inbounds ([7 x i32], [7 x i32]* @main.A, i64 0, i64 0), i32 %2, i32 7)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 20
br i1 %6, label %7, label %1
7: ; preds = %1
ret i32 0
}
float orient2d(float ax, float ay, float bx, float by, float cx, float cy) {
  float detleft = (ax - cx) * (by - cy);
  float detright = (ay - cy) * (bx - cx);
  return detleft - detright;
}


x86 assembly (clang, -O0):
<orient2d>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
subss  -0x18(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<orient2d>:
unpcklps %xmm1,%xmm3
shufps $0x0,%xmm5,%xmm5
subps  %xmm5,%xmm3
unpcklps %xmm2,%xmm0
shufps $0x0,%xmm4,%xmm4
subps  %xmm4,%xmm0
mulps  %xmm3,%xmm0
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @orient2d(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%15 = load float, float* %7
%16 = load float, float* %11
%17 = fsub float %15, %16
%18 = load float, float* %10
%19 = load float, float* %12
%20 = fsub float %18, %19
%21 = fmul float %17, %20
store float %21, float* %13
%22 = load float, float* %8
%23 = load float, float* %12
%24 = fsub float %22, %23
%25 = load float, float* %9
%26 = load float, float* %11
%27 = fsub float %25, %26
%28 = fmul float %24, %27
store float %28, float* %14
%29 = load float, float* %13
%30 = load float, float* %14
%31 = fsub float %29, %30
ret float %31
}

LLVM IR (-O2):
define float @orient2d(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = insertelement <2 x float> poison, float %3, i64 0
%8 = insertelement <2 x float> %7, float %1, i64 1
%9 = insertelement <2 x float> poison, float %5, i64 0
%10 = shufflevector <2 x float> %9, <2 x float> poison, <2 x i32> zeroinitializer
%11 = fsub <2 x float> %8, %10
%12 = insertelement <2 x float> poison, float %0, i64 0
%13 = insertelement <2 x float> %12, float %2, i64 1
%14 = insertelement <2 x float> poison, float %4, i64 0
%15 = shufflevector <2 x float> %14, <2 x float> poison, <2 x i32> zeroinitializer
%16 = fsub <2 x float> %13, %15
%17 = fmul <2 x float> %16, %11
%18 = shufflevector <2 x float> %17, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%19 = fsub <2 x float> %17, %18
%20 = extractelement <2 x float> %19, i64 0
ret float %20
}
/* Variables and functions */
char **splitStringByDelimiter(char const *, char const *, int *);
char **arrayDeserialization(const char *sarray, const char *delim, int *items) {
  return splitStringByDelimiter(sarray, delim, items);
}


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

x86 assembly (clang, -O2):
<arrayDeserialization>:
jmp    1030 <splitStringByDelimiter@plt>

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

LLVM IR (-O2):
define i8** @arrayDeserialization(i8* %0, i8* %1, i32* %2) {
%4 = tail call i8** @splitStringByDelimiter(i8* %0, i8* %1, i32* %2)
ret i8** %4
}
int f(int *ap) {
  int n;
  n = (ap += 1);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32* %6, i32** %3
%7 = ptrtoint i32* %6 to i32
store i32 %7, i32* %4
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @f(i32* nocapture readnone %0) {
ret i32 undef
}
int test_imm_A2uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xA2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A2uint64_highword_mem>:
testb  $0xa2,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A2uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 695784701952
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ atanf(float);
int /*<<< orphan*/ link_failure_atanf();
void test_atanf(float f) {
  if (atanf(f) != atanf(f))
    link_failure_atanf();
}


x86 assembly (clang, -O0):
<test_atanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <atanf@plt>
mov    %rax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <atanf@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     115c <test_atanf+0x3c>
mov    $0x0,%al
call   1040 <link_failure_atanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_atanf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
call   1030 <atanf@plt>
mov    %rax,%rbx
movss  0xc(%rsp),%xmm0
call   1030 <atanf@plt>
cmp    %rax,%rbx
jne    1149 <test_atanf+0x29>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <link_failure_atanf@plt>

LLVM IR (-O0):
define void @test_atanf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @atanf(float %3)
%5 = load float, float* %2
%6 = call i64 @atanf(float %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_atanf()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_atanf(float %0) {
%2 = tail call i64 @atanf(float %0)
%3 = tail call i64 @atanf(float %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_atanf()
br label %7
7: ; preds = %5, %1
ret void
}
OP(ed, d8) { illegal_2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Variables and functions */
void *memcpy(void *, void const *, size_t);
void *(mps_lib_memcpy)(void *s1, const void *s2, size_t n) {
  return memcpy(s1, s2, n);
}


x86 assembly (clang, -O0):
<mps_lib_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    %rdi,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mps_lib_memcpy>:
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define i8* @mps_lib_memcpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
ret i8* %7
}

LLVM IR (-O2):
define i8* @mps_lib_memcpy(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %2, i1 false)
ret i8* %0
}
double my_max(double a, double b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<my_max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <my_max+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <my_max+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_max>:
maxsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @my_max(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
size_t strlen(char const *);
size_t file_mbswidth(const char *s) { return strlen(s); }


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

x86 assembly (clang, -O2):
<file_mbswidth>:
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i64 @file_mbswidth(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @file_mbswidth(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
ret i64 %2
}
/* Variables and functions */
int exp(double);
double diode(double x1, double x2, double x3, double *y) {
  *y = x3 * (exp(x1 * x2) - 1);
}


x86 assembly (clang, -O0):
<diode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x30(%rbp),%xmm0
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diode>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @diode(double %0, double %1, double %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
%10 = load double, double* %8
%11 = load double, double* %6
%12 = load double, double* %7
%13 = fmul double %11, %12
%14 = call i32 @exp(double %13)
%15 = sub nsw i32 %14, 1
%16 = sitofp i32 %15 to double
%17 = fmul double %10, %16
%18 = load double*, double** %9
store double %17, double* %18
%19 = load double, double* %5
ret double %19
}

LLVM IR (-O2):
define double @diode(double %0, double %1, double %2, double* nocapture writeonly %3) {
%5 = fmul double %0, %1
%6 = tail call i32 @exp(double %5)
%7 = add nsw i32 %6, -1
%8 = sitofp i32 %7 to double
%9 = fmul double %8, %2
store double %9, double* %3
ret double undef
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int __posix_fadvise64_l64(int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int posix_fadvise(int fd, off_t offset, off_t len, int advise) {
  return __posix_fadvise64_l64(fd, offset, len, advise);
}


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

x86 assembly (clang, -O2):
<posix_fadvise>:
jmp    1030 <__posix_fadvise64_l64@plt>

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

LLVM IR (-O2):
define i32 @posix_fadvise(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @__posix_fadvise64_l64(i32 %0, i32 %1, i32 %2, i32 %3)
ret i32 %5
}
int test_imm_77int16_mem(short *val) {
  return ((*val) & (0x77 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_77int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0x77,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_77int16_mem>:
testb  $0x77,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_77int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 119
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}