xunge/DecIR huggingface dataset:
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int c;
  int n = 0;
  while ((c = getchar()) != EOF && c != '\n') {
    n = n + 1;
  }
  printf("Numero de caracteres : %d\n", n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
mov    0x2e9d(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xd(%rbp)
je     1160 <main+0x40>
cmpl   $0xa,-0x8(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1170 <main+0x50>
jmp    117e <main+0x5e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
mov    0x2eb8(%rip),%r14
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    $0xa,%eax
je     1144 <main+0x24>
cmp    (%r14),%eax
jne    1130 <main+0x10>
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [27 x i8] c"Numero de caracteres : %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %8, %1 ]
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
%8 = add nuw nsw i32 %2, 1
br i1 %7, label %1, label %9
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
int f(int x) { return x + 3; }


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

x86 assembly (clang, -O2):
<f>:
lea    0x3(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = add nsw i32 %0, 3
ret i32 %2
}
void f() {
#pragma acc parallel loop tile(2, 3)
  for (int i = 0; i < 8; i++)
    for (long j = 0; j < 8; j++)
      ;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    1151 <f+0x51>
movq   $0x0,-0x10(%rbp)
cmpq   $0x8,-0x10(%rbp)
jge    113e <f+0x3e>
jmp    112d <f+0x2d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111d <f+0x1d>
jmp    1143 <f+0x43>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <f+0xb>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ clean_up(char *);
size_t fread(void *, int, size_t, int /*<<< orphan*/ *);
void r_read(FILE *fp, void *buf, size_t n) {
  if (fread(buf, 1, n, fp) != n) {
    clean_up("fread() failed, don't know why");
  }
}


x86 assembly (clang, -O0):
<r_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
cmp    -0x18(%rbp),%rax
je     1160 <r_read+0x40>
lea    0xea5(%rip),%rdi
call   1040 <clean_up@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_read>:
push   %rbx
mov    %rdx,%rbx
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
call   1030 <fread@plt>
cmp    %rbx,%rax
jne    113b <r_read+0x1b>
pop    %rbx
ret
lea    0xebe(%rip),%rdi
pop    %rbx
jmp    1040 <clean_up@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"fread() failed, don't know why\00"
define void @r_read(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32*, i32** %4
%10 = call i64 @fread(i8* %7, i32 1, i64 %8, i32* %9)
%11 = load i64, i64* %6
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @clean_up(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"fread() failed, don't know why\00"
define void @r_read(i32* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @fread(i8* %1, i32 1, i64 %2, i32* %0)
%5 = icmp eq i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @clean_up(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Type definitions */
struct clad_sb {
  int dummy;
};

/* Variables and functions */
int clad_sb_index_long(struct clad_sb *, int /*<<< orphan*/, long *,
                       int /*<<< orphan*/);
int clad_sb_to_long(struct clad_sb *me, long *result) {
  return clad_sb_index_long(me, 0, result, 0);
}


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

x86 assembly (clang, -O2):
<clad_sb_to_long>:
mov    %rsi,%rdx
xor    %esi,%esi
xor    %ecx,%ecx
jmp    1030 <clad_sb_index_long@plt>

LLVM IR (-O0):
%struct.clad_sb = type { i32 }
define i32 @clad_sb_to_long(%struct.clad_sb* %0, i64* %1) {
%3 = alloca %struct.clad_sb*
%4 = alloca i64*
store %struct.clad_sb* %0, %struct.clad_sb** %3
store i64* %1, i64** %4
%5 = load %struct.clad_sb*, %struct.clad_sb** %3
%6 = load i64*, i64** %4
%7 = call i32 @clad_sb_index_long(%struct.clad_sb* %5, i32 0, i64* %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.clad_sb = type { i32 }
define i32 @clad_sb_to_long(%struct.clad_sb* %0, i64* %1) {
%3 = tail call i32 @clad_sb_index_long(%struct.clad_sb* %0, i32 0, i64* %1, i32 0)
ret i32 %3
}
int isprime(int n) {
  int i;
  if (n < 2)
    return 0;
  for (i = 2; i < n; i++)
    if ((n % i) == 0)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isprime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    111d <isprime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1166 <isprime+0x66>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <isprime+0x5f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    114c <isprime+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1166 <isprime+0x66>
jmp    1151 <isprime+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <isprime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jge    110a <isprime+0xa>
mov    %ecx,%eax
ret
jne    1112 <isprime+0x12>
mov    $0x1,%eax
ret
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <isprime+0x7>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <isprime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @isprime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 2
br i1 %4, label %12, label %7
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}
int rangeBitwiseAnd(int m, int n) {
  register int s = n ^ m;
  s |= s >> 1;
  s |= s >> 2;
  s |= s >> 4;
  s |= s >> 8;
  s |= s >> 16;
  return m & ~s;
}


x86 assembly (clang, -O0):
<rangeBitwiseAnd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x2,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x4,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rangeBitwiseAnd>:
xor    %edi,%esi
mov    %esi,%eax
sar    %eax
or     %esi,%eax
mov    %eax,%ecx
sar    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x10,%eax
or     %ecx,%eax
not    %eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @rangeBitwiseAnd(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = ashr i32 %3, 1
%5 = or i32 %4, %3
%6 = ashr i32 %5, 2
%7 = or i32 %6, %5
%8 = ashr i32 %7, 4
%9 = or i32 %8, %7
%10 = ashr i32 %9, 8
%11 = or i32 %10, %9
%12 = ashr i32 %11, 16
%13 = or i32 %12, %11
%14 = xor i32 %13, -1
%15 = and i32 %14, %0
ret i32 %15
}
/* Variables and functions */
int round(int x) { return ((int)(x + 0.5)); }


x86 assembly (clang, -O0):
<round>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round>:
cvtsi2sd %edi,%xmm0
addsd  0xef4(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @round(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fadd double %4, 5.000000e-01
%6 = fptosi double %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @round(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fadd double %2, 5.000000e-01
%4 = fptosi double %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ preliminary_checks(int, char **);
int /*<<< orphan*/ spawn_server(char **);
int main(int argc, char **argv) {
  preliminary_checks(argc, argv);
  spawn_server(argv);
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <preliminary_checks@plt>
mov    -0x10(%rbp),%rdi
call   1040 <spawn_server@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
call   1030 <preliminary_checks@plt>
mov    %rbx,%rdi
call   1040 <spawn_server@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @preliminary_checks(i32 %6, i8** %7)
%9 = load i8**, i8*** %5
%10 = call i32 @spawn_server(i8** %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @preliminary_checks(i32 %0, i8** %1)
%4 = tail call i32 @spawn_server(i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func(void) { printf("Hello world\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello world\00"
define void @func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct A TYPE_1__;

/* Type definitions */
struct A {
  int i;
  int j;
};

/* Variables and functions */
int /*<<< orphan*/ f(TYPE_1__ *);
test1() {
  struct A {
    int i, j;
  } a;
  f(&a);
}


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

x86 assembly (clang, -O2):
<test1>:
push   %rax
mov    %rsp,%rdi
call   1030 <f@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.A = type { i32, i32 }
%struct.A.0 = type { i32, i32 }
define i32 @test1() {
%1 = alloca i32
%2 = alloca %struct.A
%3 = bitcast %struct.A* %2 to %struct.A.0*
%4 = call i32 @f(%struct.A.0* %3)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
%struct.A = type { i32, i32 }
%struct.A.0 = type { i32, i32 }
define i32 @test1() {
%1 = alloca %struct.A
%2 = bitcast %struct.A* %1 to i8*
%3 = bitcast %struct.A* %1 to %struct.A.0*
%4 = call i32 @f(%struct.A.0* %3)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ hej();
int /*<<< orphan*/ printf(char *);
int main() {
  hej();
  printf("UUUUUUUUUU\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <hej@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [11 x i8] c"UUUUUUUUUU\00"
define i32 @main() {
%1 = tail call i32 (...) @hej()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
__attribute__((always_)) __attribute__((pure)) size_t
lwan_nextpow2(size_t number) {
  number--;
  number |= number >> 1;
  number |= number >> 2;
  number |= number >> 4;
  number |= number >> 8;
  number |= number >> 16;
  number |= number >> 32;
  return number + 1;
}


x86 assembly (clang, -O0):
<lwan_nextpow2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x4,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lwan_nextpow2>:
lea    -0x1(%rdi),%rax
mov    %rax,%rcx
shr    %rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x2,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x8,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x10,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x20,%rax
or     %rcx,%rax
add    $0x1,%rax
ret

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

LLVM IR (-O2):
define i64 @lwan_nextpow2(i64 %0) {
%2 = add i64 %0, -1
%3 = lshr i64 %2, 1
%4 = or i64 %3, %2
%5 = lshr i64 %4, 2
%6 = or i64 %5, %4
%7 = lshr i64 %6, 4
%8 = or i64 %7, %6
%9 = lshr i64 %8, 8
%10 = or i64 %9, %8
%11 = lshr i64 %10, 16
%12 = or i64 %11, %10
%13 = lshr i64 %12, 32
%14 = or i64 %13, %12
%15 = add i64 %14, 1
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
float subtracao(float x, float y) {
  float sub = 0;
  sub = x - y;
  printf("%2.f\n", sub);
  return sub;
}


x86 assembly (clang, -O0):
<subtracao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subtracao>:
push   %rax
subss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%2.f\0A\00"
define float @subtracao(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
store float 0.000000e+00, float* %5
%6 = load float, float* %3
%7 = load float, float* %4
%8 = fsub float %6, %7
store float %8, float* %5
%9 = load float, float* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %9)
%11 = load float, float* %5
ret float %11
}

LLVM IR (-O2):
@.str = [6 x i8] c"%2.f\0A\00"
define float @subtracao(float %0, float %1) {
%3 = fsub float %0, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %3)
ret float %3
}
int checknum(char p) {
  if ((p >= '0') && (p <= '9'))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<checknum>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1130 <checknum+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1130 <checknum+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <checknum+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checknum>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @checknum(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7, %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @checknum(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int main() {
  char a[3], *b;
  a[0] = 65;
  a[1] = 10;
  a[2] = 0;
  b = "hello";
  printf("%s %s", b, a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x41,-0x7(%rbp)
movb   $0xa,-0x6(%rbp)
movb   $0x0,-0x5(%rbp)
lea    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x7(%rbp),%rdx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0xa41,0x5(%rsp)
movb   $0x0,0x7(%rsp)
lea    0xee2(%rip),%rdi
lea    0xed5(%rip),%rsi
lea    0x5(%rsp),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"%s %s\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
store i8 65, i8* %2
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 1
store i8 10, i8* %3
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 2
store i8 0, i8* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int factorial(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int n;
  printf("Enter an integer: ");
  scanf("%d", &n);
  printf("%d! = %d\n", n, factorial(n));
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1030 <factorial@plt>
lea    0xeb0(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"%d! = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @factorial(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int ConvertCharToInt(char const);
int CharIsDigit(const char input) {
  int input2 = ConvertCharToInt(input);
  return (input2 < 0 || input2 > 9 ? 0 : 1);
}


x86 assembly (clang, -O0):
<CharIsDigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <ConvertCharToInt@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1143 <CharIsDigit+0x33>
cmpl   $0x9,-0x8(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%dl
mov    $0x1,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CharIsDigit>:
push   %rax
call   1030 <ConvertCharToInt@plt>
xor    %ecx,%ecx
cmp    $0xa,%eax
setb   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @CharIsDigit(i8 signext %0) {
%2 = tail call i32 @ConvertCharToInt(i8 signext %0)
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun() { printf("sldfj[\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"sldfj[\00"
define void @fun() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
signed int signedint_id(signed int x) { return x; }


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

x86 assembly (clang, -O2):
<signedint_id>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @signedint_id(i32 returned %0) {
ret i32 %0
}
int main() {
  int arg1 = 0xA0000000;
  int arg2 = 2;
  int mulLo = 0;
  int mulHi = 0;
  __asm__("mull %%ebx;" : "=a"(mulLo), "=d"(mulHi) : "a"(arg1), "b"(arg2));
  return (mulLo == 0x40000000) && (mulHi == 0x1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
movl   $0x0,-0xc(%rbp)
movl   $0xa0000000,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ebx
mul    %ebx
mov    %eax,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0x40000000,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
jne    1152 <main+0x52>
cmpl   $0x1,-0x1c(%rbp)
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa0000000,%eax
mov    $0x2,%ebx
mul    %ebx
xor    $0x40000000,%eax
xor    $0x1,%edx
xor    %ecx,%ecx
or     %eax,%edx
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 -1610612736, i32* %2
store i32 2, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call { i32, i32 } asm "mull %ebx;", "={ax},={dx},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 %6, i32 %7)
%9 = extractvalue { i32, i32 } %8, 0
%10 = extractvalue { i32, i32 } %8, 1
store i32 %9, i32* %4
store i32 %10, i32* %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1073741824
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 1
br label %16
16: ; preds = %13, %0
%17 = phi i1 [ false, %0 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call { i32, i32 } asm "mull %ebx;", "={ax},={dx},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 -1610612736, i32 2)
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = icmp eq i32 %2, 1073741824
%5 = icmp eq i32 %3, 1
%6 = select i1 %4, i1 %5, i1 false
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int sqrt(float);
float boost(float plft) {
  return (1. / sqrt(plft * plft + (1. - plft) * (1. - plft)));
}


x86 assembly (clang, -O0):
<boost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xec4(%rip),%xmm0
subsd  %xmm2,%xmm0
movss  -0x4(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xeaf(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <sqrt@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe8e(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boost>:
push   %rax
cvtss2sd %xmm0,%xmm1
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xedb(%rip),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xeb4(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @boost(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fmul float %3, %4
%6 = fpext float %5 to double
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fsub double 1.000000e+00, %8
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = fsub double 1.000000e+00, %11
%13 = call double @llvm.fmuladd.f64(double %9, double %12, double %6)
%14 = fptrunc double %13 to float
%15 = call i32 @sqrt(float %14)
%16 = sitofp i32 %15 to double
%17 = fdiv double 1.000000e+00, %16
%18 = fptrunc double %17 to float
ret float %18
}

LLVM IR (-O2):
define float @boost(float %0) {
%2 = fmul float %0, %0
%3 = fpext float %2 to double
%4 = fpext float %0 to double
%5 = fsub double 1.000000e+00, %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %3)
%7 = fptrunc double %6 to float
%8 = tail call i32 @sqrt(float %7)
%9 = sitofp i32 %8 to double
%10 = fdiv double 1.000000e+00, %9
%11 = fptrunc double %10 to float
ret float %11
}
int SyncTelToLocation(double newlong, double newlat, double newalt) {
  return 0;
}


x86 assembly (clang, -O0):
<SyncTelToLocation>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SyncTelToLocation(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
ret i32 0
}

LLVM IR (-O2):
define i32 @SyncTelToLocation(double %0, double %1, double %2) {
ret i32 0
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1138 <gcd+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <gcd+0x42>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,%rsi
call   1030 <gcd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rdi,%rax
test   %rsi,%rsi
je     1135 <gcd+0x35>
mov    %rsi,%rdx
jmp    111d <gcd+0x1d>
nopl   (%rax)
cqto
idiv   %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <gcd+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <gcd+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <gcd+0x15>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @gcd(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %4
store i64 %9, i64* %3
br label %16
10: ; preds = %2
%11 = load i64, i64* %5
%12 = load i64, i64* %4
%13 = load i64, i64* %5
%14 = srem i64 %12, %13
%15 = call i64 @gcd(i64 %11, i64 %14)
store i64 %15, i64* %3
br label %16
16: ; preds = %10, %8
%17 = load i64, i64* %3
ret i64 %17
}

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i64 [ %5, %4 ], [ %0, %2 ]
%7 = srem i64 %6, %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i64 [ %0, %2 ], [ %5, %4 ]
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ baz();
scalar_t__ foo(int);
void bar(void) {
  int j;
  for (; foo(j); ++j)
    baz();
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
call   1040 <foo@plt>
cmp    $0x0,%rax
je     114f <bar+0x2f>
mov    $0x0,%al
call   1030 <baz@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1128 <bar+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbx
call   1040 <foo@plt>
test   %rax,%rax
je     1146 <bar+0x26>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <baz@plt>
mov    %ebx,%edi
call   1040 <foo@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1130 <bar+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @bar() {
%1 = tail call i64 @foo(i32 undef)
%2 = icmp eq i64 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ undef, %0 ]
%5 = tail call i32 (...) @baz()
%6 = add nsw i32 %4, 1
%7 = tail call i64 @foo(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %3
9: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ explicit_bzero(void *, size_t);
int /*<<< orphan*/ free(void *);
void freezero(void *ptr, size_t sz) {
  explicit_bzero(ptr, sz);
  free(ptr);
}


x86 assembly (clang, -O0):
<freezero>:
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   1040 <explicit_bzero@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @freezero(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @explicit_bzero(i8* %5, i64 %6)
%8 = load i8*, i8** %3
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
define void @freezero(i8* %0, i64 %1) {
%3 = tail call i32 @explicit_bzero(i8* %0, i64 %1)
%4 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
void should_fail() { f(0x7fffffffffffffffLL); }


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

x86 assembly (clang, -O2):
<should_fail>:
mov    $0xffffffff,%edi
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define void @should_fail() {
%1 = tail call i32 @f(i32 -1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_mat2();
int /*<<< orphan*/ test_mat3();
int /*<<< orphan*/ test_mat4();
int /*<<< orphan*/ test_vec2();
int /*<<< orphan*/ test_vec3();
int /*<<< orphan*/ test_vec4();
int main(int argc, char **argv) {
  (void)argc;
  (void)argv;
  test_vec2();
  test_vec3();
  test_vec4();
  test_mat2();
  test_mat3();
  test_mat4();
  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   1040 <test_vec2@plt>
mov    $0x0,%al
call   1070 <test_vec3@plt>
mov    $0x0,%al
call   1050 <test_vec4@plt>
mov    $0x0,%al
call   1060 <test_mat2@plt>
mov    $0x0,%al
call   1030 <test_mat3@plt>
mov    $0x0,%al
call   1080 <test_mat4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_vec2@plt>
xor    %eax,%eax
call   1070 <test_vec3@plt>
xor    %eax,%eax
call   1050 <test_vec4@plt>
xor    %eax,%eax
call   1060 <test_mat2@plt>
xor    %eax,%eax
call   1030 <test_mat3@plt>
xor    %eax,%eax
call   1080 <test_mat4@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 (...) @test_vec2()
%9 = call i32 (...) @test_vec3()
%10 = call i32 (...) @test_vec4()
%11 = call i32 (...) @test_mat2()
%12 = call i32 (...) @test_mat3()
%13 = call i32 (...) @test_mat4()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_vec2()
%4 = tail call i32 (...) @test_vec3()
%5 = tail call i32 (...) @test_vec4()
%6 = tail call i32 (...) @test_mat2()
%7 = tail call i32 (...) @test_mat3()
%8 = tail call i32 (...) @test_mat4()
ret i32 0
}
/* Type definitions */
struct ell_buffer {
  int dummy;
};

/* Variables and functions */
int ell_buffer_append(struct ell_buffer *, char *, int);
bool ell_buffer_append_c(struct ell_buffer *self, char c) {
  return ell_buffer_append(self, &c, 1);
}


x86 assembly (clang, -O0):
<ell_buffer_append_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <ell_buffer_append@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ell_buffer_append_c>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <ell_buffer_append@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.ell_buffer = type { i32 }
define i32 @ell_buffer_append_c(%struct.ell_buffer* %0, i8 signext %1) {
%3 = alloca %struct.ell_buffer*
%4 = alloca i8
store %struct.ell_buffer* %0, %struct.ell_buffer** %3
store i8 %1, i8* %4
%5 = load %struct.ell_buffer*, %struct.ell_buffer** %3
%6 = call i32 @ell_buffer_append(%struct.ell_buffer* %5, i8* %4, i32 1)
ret i32 %6
}

LLVM IR (-O2):
%struct.ell_buffer = type { i32 }
define i32 @ell_buffer_append_c(%struct.ell_buffer* %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @ell_buffer_append(%struct.ell_buffer* %0, i8* %3, i32 1)
ret i32 %4
}
int test_imm_85uint8_mem(unsigned char *val) {
  return ((*val) & (-0x85 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_85uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -133
%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_85uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 123
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int main(int argc, char *argv[]) {
  int ret;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ xerr(int, char *);
void oerr(void) { xerr(1, "stdout"); }


x86 assembly (clang, -O0):
<oerr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
call   1030 <xerr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<oerr>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <xerr@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"stdout\00"
define void @oerr() {
%1 = tail call i32 @xerr(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
char *event_api_name(void) { return "select"; }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"select\00"
define i8* @event_api_name() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
void do_fxsave(void *buffer) {
  asm volatile("rex64/fxsave"
               " (%0)"
               :
               : "r"(buffer)
               : "memory");
}


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

x86 assembly (clang, -O2):
<do_fxsave>:
fxsave64 (%rdi)
ret

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

LLVM IR (-O2):
define void @do_fxsave(i8* %0) {
tail call void asm sideeffect "rex64/fxsave ($0)", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Type definitions */
struct value_nd {
  int dummy;
};
struct instr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assembler_err(struct instr *, char *);
int dontexpect(struct instr *instr, struct value_nd *nd) {
  if (nd) {
    assembler_err(instr, "too many operands");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<dontexpect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1147 <dontexpect+0x37>
mov    -0x10(%rbp),%rdi
lea    0xeca(%rip),%rsi
call   1030 <assembler_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <dontexpect+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dontexpect>:
test   %rsi,%rsi
je     112c <dontexpect+0x1c>
push   %rax
lea    0xee3(%rip),%rsi
call   1030 <assembler_err@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.instr = type { i32 }
%struct.value_nd = type { i32 }
@.str = [18 x i8] c"too many operands\00"
define i32 @dontexpect(%struct.instr* %0, %struct.value_nd* %1) {
%3 = alloca i32
%4 = alloca %struct.instr*
%5 = alloca %struct.value_nd*
store %struct.instr* %0, %struct.instr** %4
store %struct.value_nd* %1, %struct.value_nd** %5
%6 = load %struct.value_nd*, %struct.value_nd** %5
%7 = icmp ne %struct.value_nd* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load %struct.instr*, %struct.instr** %4
%10 = call i32 @assembler_err(%struct.instr* %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %12
11: ; preds = %2
store i32 0, i32* %3
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
%struct.instr = type { i32 }
%struct.value_nd = type { i32 }
@.str = [18 x i8] c"too many operands\00"
define i32 @dontexpect(%struct.instr* %0, %struct.value_nd* readnone %1) {
%3 = icmp eq %struct.value_nd* %1, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @assembler_err(%struct.instr* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ -1, %4 ], [ 0, %2 ]
ret i32 %7
}