xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ chown(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ getegid();
int /*<<< orphan*/ geteuid();
int main(void) {
  uid_t uid = geteuid();
  gid_t gid = getegid();
  if (0 > chown("arnold.layne", uid, gid))
    return EXIT_FAILURE;
  else
    return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <geteuid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getegid@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea0(%rip),%rdi
call   1050 <chown@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1184 <main+0x54>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1190 <main+0x60>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <geteuid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getegid@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <chown@plt>
test   %rax,%rax
jns    115f <main+0x2f>
mov    0x2e83(%rip),%rax
jmp    1166 <main+0x36>
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"arnold.layne\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @geteuid()
store i32 %4, i32* %2
%5 = call i32 (...) @getegid()
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i64 @chown(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = icmp sgt i64 0, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = load i32, i32* @EXIT_FAILURE
store i32 %11, i32* %1
br label %14
12: ; preds = %0
%13 = load i32, i32* @EXIT_SUCCESS
store i32 %13, i32* %1
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [13 x i8] c"arnold.layne\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @geteuid()
%2 = tail call i32 (...) @getegid()
%3 = tail call i64 @chown(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = icmp slt i64 %3, 0
%5 = load i32, i32* @EXIT_FAILURE
%6 = load i32, i32* @EXIT_SUCCESS
%7 = select i1 %4, i32 %5, i32 %6
ret i32 %7
}
void SignalReady(void *args) {}


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

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

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

LLVM IR (-O2):
define void @SignalReady(i8* nocapture %0) {
ret void
}
/* Variables and functions */
double bar(double);
double foo();
int __attribute__((no)) test(void) {
  double x = foo();
  x = bar(x);
  x /= 1024L * 1024L * 1024L;
  x *= 70;
  x = x < 70 ? x : 70;
  x += 30;
  return x;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <foo@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <bar@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe9f(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe8d(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    118d <test+0x6d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    119f <test+0x7f>
movsd  0xe6b(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    119f <test+0x7f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe5f(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
xor    %eax,%eax
call   1040 <foo@plt>
call   1030 <bar@plt>
mulsd  0xecb(%rip),%xmm0
movsd  0xecb(%rip),%xmm1
mulsd  %xmm1,%xmm0
minsd  %xmm1,%xmm0
addsd  0xec3(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test() {
%1 = alloca double
%2 = call double (...) @foo()
store double %2, double* %1
%3 = load double, double* %1
%4 = call double @bar(double %3)
store double %4, double* %1
%5 = load double, double* %1
%6 = fdiv double %5, 0x41D0000000000000
store double %6, double* %1
%7 = load double, double* %1
%8 = fmul double %7, 7.000000e+01
store double %8, double* %1
%9 = load double, double* %1
%10 = fcmp olt double %9, 7.000000e+01
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = load double, double* %1
br label %14
13: ; preds = %0
br label %14
14: ; preds = %13, %11
%15 = phi double [ %12, %11 ], [ 7.000000e+01, %13 ]
store double %15, double* %1
%16 = load double, double* %1
%17 = fadd double %16, 3.000000e+01
store double %17, double* %1
%18 = load double, double* %1
%19 = fptosi double %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @test() {
%1 = tail call double (...) @foo()
%2 = tail call double @bar(double %1)
%3 = fmul double %2, 0x3E10000000000000
%4 = fmul double %3, 7.000000e+01
%5 = fcmp olt double %4, 7.000000e+01
%6 = select i1 %5, double %4, double 7.000000e+01
%7 = fadd double %6, 3.000000e+01
%8 = fptosi double %7 to i32
ret i32 %8
}
int range_validbuf2(const void *Min, const void *Max) {
  return (Min && Max >= Min);
}


x86 assembly (clang, -O0):
<range_validbuf2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     112a <range_validbuf2+0x2a>
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
setae  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_validbuf2>:
test   %rdi,%rdi
setne  %al
cmp    %rdi,%rsi
setae  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @range_validbuf2(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = icmp uge i8* %8, %9
br label %11
11: ; preds = %7, %2
%12 = phi i1 [ false, %2 ], [ %10, %7 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @range_validbuf2(i8* readnone %0, i8* readnone %1) {
%3 = icmp ne i8* %0, null
%4 = icmp uge i8* %1, %0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
int lrand() {
  static unsigned long long next = 0;
  next = next * 0x5deece66dLL + 11;
  return (int)((next >> 16) & 0x7fffffff);
}


x86 assembly (clang, -O0):
<lrand>:
push   %rbp
mov    %rsp,%rbp
movabs $0x5deece66d,%rax
imul   0x2f12(%rip),%rax
add    $0xb,%rax
mov    %rax,0x2f07(%rip)
mov    0x2f00(%rip),%rax
shr    $0x10,%rax
and    $0x7fffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lrand>:
movabs $0x5deece66d,%rax
imul   0x2f16(%rip),%rax
add    $0xb,%rax
mov    %rax,0x2f0b(%rip)
shr    $0x10,%rax
and    $0x7fffffff,%eax
ret

LLVM IR (-O0):
@lrand.next = internal global i64 0
define i32 @lrand() {
%1 = load i64, i64* @lrand.next
%2 = mul i64 %1, 25214903917
%3 = add i64 %2, 11
store i64 %3, i64* @lrand.next
%4 = load i64, i64* @lrand.next
%5 = lshr i64 %4, 16
%6 = and i64 %5, 2147483647
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@lrand.next = internal unnamed_addr global i64 0
define i32 @lrand() {
%1 = load i64, i64* @lrand.next
%2 = mul i64 %1, 25214903917
%3 = add i64 %2, 11
store i64 %3, i64* @lrand.next
%4 = lshr i64 %3, 16
%5 = trunc i64 %4 to i32
%6 = and i32 %5, 2147483647
ret i32 %6
}
main(a) { printf(a, 34, a = "main(a){printf(a,34,a=%c%s%c,34);}", 34); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
lea    0xeda(%rip),%rax
mov    %eax,-0x4(%rbp)
mov    $0x22,%ecx
lea    0xecb(%rip),%rax
mov    %eax,%edx
mov    %ecx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movslq %edi,%rdi
lea    0xee5(%rip),%rdx
mov    $0x22,%esi
mov    $0x22,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"main(a){printf(a,34,a=%c%s%c,34);}\00"
define i32 @main(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
store i32 ptrtoint ([35 x i8]* @.str to i32), i32* %2
%6 = call i32 (i8*, ...) @printf(i8* %5, i32 34, i32 ptrtoint ([35 x i8]* @.str to i32), i32 34)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"main(a){printf(a,34,a=%c%s%c,34);}\00"
define i32 @main(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %3, i32 34, i32 ptrtoint ([35 x i8]* @.str to i32), i32 34)
ret i32 0
}
main() {
  double a = 0, fx(double), foo();
  fx(a);
  if (a != 3)
    foo();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fx@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1163 <main+0x43>
jp     1163 <main+0x43>
jmp    116a <main+0x4a>
mov    $0x0,%al
call   1040 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
%3 = load double, double* %2
%4 = call double @fx(double %3)
%5 = load double, double* %2
%6 = fcmp une double %5, 3.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call double (...) @foo()
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double @fx(double 0.000000e+00)
%2 = tail call double (...) @foo()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ recADDU();
void recADD() { recADDU(); }


x86 assembly (clang, -O0):
<recADD>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <recADDU@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @recADD() {
%1 = call i32 (...) @recADDU()
ret void
}

LLVM IR (-O2):
define void @recADD() {
%1 = tail call i32 (...) @recADDU()
ret void
}
/* Variables and functions */
long fib(int);
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, int, long, double);
int main(void) {
  int n = 20;
  long res = 0;
  double t0, t1, tdelta;
  t0 = omp_get_wtime();
#pragma omp parallel
#pragma omp single
  res = fib(n);
  t1 = omp_get_wtime();
  tdelta = t1 - t0;
  printf("Fibonacci de %d e %ld em tempo %0.4f segundos.\n", n, res, tdelta);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <fib@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
movsd  -0x28(%rbp),%xmm0
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x14,%edi
call   1050 <fib@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
subsd  0x8(%rsp),%xmm0
lea    0xe9d(%rip),%rdi
mov    $0x14,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Fibonacci de %d e %ld em tempo %0.4f segundos.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 20, i32* %2
store i64 0, i64* %3
%7 = call double (...) @omp_get_wtime()
store double %7, double* %4
%8 = load i32, i32* %2
%9 = call i64 @fib(i32 %8)
store i64 %9, i64* %3
%10 = call double (...) @omp_get_wtime()
store double %10, double* %5
%11 = load double, double* %5
%12 = load double, double* %4
%13 = fsub double %11, %12
store double %13, double* %6
%14 = load i32, i32* %2
%15 = load i64, i64* %3
%16 = load double, double* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %14, i64 %15, double %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"Fibonacci de %d e %ld em tempo %0.4f segundos.\0A\00"
define i32 @main() {
%1 = tail call double (...) @omp_get_wtime()
%2 = tail call i64 @fib(i32 20)
%3 = tail call double (...) @omp_get_wtime()
%4 = fsub double %3, %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 20, i64 %2, double %4)
ret i32 0
}
void ffi_closure_SYSV(void) {}


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

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

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

LLVM IR (-O2):
define void @ffi_closure_SYSV() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ edit();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ go();
int /*<<< orphan*/ reverse();
int /*<<< orphan*/ stop();
void setMain(int value) {
  switch (value) {
  case 1:
    edit();
    break;
  case 2:
    go();
    break;
  case 3:
    stop();
    break;
  case 4:
    reverse();
    break;
  case 5:
    exit(0);
    break;
  }
}


x86 assembly (clang, -O0):
<setMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     11bb <setMain+0x6b>
mov    -0x10(%rbp),%rax
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <edit@plt>
jmp    11bb <setMain+0x6b>
mov    $0x0,%al
call   1050 <go@plt>
jmp    11bb <setMain+0x6b>
mov    $0x0,%al
call   1060 <stop@plt>
jmp    11bb <setMain+0x6b>
mov    $0x0,%al
call   1030 <reverse@plt>
jmp    11bb <setMain+0x6b>
xor    %edi,%edi
call   1070 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setMain>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x4,%edi
ja     1181 <setMain+0x31>
lea    0xea0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
pop    %rcx
jmp    1040 <edit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <stop@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <reverse@plt>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1050 <go@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
define void @setMain(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %14 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
]
4: ; preds = %1
%5 = call i32 (...) @edit()
br label %14
6: ; preds = %1
%7 = call i32 (...) @go()
br label %14
8: ; preds = %1
%9 = call i32 (...) @stop()
br label %14
10: ; preds = %1
%11 = call i32 (...) @reverse()
br label %14
12: ; preds = %1
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %1, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
define void @setMain(i32 %0) {
switch i32 %0, label %12 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
i32 4, label %8
i32 5, label %10
]
2: ; preds = %1
%3 = tail call i32 (...) @edit()
br label %12
4: ; preds = %1
%5 = tail call i32 (...) @go()
br label %12
6: ; preds = %1
%7 = tail call i32 (...) @stop()
br label %12
8: ; preds = %1
%9 = tail call i32 (...) @reverse()
br label %12
10: ; preds = %1
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %1, %8, %6, %4, %2
ret void
}
/* Variables and functions */
scalar_t__ isword(char);
char *word(char **in) {
  char *tmp = *in;
  for (; isword(**in); (*in)++) {
  }
  **in = '\0';
  (*in)++;
  return tmp;
}


x86 assembly (clang, -O0):
<word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isword@plt>
cmp    $0x0,%rax
je     1158 <word+0x48>
jmp    1145 <word+0x35>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1127 <word+0x17>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<word>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r14
movsbl (%r14),%edi
xchg   %ax,%ax
call   1030 <isword@plt>
test   %rax,%rax
je     113a <word+0x2a>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl 0x1(%rax),%edi
jmp    1120 <word+0x10>
mov    (%rbx),%rax
movb   $0x0,(%rax)
addq   $0x1,(%rbx)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @word(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i64 @isword(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1, %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
%9 = load i8, i8* %8
%10 = tail call i64 @isword(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %1
%13 = load i8*, i8** %0
store i8 0, i8* %13
%14 = load i8*, i8** %0
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %15, i8** %0
ret i8* %2
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
int Random(int Hi) {
  float RanNum;
  RanNum = (float)rand();
  RanNum /= (float)RAND_MAX;
  RanNum *= (float)Hi;
  return ((int)RanNum);
}


x86 assembly (clang, -O0):
<Random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
cvtsi2ssq (%rax),%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
cvttss2si -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Random>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2ec2(%rip),%rax
cvtsi2ssq (%rax),%xmm1
cvtsi2ss %ebx,%xmm2
divss  %xmm1,%xmm0
mulss  %xmm0,%xmm2
cvttss2si %xmm2,%eax
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define i32 @Random(i32 %0) {
%2 = alloca i32
%3 = alloca float
store i32 %0, i32* %2
%4 = call i64 (...) @rand()
%5 = sitofp i64 %4 to float
store float %5, float* %3
%6 = load i64, i64* @RAND_MAX
%7 = sitofp i64 %6 to float
%8 = load float, float* %3
%9 = fdiv float %8, %7
store float %9, float* %3
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to float
%12 = load float, float* %3
%13 = fmul float %12, %11
store float %13, float* %3
%14 = load float, float* %3
%15 = fptosi float %14 to i32
ret i32 %15
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define i32 @Random(i32 %0) {
%2 = tail call i64 (...) @rand()
%3 = sitofp i64 %2 to float
%4 = load i64, i64* @RAND_MAX
%5 = sitofp i64 %4 to float
%6 = fdiv float %3, %5
%7 = sitofp i32 %0 to float
%8 = fmul float %6, %7
%9 = fptosi float %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ path;

/* Variables and functions */
int O_NONBLOCK;
int O_RDONLY;
int open(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int sysfs_gpio_open(int gpio) {
  char path[64];
  int fd;
  snprintf(path, sizeof(path), "/sys/class/gpio/gpio%d/value", gpio);
  fd = open(path, O_RDONLY | O_NONBLOCK);
  return fd;
}


x86 assembly (clang, -O0):
<sysfs_gpio_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x40,%esi
lea    0xec2(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
mov    0x2e91(%rip),%rax
or     (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysfs_gpio_open>:
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ecx
lea    0xed2(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    0x2e9b(%rip),%rax
mov    0x2e9c(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %rbx,%rdi
call   1040 <open@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"/sys/class/gpio/gpio%d/value\00"
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
define i32 @sysfs_gpio_open(i32 %0) {
%2 = alloca i32
%3 = alloca [64 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* @O_RDONLY
%10 = load i32, i32* @O_NONBLOCK
%11 = or i32 %9, %10
%12 = call i32 @open(i8* %8, i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
ret i32 %13
}

LLVM IR (-O2):
@.str = [29 x i8] c"/sys/class/gpio/gpio%d/value\00"
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
define i32 @sysfs_gpio_open(i32 %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 64, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = load i32, i32* @O_RDONLY
%6 = load i32, i32* @O_NONBLOCK
%7 = or i32 %6, %5
%8 = call i32 @open(i8* %3, i32 %7)
ret i32 %8
}
int auditd_tcp_listen_init(struct ev_loop *loop, struct daemon_conf *config) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.ev_loop = type opaque
%struct.daemon_conf = type opaque
define i32 @auditd_tcp_listen_init(%struct.ev_loop* %0, %struct.daemon_conf* %1) {
%3 = alloca %struct.ev_loop*
%4 = alloca %struct.daemon_conf*
store %struct.ev_loop* %0, %struct.ev_loop** %3
store %struct.daemon_conf* %1, %struct.daemon_conf** %4
ret i32 0
}

LLVM IR (-O2):
%struct.ev_loop = type opaque
%struct.daemon_conf = type opaque
define i32 @auditd_tcp_listen_init(%struct.ev_loop* nocapture readnone %0, %struct.daemon_conf* nocapture readnone %1) {
ret i32 0
}
int fun1027() { return 1027; }


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

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

LLVM IR (-O0):
define i32 @fun1027() {
ret i32 1027
}

LLVM IR (-O2):
define i32 @fun1027() {
ret i32 1027
}
void TIM8_CC_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @TIM8_CC_IRQHandler() {
ret void
}
/* Type definitions */
struct json_writer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ json_emit_string_n(struct json_writer *, char const *,
                                      int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void json_emit_string(struct json_writer *writer, const char *string) {
  json_emit_string_n(writer, string, strlen(string));
}


x86 assembly (clang, -O0):
<json_emit_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <json_emit_string_n@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_emit_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <json_emit_string_n@plt>

LLVM IR (-O0):
%struct.json_writer = type { i32 }
define void @json_emit_string(%struct.json_writer* %0, i8* %1) {
%3 = alloca %struct.json_writer*
%4 = alloca i8*
store %struct.json_writer* %0, %struct.json_writer** %3
store i8* %1, i8** %4
%5 = load %struct.json_writer*, %struct.json_writer** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @json_emit_string_n(%struct.json_writer* %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.json_writer = type { i32 }
define void @json_emit_string(%struct.json_writer* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @json_emit_string_n(%struct.json_writer* %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
int g(int, int, int);
int f(int n) { return g(g(1, 2, 3), g(4, 5, 6), g(7, 8, 9)); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <g@plt>
mov    %eax,-0xc(%rbp)
mov    $0x4,%edi
mov    $0x5,%esi
mov    $0x6,%edx
call   1030 <g@plt>
mov    %eax,-0x8(%rbp)
mov    $0x7,%edi
mov    $0x8,%esi
mov    $0x9,%edx
call   1030 <g@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %eax,%edx
call   1030 <g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <g@plt>
mov    %eax,%ebx
mov    $0x4,%edi
mov    $0x5,%esi
mov    $0x6,%edx
call   1030 <g@plt>
mov    %eax,%ebp
mov    $0x7,%edi
mov    $0x8,%esi
mov    $0x9,%edx
call   1030 <g@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <g@plt>

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @g(i32 1, i32 2, i32 3)
%4 = call i32 @g(i32 4, i32 5, i32 6)
%5 = call i32 @g(i32 7, i32 8, i32 9)
%6 = call i32 @g(i32 %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = tail call i32 @g(i32 1, i32 2, i32 3)
%3 = tail call i32 @g(i32 4, i32 5, i32 6)
%4 = tail call i32 @g(i32 7, i32 8, i32 9)
%5 = tail call i32 @g(i32 %2, i32 %3, i32 %4)
ret i32 %5
}
int busca(int x, int n, int v[]) {
  int k;
  k = n - 1;
  while (k >= 0 && v[k] != x)
    k -= 1;
  return k;
}


x86 assembly (clang, -O0):
<busca>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jl     113a <busca+0x3a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x4(%rbp),%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    114a <busca+0x4a>
jmp    1158 <busca+0x58>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <busca+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<busca>:
mov    %esi,%ecx
xor    %eax,%eax
test   %esi,%esi
cmovs  %esi,%eax
add    $0xffffffff,%eax
nopl   0x0(%rax)
test   %ecx,%ecx
jle    1121 <busca+0x21>
add    $0xffffffffffffffff,%rcx
mov    %ecx,%esi
cmp    %edi,(%rdx,%rsi,4)
jne    1110 <busca+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @busca(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 = sub nsw i32 %8, 1
store i32 %9, i32* %7
br label %10
10: ; preds = %23, %3
%11 = load i32, i32* %7
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32, i32* %4
%20 = icmp ne i32 %18, %19
br label %21
21: ; preds = %13, %10
%22 = phi i1 [ false, %10 ], [ %20, %13 ]
br i1 %22, label %23, label %26
23: ; preds = %21
%24 = load i32, i32* %7
%25 = sub nsw i32 %24, 1
store i32 %25, i32* %7
br label %10
26: ; preds = %21
%27 = load i32, i32* %7
ret i32 %27
}

LLVM IR (-O2):
define i32 @busca(i32 %0, i32 %1, i32* nocapture %2) {
%4 = zext i32 %1 to i64
%5 = call i32 @llvm.smin.i32(i32 %1, i32 0)
%6 = add i32 %5, -1
br label %7
7: ; preds = %12, %3
%8 = phi i64 [ %9, %12 ], [ %4, %3 ]
%9 = add nsw i64 %8, -1
%10 = trunc i64 %8 to i32
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %7
%13 = and i64 %9, 4294967295
%14 = getelementptr inbounds i32, i32* %2, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, %0
br i1 %16, label %17, label %7
17: ; preds = %12
%18 = trunc i64 %9 to i32
br label %19
19: ; preds = %7, %17
%20 = phi i32 [ %18, %17 ], [ %6, %7 ]
ret i32 %20
}
void delay(int x) {
  int y;
  if (x == 1)
    for (y = 0; y < 100000; y++)
      ;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    113d <delay+0x3d>
movl   $0x0,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jge    1138 <delay+0x38>
jmp    112a <delay+0x2a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1118 <delay+0x18>
jmp    113d <delay+0x3d>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @delay(i32 %0) {
ret void
}
int sum_of_three(int arg1, int arg2, int arg3) { return arg1 + arg2 + arg3; }


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

x86 assembly (clang, -O2):
<sum_of_three>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @sum_of_three(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 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @sum_of_three(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(void *, int, int, int /*<<< orphan*/ *);
int xfwrite(void *p, int size, int num, FILE *fp) {
  int block;
  void *tmp;
  tmp = p;
  block = fwrite(tmp, size, num, fp);
  return block;
}


x86 assembly (clang, -O0):
<xfwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <fwrite@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfwrite>:
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
define i32 @xfwrite(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%11 = load i8*, i8** %5
store i8* %11, i8** %10
%12 = load i8*, i8** %10
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32*, i32** %8
%16 = call i32 @fwrite(i8* %12, i32 %13, i32 %14, i32* %15)
store i32 %16, i32* %9
%17 = load i32, i32* %9
ret i32 %17
}

LLVM IR (-O2):
define i32 @xfwrite(i8* nocapture %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = tail call i32 @fwrite(i8* %0, i32 %1, i32 %2, i32* %3)
ret i32 %5
}
int iMul(int a, int b) { return a * b; }


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

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

LLVM IR (-O0):
define i32 @iMul(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 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @iMul(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
int toascii(int c) { return ((unsigned char)c & 0x7f); }


x86 assembly (clang, -O0):
<toascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movzbl %al,%eax
and    $0x7f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toascii>:
mov    %edi,%eax
and    $0x7f,%eax
ret

LLVM IR (-O0):
define i32 @toascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = zext i8 %4 to i32
%6 = and i32 %5, 127
ret i32 %6
}

LLVM IR (-O2):
define i32 @toascii(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ int16_t;

/* Variables and functions */
int16_t ones_to_twos_complement2(int16_t num) {
  return num < 0 ? num + 1 : num;
}


x86 assembly (clang, -O0):
<ones_to_twos_complement2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1124 <ones_to_twos_complement2+0x24>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <ones_to_twos_complement2+0x2c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ones_to_twos_complement2>:
mov    %rdi,%rax
shr    $0x3f,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @ones_to_twos_complement2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = add nsw i64 %6, 1
br label %10
8: ; preds = %1
%9 = load i64, i64* %2
br label %10
10: ; preds = %8, %5
%11 = phi i64 [ %7, %5 ], [ %9, %8 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @ones_to_twos_complement2(i64 %0) {
%2 = lshr i64 %0, 63
%3 = add nsw i64 %2, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ fdc_set_ps1();
int /*<<< orphan*/ ps1_common_init();
int /*<<< orphan*/ ps1mb_m2121_init();
void ps1_m2121_init() {
  ps1_common_init();
  ps1mb_m2121_init();
  fdc_set_ps1();
}


x86 assembly (clang, -O0):
<ps1_m2121_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ps1_common_init@plt>
mov    $0x0,%al
call   1030 <ps1mb_m2121_init@plt>
mov    $0x0,%al
call   1050 <fdc_set_ps1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ps1_m2121_init>:
push   %rax
xor    %eax,%eax
call   1040 <ps1_common_init@plt>
xor    %eax,%eax
call   1030 <ps1mb_m2121_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <fdc_set_ps1@plt>

LLVM IR (-O0):
define void @ps1_m2121_init() {
%1 = call i32 (...) @ps1_common_init()
%2 = call i32 (...) @ps1mb_m2121_init()
%3 = call i32 (...) @fdc_set_ps1()
ret void
}

LLVM IR (-O2):
define void @ps1_m2121_init() {
%1 = tail call i32 (...) @ps1_common_init()
%2 = tail call i32 (...) @ps1mb_m2121_init()
%3 = tail call i32 (...) @fdc_set_ps1()
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t orrl0(uint64_t x) { return x | 0; }


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

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

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

LLVM IR (-O2):
define i32 @orrl0(i32 returned %0) {
ret i32 %0
}
int script_exp_type_get(unsigned type) { return type & 0xF00; }


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

x86 assembly (clang, -O2):
<script_exp_type_get>:
mov    %edi,%eax
and    $0xf00,%eax
ret

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

LLVM IR (-O2):
define i32 @script_exp_type_get(i32 %0) {
%2 = and i32 %0, 3840
ret i32 %2
}
/* Type definitions */
struct sockaddr_in6 {
  int dummy;
};
struct sockaddr_in {
  int dummy;
};
typedef int socklen_t;
typedef int sa_family_t;

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
socklen_t af_len(sa_family_t af) {
  switch (af) {
  case AF_INET:
    return sizeof(struct sockaddr_in);
  case AF_INET6:
    return sizeof(struct sockaddr_in6);
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<af_len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x80,%eax
je     113c <af_len+0x3c>
jmp    111d <af_len+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x81,%eax
jne    1148 <af_len+0x48>
jmp    1130 <af_len+0x30>
movl   $0x4,-0x4(%rbp)
jmp    114f <af_len+0x4f>
movl   $0x4,-0x4(%rbp)
jmp    114f <af_len+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<af_len>:
and    $0xfffffffe,%edi
xor    %eax,%eax
cmp    $0x80,%edi
sete   %al
shl    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @af_len(i32 %0) {
%2 = and i32 %0, -2
%3 = icmp eq i32 %2, 128
%4 = select i1 %3, i32 4, i32 0
ret i32 %4
}
void limpa(int *lista, int tam) {
  int i;
  for (i = 0; i < tam; i++)
    lista[i] = 0;
}


x86 assembly (clang, -O0):
<limpa>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <limpa+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <limpa+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<limpa>:
test   %esi,%esi
jle    1126 <limpa+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @limpa(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
int test_imm_03uint16_reg(unsigned short val) {
  return ((val) & (-0x03 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_03uint16_reg>:
test   $0xfffd,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_03uint16_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, -3
%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_03uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -3
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n1, n2;
  scanf("%d %d", &n1, &n2);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
ret i32 0
}
float float_lerp(float a, float b, float t) { return a + (b - a) * t; }


x86 assembly (clang, -O0):
<float_lerp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_lerp>:
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @float_lerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = load float, float* %6
%12 = call float @llvm.fmuladd.f32(float %10, float %11, float %7)
ret float %12
}

LLVM IR (-O2):
define float @float_lerp(float %0, float %1, float %2) {
%4 = fsub float %1, %0
%5 = tail call float @llvm.fmuladd.f32(float %4, float %2, float %0)
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ myarray;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int myarray[] = {32, 67, 25, 48, 5, 17, 23};
  int length = sizeof(myarray) / sizeof(*myarray);
  printf("length of myarray is %d \n", length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed2(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x7,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.myarray = [7 x i32] [i32 32, i32 67, i32 25, i32 48, i32 5, i32 17, i32 23]
@.str = [26 x i8] c"length of myarray is %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i32]* %2 to i8*
store i32 7, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"length of myarray is %d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sockbuf_delete(int);
int stdin_eof(void *client_data, int idx, int err, const char *errmsg) {
  sockbuf_delete(idx);
  return (0);
}


x86 assembly (clang, -O0):
<stdin_eof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <sockbuf_delete@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdin_eof>:
push   %rax
mov    %esi,%edi
call   1030 <sockbuf_delete@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @stdin_eof(i8* nocapture readnone %0, i32 %1, i32 %2, i8* nocapture readnone %3) {
%5 = tail call i32 @sockbuf_delete(i32 %1)
ret i32 0
}