xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ltrim(char *);
char *rtrim(int /*<<< orphan*/);
char *trim(char *str) { return rtrim(ltrim(str)); }


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ltrim@plt>
mov    %eax,%edi
call   1030 <rtrim@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rax
call   1040 <ltrim@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <rtrim@plt>

LLVM IR (-O0):
define i8* @trim(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @ltrim(i8* %3)
%5 = call i8* @rtrim(i32 %4)
ret i8* %5
}

LLVM IR (-O2):
define i8* @trim(i8* %0) {
%2 = tail call i32 @ltrim(i8* %0)
%3 = tail call i8* @rtrim(i32 %2)
ret i8* %3
}
/* Variables and functions */
double song_play(double, int /*<<< orphan*/);
double modipulategml_song_stop(double songid) { return song_play(songid, 0); }


x86 assembly (clang, -O0):
<modipulategml_song_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %edi,%edi
call   1030 <song_play@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modipulategml_song_stop>:
xor    %edi,%edi
jmp    1030 <song_play@plt>

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

LLVM IR (-O2):
define double @modipulategml_song_stop(double %0) {
%2 = tail call double @song_play(double %0, i32 0)
ret double %2
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint64_t integerify(uint32_t *B, const uint32_t r) {
  return B[(2 * r - 1) * 16] | (uint64_t)B[(2 * r - 1) * 16 + 1] << 32;
}


x86 assembly (clang, -O0):
<integerify>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
shl    $0x1,%edx
sub    $0x1,%edx
shl    $0x4,%edx
add    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @integerify(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 nsw i32 2, %6
%8 = sub nsw i32 %7, 1
%9 = mul nsw i32 %8, 16
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %5, i64 %10
%12 = load i32, i32* %11
%13 = load i32*, i32** %3
%14 = load i32, i32* %4
%15 = mul nsw i32 2, %14
%16 = sub nsw i32 %15, 1
%17 = mul nsw i32 %16, 16
%18 = add nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %13, i64 %19
%21 = load i32, i32* %20
%22 = shl i32 %21, 32
%23 = or i32 %12, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @integerify(i32* nocapture readnone %0, i32 %1) {
ret i32 poison
}
/* Variables and functions */
bool nrf53_errata_5(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf53_errata_5() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf53_errata_5() {
ret i32 0
}
int main() {
  int x, y, z;
  x = 12;
  y = x + 22;
  z = y + 32;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0xc,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x16,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 12, i32* %1
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 22
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 32
store i32 %7, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int test_imm_74uint16_reg(unsigned short val) {
  return ((val) & (0x74 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_74uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x74,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_74uint16_reg>:
test   $0x74,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_74uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 116
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ foo();
int main(void) {
  foo();
  bar();
  bar();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
%3 = call i32 (...) @bar()
%4 = call i32 (...) @bar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @bar()
%3 = tail call i32 (...) @bar()
ret i32 0
}
char *fail() {
  return "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/"
         "test_nl.c"
         ":"
         "14"
         ": "
         "failure";
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_nl.c:14: failure\00"
define i8* @fail() {
ret i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_nl.c:14: failure\00"
define i8* @fail() {
ret i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int g();
int f(int y) { return y + g(); }


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

x86 assembly (clang, -O2):
<f>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <g@plt>
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = tail call i32 (...) @g()
%3 = add nsw i32 %2, %0
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned int state;
};
struct TYPE_4__ {
  TYPE_1__ xcrossing;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xcrossing_state(void *_p, unsigned _v) {
  ((XEvent *)_p)->xcrossing.state = (unsigned)_v;
}


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

x86 assembly (clang, -O2):
<set_XEvent_xcrossing_state>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xcrossing_state(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xcrossing_state(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
int tri_num(int n) {
  int i, sum = 0;
  for (i = 1; i <= n; i++)
    sum += i;
  return sum;
}


x86 assembly (clang, -O0):
<tri_num>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1138 <tri_num+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <tri_num+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tri_num>:
test   %edi,%edi
jle    1118 <tri_num+0x18>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @tri_num(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
ret i32 %15
}
void shift(int A[], int n) {
  int temp = A[0];
  for (int i = 1; i < n; i++) {
    A[i - 1] = A[i];
  }
  A[n - 1] = temp;
}


x86 assembly (clang, -O0):
<shift>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1150 <shift+0x50>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111b <shift+0x1b>
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
mov    (%rdi),%ebp
cmp    $0x1,%esi
jle    1139 <shift+0x29>
lea    0x4(%r14),%rsi
add    $0xffffffff,%ebx
lea    0x0(,%rbx,4),%rdx
mov    %r14,%rdi
call   1030 <memmove@plt>
jmp    113c <shift+0x2c>
add    $0xffffffff,%ebx
movslq %ebx,%rax
mov    %ebp,(%r14,%rax,4)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @shift(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = icmp sgt i32 %1, 1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = add nsw i32 %1, -1
br label %14
7: ; preds = %2
%8 = bitcast i32* %0 to i8*
%9 = getelementptr i32, i32* %0, i64 1
%10 = bitcast i32* %9 to i8*
%11 = add nsw i32 %1, -1
%12 = zext i32 %11 to i64
%13 = shl nuw nsw i64 %12, 2
br label %14
14: ; preds = %5, %7
%15 = phi i32 [ %6, %5 ], [ %11, %7 ]
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %0, i64 %16
store i32 %3, i32* %17
ret void
}
/* Variables and functions */
int partition(int *, int, int);
void quickSort(int arr[], int l, int h) {
  if (l < h) {
    int p = partition(arr, l, h);
    quickSort(arr, l, p - 1);
    quickSort(arr, p + 1, h);
  }
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quickSort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quickSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quickSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quickSort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quickSort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quickSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quickSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quickSort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
unsigned char run_with_timeout(double timeout, void (*fun)(void *), void *arg) {
  fun(arg);
  return 0;
}


x86 assembly (clang, -O0):
<run_with_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
call   *%rax
xor    %eax,%eax
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_with_timeout>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
call   *%rax
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define zeroext i8 @run_with_timeout(double %0, void (i8*)* nocapture %1, i8* %2) {
tail call void %1(i8* %2)
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char m, a, d;
  scanf("%c", &m);
  d = m - 'a';
  a = 'z' - d;
  printf("%c\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
mov    %al,-0x7(%rbp)
movsbl -0x7(%rbp),%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
mov    %al,-0x6(%rbp)
lea    0xea5(%rip),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xdb,%al
sub    0x7(%rsp),%al
movsbl %al,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = sub nsw i32 %7, 97
%9 = trunc i32 %8 to i8
store i8 %9, i8* %4
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = sub nsw i32 122, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %3
%14 = load i8, i8* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = sub i8 -37, %3
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
ret i32 0
}
unsigned char get_h1(unsigned char *byte) { return (((*byte) & 0xf0) >> 4); }


x86 assembly (clang, -O0):
<get_h1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
and    $0xf0,%eax
sar    $0x4,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_h1>:
mov    (%rdi),%al
shr    $0x4,%al
ret

LLVM IR (-O0):
define zeroext i8 @get_h1(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, 240
%7 = ashr i32 %6, 4
%8 = trunc i32 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @get_h1(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = lshr i8 %2, 4
ret i8 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int errno;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int close_file(FILE *fp) {
  if (fclose(fp) < 0) {
    fprintf(stderr, "Can't close file\n");
    return -errno;
  }
  return 0;
}


x86 assembly (clang, -O0):
<close_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
cmp    $0x0,%rax
jge    1167 <close_file+0x47>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    0x2e7b(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <close_file+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_file>:
push   %rax
call   1030 <fclose@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     1132 <close_file+0x12>
pop    %rcx
ret
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e8a(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Can't close file\0A\00"
@errno = global i32 0
define i32 @close_file(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i64 @fclose(i32* %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @errno
%11 = sub nsw i32 0, %10
store i32 %11, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Can't close file\0A\00"
@errno = global i32 0
define i32 @close_file(i32* nocapture %0) {
%2 = tail call i64 @fclose(i32* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @errno
%8 = sub nsw i32 0, %7
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ 0, %1 ]
ret i32 %10
}
int length(char *t) {
  int taille = 0;
  do {
    taille++;
  } while (t[taille] != '\0');
  return taille;
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    110f <length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <length+0x10>
ret

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

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ 0, %1 ]
%4 = add nuw nsw i64 %3, 1
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %4 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ clear_screen();
int /*<<< orphan*/ irq_install();
int /*<<< orphan*/ isr_install();
int /*<<< orphan*/ kprint(char *);
void kernel_main() {
  clear_screen();
  kprint("Welcome to MOS\n");
  isr_install();
  kprint("Interruptions enabled.\n");
  irq_install();
  kprint("IRQs enabled.\n");
  kprint("\n\n> ");
}


x86 assembly (clang, -O0):
<kernel_main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <clear_screen@plt>
lea    0xeae(%rip),%rdi
call   1040 <kprint@plt>
mov    $0x0,%al
call   1050 <isr_install@plt>
lea    0xeab(%rip),%rdi
call   1040 <kprint@plt>
mov    $0x0,%al
call   1030 <irq_install@plt>
lea    0xeb0(%rip),%rdi
call   1040 <kprint@plt>
lea    0xeb3(%rip),%rdi
call   1040 <kprint@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_main>:
push   %rax
xor    %eax,%eax
call   1060 <clear_screen@plt>
lea    0xeb1(%rip),%rdi
call   1040 <kprint@plt>
xor    %eax,%eax
call   1050 <isr_install@plt>
lea    0xeae(%rip),%rdi
call   1040 <kprint@plt>
xor    %eax,%eax
call   1030 <irq_install@plt>
lea    0xeb3(%rip),%rdi
call   1040 <kprint@plt>
lea    0xeb6(%rip),%rdi
pop    %rax
jmp    1040 <kprint@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Welcome to MOS\0A\00"
@.str.1 = [24 x i8] c"Interruptions enabled.\0A\00"
@.str.2 = [15 x i8] c"IRQs enabled.\0A\00"
@.str.3 = [5 x i8] c"\0A\0A> \00"
define void @kernel_main() {
%1 = call i32 (...) @clear_screen()
%2 = call i32 @kprint(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @isr_install()
%4 = call i32 @kprint(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @irq_install()
%6 = call i32 @kprint(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @kprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Welcome to MOS\0A\00"
@.str.1 = [24 x i8] c"Interruptions enabled.\0A\00"
@.str.2 = [15 x i8] c"IRQs enabled.\0A\00"
@.str.3 = [5 x i8] c"\0A\0A> \00"
define void @kernel_main() {
%1 = tail call i32 (...) @clear_screen()
%2 = tail call i32 @kprint(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @isr_install()
%4 = tail call i32 @kprint(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (...) @irq_install()
%6 = tail call i32 @kprint(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @kprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}
int main(int argc, char **argv) {
  (void)argc;
  (void)argv;
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
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
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ PrintHelloWorldArchive();
int /*<<< orphan*/ PrintHelloWorldDynamic();
int /*<<< orphan*/ PrintHelloWorldSubDir();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  (void)argc;
  (void)argv;
  PrintHelloWorldDynamic();
  PrintHelloWorldArchive();
  PrintHelloWorldSubDir();
  fprintf(stderr, "HELLO WORLD!\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   1060 <PrintHelloWorldDynamic@plt>
mov    $0x0,%al
call   1030 <PrintHelloWorldArchive@plt>
mov    $0x0,%al
call   1040 <PrintHelloWorldSubDir@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <PrintHelloWorldDynamic@plt>
xor    %eax,%eax
call   1030 <PrintHelloWorldArchive@plt>
xor    %eax,%eax
call   1040 <PrintHelloWorldSubDir@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"HELLO WORLD!\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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 (...) @PrintHelloWorldDynamic()
%9 = call i32 (...) @PrintHelloWorldArchive()
%10 = call i32 (...) @PrintHelloWorldSubDir()
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"HELLO WORLD!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @PrintHelloWorldDynamic()
%4 = tail call i32 (...) @PrintHelloWorldArchive()
%5 = tail call i32 (...) @PrintHelloWorldSubDir()
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct stream {
  int dummy;
};

/* Variables and functions */
int decode_atom_format_6_1(unsigned char const *, struct stream *);
int decode_atom_format_6_3(const unsigned char *pkt, struct stream *stream) {
  return decode_atom_format_6_1(pkt, stream);
}


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

x86 assembly (clang, -O2):
<decode_atom_format_6_3>:
jmp    1030 <decode_atom_format_6_1@plt>

LLVM IR (-O0):
%struct.stream = type { i32 }
define i32 @decode_atom_format_6_3(i8* %0, %struct.stream* %1) {
%3 = alloca i8*
%4 = alloca %struct.stream*
store i8* %0, i8** %3
store %struct.stream* %1, %struct.stream** %4
%5 = load i8*, i8** %3
%6 = load %struct.stream*, %struct.stream** %4
%7 = call i32 @decode_atom_format_6_1(i8* %5, %struct.stream* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.stream = type { i32 }
define i32 @decode_atom_format_6_3(i8* %0, %struct.stream* %1) {
%3 = tail call i32 @decode_atom_format_6_1(i8* %0, %struct.stream* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int test_bit_16(uint16_t data, uint16_t pos) {}


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

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

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

LLVM IR (-O2):
define i32 @test_bit_16(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int submat(int, int, int);
int posmat(int nrowb, int row, int col) {
  return (submat(nrowb, row, col) + 1);
}


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

x86 assembly (clang, -O2):
<posmat>:
push   %rax
call   1030 <submat@plt>
add    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @posmat(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @submat(i32 %0, i32 %1, i32 %2)
%5 = add nsw i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
double _getdtime(int /*<<< orphan*/);
double getdtime(void) { return (_getdtime(CLOCK_MONOTONIC)); }


x86 assembly (clang, -O0):
<getdtime>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <_getdtime@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getdtime>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <_getdtime@plt>

LLVM IR (-O0):
@CLOCK_MONOTONIC = global i32 0
define double @getdtime() {
%1 = load i32, i32* @CLOCK_MONOTONIC
%2 = call double @_getdtime(i32 %1)
ret double %2
}

LLVM IR (-O2):
@CLOCK_MONOTONIC = global i32 0
define double @getdtime() {
%1 = load i32, i32* @CLOCK_MONOTONIC
%2 = tail call double @_getdtime(i32 %1)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, long long);
int main() {
  int i;
  long long power = 1;
  for (i = 2; i < 1000; i++) {
    power *= i;
    printf("%4d! is %16lld\n", i, power);
    if (power < 0)
      break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    117e <main+0x6e>
movslq -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
jge    116b <main+0x5b>
jmp    117e <main+0x6e>
jmp    1170 <main+0x60>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <main+0x1e>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%r14d
mov    $0x2,%ebx
lea    0xed9(%rip),%r15
nopw   0x0(%rax,%rax,1)
imul   %rbx,%r14
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"%4d! is %16lld\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 2, %0 ], [ %7, %1 ]
%3 = phi i64 [ 1, %0 ], [ %4, %1 ]
%4 = mul nuw nsw i64 %3, %2
%5 = trunc i64 %2 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5, i64 %4)
%7 = add nuw nsw i64 %2, 1
%8 = icmp eq i64 %7, 1000
br i1 %8, label %9, label %1
9: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double sqrt(float);
int main() {
  double sqroot2;
  sqroot2 = sqrt((float)3);
  printf("The square root of 3 is %f\n", sqroot2);
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movss  0xed7(%rip),%xmm0
call   1040 <sqrt@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"The square root of 3 is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call double @sqrt(float 3.000000e+00)
store double %3, double* %2
%4 = load double, double* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"The square root of 3 is %f\0A\00"
define i32 @main() {
%1 = tail call double @sqrt(float 3.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ glTexCoord4f(float, float, int /*<<< orphan*/, int);
void glTexCoord2f(float s, float t) { glTexCoord4f(s, t, 0, 1); }


x86 assembly (clang, -O0):
<glTexCoord2f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <glTexCoord4f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glTexCoord2f>:
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <glTexCoord4f@plt>

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

LLVM IR (-O2):
define void @glTexCoord2f(float %0, float %1) {
%3 = tail call i32 @glTexCoord4f(float %0, float %1, i32 0, i32 1)
ret void
}
int gdc_get_cmd_stat(int f, void *status) {
  unsigned int *syscall_bc = (unsigned int *)0x8c0000bc;
  int (*syscall)() = (int (*)())(*syscall_bc);
  return syscall((f), (status), 0, (1));
  ;
}


x86 assembly (clang, -O0):
<gdc_get_cmd_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x8c0000bc,%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%r8
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x0,%al
call   *%r8
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdc_get_cmd_stat>:
mov    $0x8c0000bc,%eax
mov    (%rax),%r8d
xor    %edx,%edx
mov    $0x1,%ecx
xor    %eax,%eax
jmp    *%r8

LLVM IR (-O0):
define i32 @gdc_get_cmd_stat(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32 (...)*
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32* inttoptr (i64 2348810428 to i32*), i32** %5
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32 (...)*
store i32 (...)* %10, i32 (...)** %6
%11 = load i32 (...)*, i32 (...)** %6
%12 = load i32, i32* %3
%13 = load i8*, i8** %4
%14 = bitcast i32 (...)* %11 to i32 (i32, i8*, i32, i32, ...)*
%15 = call i32 (i32, i8*, i32, i32, ...) %14(i32 %12, i8* %13, i32 0, i32 1)
ret i32 %15
}

LLVM IR (-O2):
define i32 @gdc_get_cmd_stat(i32 %0, i8* %1) {
%3 = load i32, i32* inttoptr (i64 2348810428 to i32*)
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32 (i32, i8*, i32, i32, ...)*
%6 = tail call i32 (i32, i8*, i32, i32, ...) %5(i32 %0, i8* %1, i32 0, i32 1)
ret i32 %6
}
int f(int x, int y) {
  while (y > 0) {
    x = x + 1;
    y = y - 1;
  }
  return x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    112b <f+0x2b>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110a <f+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
test   %esi,%esi
cmovns %esi,%eax
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = select i1 %3, i32 %1, i32 0
%5 = add i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char const *, char const *);
int print_usage(const char *program) {
  const char *fmt =
      "Usage: %s [-i] <input-dir> [-o <output-dir>] [-s <scale:1-8>]\n";
  printf(fmt, program);
  return 1;
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [63 x i8] c"Usage: %s [-i] <input-dir> [-o <output-dir>] [-s <scale:1-8>]\0A\00"
define i32 @print_usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* %4, i8* %5)
ret i32 1
}

LLVM IR (-O2):
@.str = [63 x i8] c"Usage: %s [-i] <input-dir> [-o <output-dir>] [-s <scale:1-8>]\0A\00"
define i32 @print_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void check() { printf("There is nothing to check\n"); }


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

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

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

LLVM IR (-O2):
@str = [26 x i8] c"There is nothing to check\00"
define void @check() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret void
}
double f4_sum_pre_int_int_int_int_int_int_short(int v0, int v1, int v2, int v3,
                                                int v4, int v5, short v) {
  return (double)v0 + (double)v1 + (double)v2 + (double)v3 + (double)v4 +
         (double)v5 + ((double)(v));
}


x86 assembly (clang, -O0):
<f4_sum_pre_int_int_int_int_int_int_short>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%ax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm0
movswl 0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_sum_pre_int_int_int_int_int_int_short>:
cvtsi2sd %edi,%xmm0
cvtsi2sd %esi,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
cvtsi2sd %ecx,%xmm2
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %r8d,%xmm0
movswl 0x8(%rsp),%eax
addsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r9d,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4_sum_pre_int_int_int_int_int_int_short(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i16 signext %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i16
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i16 %6, i16* %14
%15 = load i32, i32* %8
%16 = sitofp i32 %15 to double
%17 = load i32, i32* %9
%18 = sitofp i32 %17 to double
%19 = fadd double %16, %18
%20 = load i32, i32* %10
%21 = sitofp i32 %20 to double
%22 = fadd double %19, %21
%23 = load i32, i32* %11
%24 = sitofp i32 %23 to double
%25 = fadd double %22, %24
%26 = load i32, i32* %12
%27 = sitofp i32 %26 to double
%28 = fadd double %25, %27
%29 = load i32, i32* %13
%30 = sitofp i32 %29 to double
%31 = fadd double %28, %30
%32 = load i16, i16* %14
%33 = sitofp i16 %32 to double
%34 = fadd double %31, %33
ret double %34
}

LLVM IR (-O2):
define double @f4_sum_pre_int_int_int_int_int_int_short(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i16 signext %6) {
%8 = sitofp i32 %0 to double
%9 = sitofp i32 %1 to double
%10 = fadd double %8, %9
%11 = sitofp i32 %2 to double
%12 = fadd double %10, %11
%13 = sitofp i32 %3 to double
%14 = fadd double %12, %13
%15 = sitofp i32 %4 to double
%16 = fadd double %14, %15
%17 = sitofp i32 %5 to double
%18 = fadd double %16, %17
%19 = sitofp i16 %6 to double
%20 = fadd double %18, %19
ret double %20
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strdup(char const *);
char const *strtok_r(char *, char *, char **);
char *get_name(const char *vhost) {
  char *tmp = strdup(vhost);
  char *tmp_tok;
  char *ret;
  ret = strdup(strtok_r(tmp, ".", &tmp_tok));
  free(tmp);
  return ret;
}


x86 assembly (clang, -O0):
<get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <strtok_r@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name>:
push   %r14
push   %rbx
push   %rax
call   1050 <strdup@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <strtok_r@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define i8* @get_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @strtok_r(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%10 = call i8* @strdup(i8* %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
define noalias i8* @get_name(i8* nocapture %0) {
%2 = alloca i8*
%3 = tail call i8* @strdup(i8* %0)
%4 = bitcast i8** %2 to i8*
%5 = call i8* @strtok_r(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2)
%6 = call i8* @strdup(i8* %5)
%7 = call i32 @free(i8* %3)
ret i8* %6
}
void vpostVAStopTrigger(void) {
  *((volatile unsigned int *)((0xB0008000 + 0x00))) =
      (*((volatile unsigned int *)((0xB0008000 + 0x00)))) &
      ~((1 << 3) | (1 << 1));
}


x86 assembly (clang, -O0):
<vpostVAStopTrigger>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb0008000,%eax
mov    (%rax),%ecx
and    $0xfffffff5,%ecx
mov    $0xb0008000,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpostVAStopTrigger>:
mov    $0xb0008000,%eax
andl   $0xfffffff5,(%rax)
ret

LLVM IR (-O0):
define void @vpostVAStopTrigger() {
%1 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%2 = and i32 %1, -11
store volatile i32 %2, i32* inttoptr (i64 2952822784 to i32*)
ret void
}

LLVM IR (-O2):
define void @vpostVAStopTrigger() {
%1 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%2 = and i32 %1, -11
store volatile i32 %2, i32* inttoptr (i64 2952822784 to i32*)
ret void
}