xunge/DecIR huggingface dataset:
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
signed long int jodie_getMillis() {
  struct timeval tt;
  signed long int timestamp;
  gettimeofday(&tt, NULL);
  timestamp = (tt.tv_sec * 1000) + (tt.tv_usec / 1000);
  return timestamp;
}


x86 assembly (clang, -O0):
<jodie_getMillis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jodie_getMillis>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @jodie_getMillis() {
%1 = alloca %struct.timeval
%2 = alloca i64
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %6, %9
%11 = sext i32 %10 to i64
store i64 %11, i64* %2
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @jodie_getMillis() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
%11 = sext i32 %10 to i64
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ StabilizationBankHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void StabilizationBankUpdated() { UAVObjUpdated(StabilizationBankHandle()); }


x86 assembly (clang, -O0):
<StabilizationBankUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <StabilizationBankHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<StabilizationBankUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <StabilizationBankHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @StabilizationBankUpdated() {
%1 = call i32 (...) @StabilizationBankHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @StabilizationBankUpdated() {
%1 = tail call i32 (...) @StabilizationBankHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Variables and functions */
void *bswap_32(unsigned int);
unsigned long long bswap_64(unsigned long long x) {
  union {
    unsigned long long ll;
    unsigned int l[2];
  } w, r;
  w.ll = x;
  r.l[0] = bswap_32(w.l[1]);
  r.l[1] = bswap_32(w.l[0]);
  return r.ll;
}


x86 assembly (clang, -O0):
<bswap_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <bswap_32@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <bswap_32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap_64>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
shr    $0x20,%rdi
call   1030 <bswap_32@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1030 <bswap_32@plt>
shl    $0x20,%rax
mov    %r14d,%ecx
or     %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%union.anon = type { i64 }
define i64 @bswap_64(i64 %0) {
%2 = alloca i64
%3 = alloca %union.anon
%4 = alloca %union.anon
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = bitcast %union.anon* %3 to i64*
store i64 %5, i64* %6
%7 = bitcast %union.anon* %3 to [2 x i32]*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%9 = load i32, i32* %8
%10 = call i8* @bswap_32(i32 %9)
%11 = ptrtoint i8* %10 to i32
%12 = bitcast %union.anon* %4 to [2 x i32]*
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
store i32 %11, i32* %13
%14 = bitcast %union.anon* %3 to [2 x i32]*
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%16 = load i32, i32* %15
%17 = call i8* @bswap_32(i32 %16)
%18 = ptrtoint i8* %17 to i32
%19 = bitcast %union.anon* %4 to [2 x i32]*
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %19, i64 0, i64 1
store i32 %18, i32* %20
%21 = bitcast %union.anon* %4 to i64*
%22 = load i64, i64* %21
ret i64 %22
}

LLVM IR (-O2):
define i64 @bswap_64(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i64 %0, 32
%4 = trunc i64 %3 to i32
%5 = tail call i8* @bswap_32(i32 %4)
%6 = ptrtoint i8* %5 to i64
%7 = tail call i8* @bswap_32(i32 %2)
%8 = ptrtoint i8* %7 to i64
%9 = shl i64 %8, 32
%10 = and i64 %6, 4294967295
%11 = or i64 %9, %10
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void printAsc(char *data, int len) {
  int i = 0;
  for (i = 0; i < len; i++) {
    printf(" %d \n", data[i]);
  }
}


x86 assembly (clang, -O0):
<printAsc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115f <printAsc+0x4f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
lea    0xeb8(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <printAsc+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAsc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1146 <printAsc+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printAsc+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c" %d \0A\00"
define void @printAsc(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int wchar_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
int /*<<< orphan*/ EILSEQ;
int /*<<< orphan*/ errno;
size_t _wcrtomb_ascii(char *s, wchar_t wcorig, mbstate_t *ps) {
  uint32_t wc = wcorig;
  if (wc <= 0xff) {
    *s++ = wc;
    return 1;
  } else {
    errno = EILSEQ;
    return (size_t)-1;
  }
}


x86 assembly (clang, -O0):
<_wcrtomb_ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0xff,-0x24(%rbp)
jg     1145 <_wcrtomb_ascii+0x45>
mov    -0x24(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
movq   $0x1,-0x8(%rbp)
jmp    115f <_wcrtomb_ascii+0x5f>
mov    0x2ea4(%rip),%rax
mov    (%rax),%ecx
mov    0x2e83(%rip),%rax
mov    %ecx,(%rax)
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_wcrtomb_ascii>:
cmp    $0xff,%esi
jg     1111 <_wcrtomb_ascii+0x11>
mov    %sil,(%rdi)
mov    $0x1,%eax
ret
mov    0x2ed8(%rip),%rax
mov    (%rax),%eax
mov    0x2eb7(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
@EILSEQ = global i32 0
@errno = global i32 0
define i64 @_wcrtomb_ascii(i8* %0, i32 %1, i32* %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = load i32, i32* %6
store i32 %9, i32* %8
%10 = load i32, i32* %8
%11 = icmp sle i32 %10, 255
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i32, i32* %8
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %5
store i8 %14, i8* %15
store i64 1, i64* %4
br label %19
17: ; preds = %3
%18 = load i32, i32* @EILSEQ
store i32 %18, i32* @errno
store i64 -1, i64* %4
br label %19
19: ; preds = %17, %12
%20 = load i64, i64* %4
ret i64 %20
}

LLVM IR (-O2):
@EILSEQ = global i32 0
@errno = global i32 0
define i64 @_wcrtomb_ascii(i8* nocapture writeonly %0, i32 %1, i32* nocapture readnone %2) {
%4 = icmp slt i32 %1, 256
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = trunc i32 %1 to i8
store i8 %6, i8* %0
br label %9
7: ; preds = %3
%8 = load i32, i32* @EILSEQ
store i32 %8, i32* @errno
br label %9
9: ; preds = %7, %5
%10 = phi i64 [ 1, %5 ], [ -1, %7 ]
ret i64 %10
}
void ff_get_unscaled_swscale_ppc() {}


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

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

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

LLVM IR (-O2):
define void @ff_get_unscaled_swscale_ppc() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime_r(int /*<<< orphan*/ *, struct tm *);
int test(void) {
  time_t time;
  struct tm *timestruct_pointer;
  struct tm timestruct;
  timestruct_pointer = localtime_r(&time, &timestruct);
  return (timestruct_pointer != NULL);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <localtime_r@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @test() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca %struct.tm
%4 = call %struct.tm* @localtime_r(i32* %1, %struct.tm* %3)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = icmp ne %struct.tm* %5, null
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @test() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = call %struct.tm* @localtime_r(i32* %1, %struct.tm* %2)
%6 = icmp ne %struct.tm* %5, null
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ consolemanager_clear();
int /*<<< orphan*/ consolemanager_println(char *);
void cmd_clear(int argc, char *argv[] __attribute__((__unused__))) {
  if (argc != 0) {
    consolemanager_println("no argument required");
  }
  consolemanager_clear();
}


x86 assembly (clang, -O0):
<cmd_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1145 <cmd_clear+0x25>
lea    0xec0(%rip),%rdi
call   1040 <consolemanager_println@plt>
mov    $0x0,%al
call   1030 <consolemanager_clear@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_clear>:
test   %edi,%edi
je     1135 <cmd_clear+0x15>
push   %rax
lea    0xed4(%rip),%rdi
call   1040 <consolemanager_println@plt>
add    $0x8,%rsp
xor    %eax,%eax
jmp    1030 <consolemanager_clear@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"no argument required\00"
define void @cmd_clear(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @consolemanager_println(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
%10 = call i32 (...) @consolemanager_clear()
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"no argument required\00"
define void @cmd_clear(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @consolemanager_println(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = tail call i32 (...) @consolemanager_clear()
ret void
}
/* Variables and functions */
double sqrt(double);
double get_fade_in_volume(double t0, double t, double t1) {
  t = (t / ((t1 - t0) / 2.0)) - 1.0;
  return sqrt(0.5 * (1.0 + t));
}


x86 assembly (clang, -O0):
<get_fade_in_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
movsd  0xed2(%rip),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xeba(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xea9(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xe94(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_fade_in_volume>:
subsd  %xmm0,%xmm2
movsd  0xee4(%rip),%xmm0
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
addsd  0xedc(%rip),%xmm1
addsd  0xedc(%rip),%xmm1
mulsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     114a <get_fade_in_volume+0x3a>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
ret
movapd %xmm1,%xmm0
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @get_fade_in_volume(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = load double, double* %6
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = fdiv double %10, 2.000000e+00
%12 = fdiv double %7, %11
%13 = fsub double %12, 1.000000e+00
store double %13, double* %5
%14 = load double, double* %5
%15 = fadd double 1.000000e+00, %14
%16 = fmul double 5.000000e-01, %15
%17 = call double @sqrt(double %16)
ret double %17
}

LLVM IR (-O2):
define double @get_fade_in_volume(double %0, double %1, double %2) {
%4 = fsub double %2, %0
%5 = fmul double %4, 5.000000e-01
%6 = fdiv double %1, %5
%7 = fadd double %6, -1.000000e+00
%8 = fadd double %7, 1.000000e+00
%9 = fmul double %8, 5.000000e-01
%10 = tail call double @sqrt(double %9)
ret double %10
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(char);
int main() {
  int c;
  for (; (c = getchar()) != EOF; putchar(c == ' ' ? '\n' : c))
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     117a <main+0x5a>
jmp    114d <main+0x2d>
cmpl   $0x20,-0x8(%rbp)
jne    1164 <main+0x44>
mov    $0xa,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <main+0x4a>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb7(%rip),%rbx
cmp    (%rbx),%eax
je     1159 <main+0x39>
mov    $0xa,%ebp
nopw   0x0(%rax,%rax,1)
cmp    $0x20,%eax
cmove  %ebp,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %14, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %18
7: ; preds = %3
br label %8
8: ; preds = %7
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 32
br i1 %10, label %11, label %12
11: ; preds = %8
br label %14
12: ; preds = %8
%13 = load i32, i32* %2
br label %14
14: ; preds = %12, %11
%15 = phi i32 [ 10, %11 ], [ %13, %12 ]
%16 = trunc i32 %15 to i8
%17 = call i32 @putchar(i8 signext %16)
br label %3
18: ; preds = %3
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %10, %4 ], [ %1, %0 ]
%6 = icmp eq i32 %5, 32
%7 = trunc i32 %5 to i8
%8 = select i1 %6, i8 10, i8 %7
%9 = tail call i32 @putchar(i8 signext %8)
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %0
ret i32 0
}
unsigned short _rc2_rol(unsigned short input, int places) {
  unsigned short temp, i;
  for (i = 0; i < places; i++) {
    temp = input & 0x8000;
    input = input << 1;
    if (temp) {
      input++;
    }
  }
  return input;
}


x86 assembly (clang, -O0):
<_rc2_rol>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movw   $0x0,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1166 <_rc2_rol+0x66>
movzwl -0x2(%rbp),%eax
and    $0x8000,%eax
mov    %ax,-0xa(%rbp)
movzwl -0x2(%rbp),%eax
shl    $0x1,%eax
mov    %ax,-0x2(%rbp)
cmpw   $0x0,-0xa(%rbp)
je     1150 <_rc2_rol+0x50>
mov    -0x2(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2(%rbp)
jmp    1155 <_rc2_rol+0x55>
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    1114 <_rc2_rol+0x14>
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rc2_rol>:
mov    %edi,%eax
test   %esi,%esi
jle    111d <_rc2_rol+0x1d>
mov    $0x1,%cx
nopw   0x0(%rax,%rax,1)
rol    %ax
movzwl %cx,%edx
add    $0x1,%ecx
cmp    %esi,%edx
jl     1110 <_rc2_rol+0x10>
ret

LLVM IR (-O0):
define zeroext i16 @_rc2_rol(i16 zeroext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
%5 = alloca i16
%6 = alloca i16
store i16 %0, i16* %3
store i32 %1, i32* %4
store i16 0, i16* %6
br label %7
7: ; preds = %27, %2
%8 = load i16, i16* %6
%9 = zext i16 %8 to i32
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %30
12: ; preds = %7
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = and i32 %14, 32768
%16 = trunc i32 %15 to i16
store i16 %16, i16* %5
%17 = load i16, i16* %3
%18 = zext i16 %17 to i32
%19 = shl i32 %18, 1
%20 = trunc i32 %19 to i16
store i16 %20, i16* %3
%21 = load i16, i16* %5
%22 = icmp ne i16 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %12
%24 = load i16, i16* %3
%25 = add i16 %24, 1
store i16 %25, i16* %3
br label %26
26: ; preds = %23, %12
br label %27
27: ; preds = %26
%28 = load i16, i16* %6
%29 = add i16 %28, 1
store i16 %29, i16* %6
br label %7
30: ; preds = %7
%31 = load i16, i16* %3
ret i16 %31
}

LLVM IR (-O2):
define zeroext i16 @_rc2_rol(i16 zeroext %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi i16 [ %8, %4 ], [ 0, %2 ]
%6 = phi i16 [ %7, %4 ], [ %0, %2 ]
%7 = tail call i16 @llvm.fshl.i16(i16 %6, i16 %6, i16 1)
%8 = add i16 %5, 1
%9 = zext i16 %8 to i32
%10 = icmp slt i32 %9, %1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
%12 = phi i16 [ %0, %2 ], [ %7, %4 ]
ret i16 %12
}
/* Type definitions */
struct cx18_stream {
  int dummy;
};
struct cx18_queue {
  int dummy;
};
struct cx18_buffer {
  int dummy;
};

/* Variables and functions */
struct cx18_queue *_cx18_enqueue(struct cx18_stream *, struct cx18_buffer *,
                                 struct cx18_queue *, int /*<<< orphan*/);
struct cx18_queue *cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf,
                                struct cx18_queue *q) {
  return _cx18_enqueue(s, buf, q, 0);
}


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

x86 assembly (clang, -O2):
<cx18_enqueue>:
xor    %ecx,%ecx
jmp    1030 <_cx18_enqueue@plt>

LLVM IR (-O0):
%struct.cx18_stream = type { i32 }
%struct.cx18_buffer = type { i32 }
%struct.cx18_queue = type { i32 }
define %struct.cx18_queue* @cx18_enqueue(%struct.cx18_stream* %0, %struct.cx18_buffer* %1, %struct.cx18_queue* %2) {
%4 = alloca %struct.cx18_stream*
%5 = alloca %struct.cx18_buffer*
%6 = alloca %struct.cx18_queue*
store %struct.cx18_stream* %0, %struct.cx18_stream** %4
store %struct.cx18_buffer* %1, %struct.cx18_buffer** %5
store %struct.cx18_queue* %2, %struct.cx18_queue** %6
%7 = load %struct.cx18_stream*, %struct.cx18_stream** %4
%8 = load %struct.cx18_buffer*, %struct.cx18_buffer** %5
%9 = load %struct.cx18_queue*, %struct.cx18_queue** %6
%10 = call %struct.cx18_queue* @_cx18_enqueue(%struct.cx18_stream* %7, %struct.cx18_buffer* %8, %struct.cx18_queue* %9, i32 0)
ret %struct.cx18_queue* %10
}

LLVM IR (-O2):
%struct.cx18_stream = type { i32 }
%struct.cx18_buffer = type { i32 }
%struct.cx18_queue = type { i32 }
define %struct.cx18_queue* @cx18_enqueue(%struct.cx18_stream* %0, %struct.cx18_buffer* %1, %struct.cx18_queue* %2) {
%4 = tail call %struct.cx18_queue* @_cx18_enqueue(%struct.cx18_stream* %0, %struct.cx18_buffer* %1, %struct.cx18_queue* %2, i32 0)
ret %struct.cx18_queue* %4
}
/* Variables and functions */
int /*<<< orphan*/ IntEnable(int);
int /*<<< orphan*/ IntRegister(int, void (*)());
void MPUIntRegister(void (*pfnHandler)(void)) {
  ;
  IntRegister(4, pfnHandler);
  IntEnable(4);
}


x86 assembly (clang, -O0):
<MPUIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x4,%edi
call   1040 <IntRegister@plt>
mov    $0x4,%edi
call   1030 <IntEnable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPUIntRegister>:
push   %rax
mov    %rdi,%rsi
mov    $0x4,%edi
call   1040 <IntRegister@plt>
mov    $0x4,%edi
pop    %rax
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @MPUIntRegister(void ()* %0) {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = load void ()*, void ()** %2
%4 = bitcast void ()* %3 to void (...)*
%5 = call i32 @IntRegister(i32 4, void (...)* %4)
%6 = call i32 @IntEnable(i32 4)
ret void
}

LLVM IR (-O2):
define void @MPUIntRegister(void ()* %0) {
%2 = bitcast void ()* %0 to void (...)*
%3 = tail call i32 @IntRegister(i32 4, void (...)* %2)
%4 = tail call i32 @IntEnable(i32 4)
ret void
}
unsigned s2e_codext_fuzz(unsigned start, unsigned end) {
  unsigned retval;
  __asm__ __volatile__(".byte 0x0f, 0x3f\n"
                       ".byte 0x00, 0xFA, 0x02, 0x00\n"
                       ".byte 0x00, 0x00, 0x00, 0x00\n"
                       : "=a"(retval)
                       : "a"(0), "b"(start), "c"(end));
  return retval;
}


x86 assembly (clang, -O0):
<s2e_codext_fuzz>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%ebx
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
(bad)
add    %bh,%dl
add    (%rax),%al
add    %al,(%rax)
add    %al,(%rax)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2e_codext_fuzz>:
push   %rbx
mov    %esi,%ecx
mov    %edi,%ebx
xor    %eax,%eax
(bad)
add    %bh,%dl
add    (%rax),%al
add    %al,(%rax)
add    %al,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @s2e_codext_fuzz(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 asm sideeffect ".byte 0x0f, 0x3f\0A.byte 0x00, 0xFA, 0x02, 0x00\0A.byte 0x00, 0x00, 0x00, 0x00\0A", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 0, i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @s2e_codext_fuzz(i32 %0, i32 %1) {
%3 = tail call i32 asm sideeffect ".byte 0x0f, 0x3f\0A.byte 0x00, 0xFA, 0x02, 0x00\0A.byte 0x00, 0x00, 0x00, 0x00\0A", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 0, i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
double rand0max(double);
double randminmax(double min, double max) { return rand0max(max - min) + max; }


x86 assembly (clang, -O0):
<randminmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <rand0max@plt>
addsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randminmax>:
push   %rax
movapd %xmm1,%xmm2
movsd  %xmm1,(%rsp)
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
call   1030 <rand0max@plt>
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @randminmax(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fsub double %5, %6
%8 = call double @rand0max(double %7)
%9 = load double, double* %4
%10 = fadd double %8, %9
ret double %10
}

LLVM IR (-O2):
define double @randminmax(double %0, double %1) {
%3 = fsub double %1, %0
%4 = tail call double @rand0max(double %3)
%5 = fadd double %4, %1
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ next_greater(int *, int);
void main() {
  int a[] = {4, 5, 2, 25};
  int len = sizeof(a) / sizeof(a[0]);
  next_greater(a, len);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <next_greater@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1030 <next_greater@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [4 x i32] [i32 4, i32 5, i32 2, i32 25]
define void @main() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = bitcast [4 x i32]* %1 to i8*
store i32 4, i32* %2
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @next_greater(i32* %4, i32 %5)
ret void
}

LLVM IR (-O2):
@__const.main.a = [4 x i32] [i32 4, i32 5, i32 2, i32 25]
define void @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @next_greater(i32* %3, i32 4)
ret void
}
/* Type definitions */
struct rdp_frame_buffer {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ gl_screen_write(struct rdp_frame_buffer *,
                                   int /*<<< orphan*/);
void screen_write(struct rdp_frame_buffer *buffer, int32_t output_height) {
  gl_screen_write(buffer, output_height);
}


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

x86 assembly (clang, -O2):
<screen_write>:
jmp    1030 <gl_screen_write@plt>

LLVM IR (-O0):
%struct.rdp_frame_buffer = type { i32 }
define void @screen_write(%struct.rdp_frame_buffer* %0, i32 %1) {
%3 = alloca %struct.rdp_frame_buffer*
%4 = alloca i32
store %struct.rdp_frame_buffer* %0, %struct.rdp_frame_buffer** %3
store i32 %1, i32* %4
%5 = load %struct.rdp_frame_buffer*, %struct.rdp_frame_buffer** %3
%6 = load i32, i32* %4
%7 = call i32 @gl_screen_write(%struct.rdp_frame_buffer* %5, i32 %6)
ret void
}

LLVM IR (-O2):
%struct.rdp_frame_buffer = type { i32 }
define void @screen_write(%struct.rdp_frame_buffer* %0, i32 %1) {
%3 = tail call i32 @gl_screen_write(%struct.rdp_frame_buffer* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, int /*<<< orphan*/, int);
dputs(char *b) {
  while (*b)
    write(1, b++, 1);
}


x86 assembly (clang, -O0):
<dputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <dputs+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%esi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
jmp    111c <dputs+0xc>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dputs>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     113e <dputs+0x2e>
mov    %rdi,%rbx
lea    0x1(%rdi),%r14
mov    $0x1,%edi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x1,%ebx
cmpb   $0x0,(%r14)
lea    0x1(%r14),%r14
jne    1120 <dputs+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @dputs(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = ptrtoint i8* %5 to i64
%8 = trunc i64 %7 to i32
%9 = tail call i32 @write(i32 1, i32 %8, i32 1)
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ close_sockets(int, char *);
void emergency_shutdown(void) { close_sockets(1, (char *)"Going down - Bye"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Going down - Bye\00"
define void @emergency_shutdown() {
%1 = call i32 @close_sockets(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Going down - Bye\00"
define void @emergency_shutdown() {
%1 = tail call i32 @close_sockets(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
unsigned long ULONG_MAX;
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  unsigned long max_long = ULONG_MAX;
  time_t latest = time((time_t *)&max_long);
  printf("%s", ctime((time_t *)&latest));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <time@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0x2e9d(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <ctime@plt>
lea    0xe9e(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@ULONG_MAX = global i64 0
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i32
%5 = bitcast i64* %3 to i8*
%6 = load i64, i64* @ULONG_MAX
store i64 %6, i64* %3
%7 = bitcast i32* %4 to i8*
%8 = bitcast i64* %3 to i32*
%9 = call i32 @time(i32* %8)
store i32 %9, i32* %4
%10 = call i8* @ctime(i32* %4)
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int a_strcpy(char *, int, char const *);
int a_strnlen(char *, int);
ssize_t a_strcat(char *dst, ssize_t n, const char *src) {
  ssize_t dlen = a_strnlen(dst, n - 1);
  return dlen + a_strcpy(dst + dlen, n - dlen, src);
}


x86 assembly (clang, -O0):
<a_strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1040 <a_strnlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <a_strcpy@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_strcat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
lea    -0x1(%r15),%esi
call   1040 <a_strnlen@plt>
movslq %eax,%r12
add    %r12,%rbx
sub    %r12d,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1030 <a_strcpy@plt>
add    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @a_strcat(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 1
%11 = call i32 @a_strnlen(i8* %8, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %17, %18
%20 = load i8*, i8** %6
%21 = call i32 @a_strcpy(i8* %16, i32 %19, i8* %20)
%22 = add nsw i32 %12, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @a_strcat(i8* %0, i32 %1, i8* %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 @a_strnlen(i8* %0, i32 %4)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = sub nsw i32 %1, %5
%9 = tail call i32 @a_strcpy(i8* %7, i32 %8, i8* %2)
%10 = add nsw i32 %9, %5
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_mutex_unlock(int /*<<< orphan*/ *);
void stub_mutex_leave(pthread_mutex_t *mutex) { pthread_mutex_unlock(mutex); }


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

x86 assembly (clang, -O2):
<stub_mutex_leave>:
jmp    1030 <pthread_mutex_unlock@plt>

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

LLVM IR (-O2):
define void @stub_mutex_leave(i32* %0) {
%2 = tail call i32 @pthread_mutex_unlock(i32* %0)
ret void
}
float earth_get_hop_depth(float height) {
  height /= 6371.0;
  return 1.0 / (1.0 + height);
}


x86 assembly (clang, -O0):
<earth_get_hop_depth>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeee(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec8(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<earth_get_hop_depth>:
divss  0xef8(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @earth_get_hop_depth(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fdiv double %4, 6.371000e+03
%6 = fptrunc double %5 to float
store float %6, float* %2
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fadd double 1.000000e+00, %8
%10 = fdiv double 1.000000e+00, %9
%11 = fptrunc double %10 to float
ret float %11
}

LLVM IR (-O2):
define float @earth_get_hop_depth(float %0) {
%2 = fdiv float %0, 6.371000e+03
%3 = fpext float %2 to double
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
%6 = fptrunc double %5 to float
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ SA1Absolute(int);
int /*<<< orphan*/ TSB8(int /*<<< orphan*/);
void Op0CM1(void) { TSB8(SA1Absolute(3)); }


x86 assembly (clang, -O0):
<Op0CM1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <SA1Absolute@plt>
mov    %eax,%edi
call   1030 <TSB8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op0CM1>:
push   %rax
mov    $0x3,%edi
call   1040 <SA1Absolute@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <TSB8@plt>

LLVM IR (-O0):
define void @Op0CM1() {
%1 = call i32 @SA1Absolute(i32 3)
%2 = call i32 @TSB8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op0CM1() {
%1 = tail call i32 @SA1Absolute(i32 3)
%2 = tail call i32 @TSB8(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void alarm_handler() {
  write(STDOUT_FILENO,
        "Test FAILED: Alarm fired while waiting for cancelation\n",
        sizeof("Test FAILED: Alarm fired while waiting for cancelation\n") - 1);
  _exit(1);
}


x86 assembly (clang, -O0):
<alarm_handler>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    $0x37,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<alarm_handler>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
mov    $0x37,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@.str = [56 x i8] c"Test FAILED: Alarm fired while waiting for cancelation\0A\00"
define void @alarm_handler() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = call i32 @write(i32 %1, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 55)
%3 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@.str = [56 x i8] c"Test FAILED: Alarm fired while waiting for cancelation\0A\00"
define void @alarm_handler() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 55)
%3 = tail call i32 @_exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ restoretermio();
void echoOn() { restoretermio(); }


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

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

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

LLVM IR (-O2):
define void @echoOn() {
%1 = tail call i32 (...) @restoretermio()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ leconvert_uint64_to(int /*<<< orphan*/);
int64_t leconvert_int64_to(int64_t native) {
  return leconvert_uint64_to(native);
}


x86 assembly (clang, -O0):
<leconvert_int64_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <leconvert_uint64_to@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leconvert_int64_to>:
jmp    1030 <leconvert_uint64_to@plt>

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

LLVM IR (-O2):
define i32 @leconvert_int64_to(i32 %0) {
%2 = tail call i32 @leconvert_uint64_to(i32 %0)
ret i32 %2
}
int gmacdev_open(struct inode *inode, struct file *file) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.inode = type opaque
%struct.file = type opaque
define i32 @gmacdev_open(%struct.inode* nocapture readnone %0, %struct.file* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Init();
int /*<<< orphan*/ Motors_Signal();
void main() {
  Init();
  while (1) {
    Motors_Signal();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <Init@plt>
mov    $0x0,%al
call   1030 <Motors_Signal@plt>
jmp    112b <main+0xb>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <Init@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <Motors_Signal@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @Init()
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @Motors_Signal()
br label %2
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @Init()
br label %2
2: ; preds = %0, %2
%3 = tail call i32 (...) @Motors_Signal()
br label %2
}
void foo_2_2_1_2_1_1_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_1_2_1_1_2_1_2() {
ret void
}
int spi_bulkwrite(void *hDevice, unsigned short addr, unsigned char command,
                  unsigned char *data, unsigned short length) {
  return 0;
}


x86 assembly (clang, -O0):
<spi_bulkwrite>:
push   %rbp
mov    %rsp,%rbp
mov    %r8w,%ax
mov    %rdi,-0x8(%rbp)
mov    %si,-0xa(%rbp)
mov    %dl,-0xb(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @spi_bulkwrite(i8* %0, i16 zeroext %1, i8 zeroext %2, i8* %3, i16 zeroext %4) {
%6 = alloca i8*
%7 = alloca i16
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i16
store i8* %0, i8** %6
store i16 %1, i16* %7
store i8 %2, i8* %8
store i8* %3, i8** %9
store i16 %4, i16* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @spi_bulkwrite(i8* nocapture readnone %0, i16 zeroext %1, i8 zeroext %2, i8* nocapture readnone %3, i16 zeroext %4) {
ret i32 0
}
char *my_epur_str(char *str) { return (str); }


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

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

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

LLVM IR (-O2):
define i8* @my_epur_str(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ _IOC(int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ _IOC_READ;
int ioctl(int, int /*<<< orphan*/, char *);
int CED_GetString(int fh, char *szText, int nMax) {
  return ioctl(fh, _IOC(_IOC_READ, 0xce, 8, nMax), szText);
}


x86 assembly (clang, -O0):
<CED_GetString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%ecx
mov    $0xce,%esi
mov    $0x8,%edx
call   1030 <_IOC@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1040 <ioctl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CED_GetString>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ecx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    $0xce,%esi
mov    $0x8,%edx
call   1030 <_IOC@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
@_IOC_READ = global i32 0
define i32 @CED_GetString(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* @_IOC_READ
%9 = load i32, i32* %6
%10 = call i32 @_IOC(i32 %8, i32 206, i32 8, i32 %9)
%11 = load i8*, i8** %5
%12 = call i32 @ioctl(i32 %7, i32 %10, i8* %11)
ret i32 %12
}

LLVM IR (-O2):
@_IOC_READ = global i32 0
define i32 @CED_GetString(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @_IOC_READ
%5 = tail call i32 @_IOC(i32 %4, i32 206, i32 8, i32 %2)
%6 = tail call i32 @ioctl(i32 %0, i32 %5, i8* %1)
ret i32 %6
}