xunge/DecIR huggingface dataset:
fatal(n) {
  write(1, "FATAL ERROR: ", 13);
  write(1, conv(n, 3, 10, ' '), 3);
  write(1, "\n", 1);
  exit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
lea    0xeb9(%rip),%rsi
mov    $0xd,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
mov    $0xa,%edx
mov    $0x20,%ecx
mov    $0x0,%al
call   1040 <conv@plt>
mov    %eax,%esi
mov    $0x1,%edi
mov    $0x3,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    $0x1,%edx
lea    0xe83(%rip),%rsi
mov    %edx,%edi
mov    $0x0,%al
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rsi
mov    $0x1,%edi
mov    $0xd,%edx
xor    %eax,%eax
call   1030 <write@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    $0xa,%edx
mov    $0x20,%ecx
xor    %eax,%eax
call   1040 <conv@plt>
mov    $0x1,%edi
mov    %eax,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <write@plt>
lea    0xe91(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"FATAL ERROR: \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @fatal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%4 = load i32, i32* %2
%5 = call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @conv to i32 (i32, i32, i32, i32, ...)*)(i32 %4, i32 3, i32 10, i32 32)
%6 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i32, i32, ...)*)(i32 1, i32 %5, i32 3)
%7 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"FATAL ERROR: \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @fatal(i32 %0) {
%2 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%3 = tail call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @conv to i32 (i32, i32, i32, i32, ...)*)(i32 %0, i32 3, i32 10, i32 32)
%4 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i32, i32, ...)*)(i32 1, i32 %3, i32 3)
%5 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
tail call void @exit(i32 1)
unreachable
}
long long zszs() { return 0x0000ffff0000ffffLL; }


x86 assembly (clang, -O0):
<zszs>:
push   %rbp
mov    %rsp,%rbp
movabs $0xffff0000ffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zszs>:
movabs $0xffff0000ffff,%rax
ret

LLVM IR (-O0):
define i64 @zszs() {
ret i64 281470681808895
}

LLVM IR (-O2):
define i64 @zszs() {
ret i64 281470681808895
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          int);
uint32_t load32_le(const uint8_t src[4]) {
  uint32_t w;
  memcpy(&w, src, sizeof w);
  return w;
}


x86 assembly (clang, -O0):
<load32_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load32_le>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @load32_le(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i32* %0, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
unsigned int constant_time_msb(unsigned int);
unsigned int constant_time_lt(unsigned int a, unsigned int b) {
  unsigned int lt;
  lt = ~(a ^ b) & (a - b);
  lt |= ~a & b;
  return constant_time_msb(lt);
}


x86 assembly (clang, -O0):
<constant_time_lt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <constant_time_msb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant_time_lt>:
mov    %edi,%eax
xor    %esi,%eax
not    %eax
mov    %edi,%ecx
sub    %esi,%ecx
and    %eax,%ecx
not    %edi
and    %esi,%edi
or     %ecx,%edi
jmp    1030 <constant_time_msb@plt>

LLVM IR (-O0):
define i32 @constant_time_lt(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 = xor i32 %6, %7
%9 = xor i32 %8, -1
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = sub i32 %10, %11
%13 = and i32 %9, %12
store i32 %13, i32* %5
%14 = load i32, i32* %3
%15 = xor i32 %14, -1
%16 = load i32, i32* %4
%17 = and i32 %15, %16
%18 = load i32, i32* %5
%19 = or i32 %18, %17
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = call i32 @constant_time_msb(i32 %20)
ret i32 %21
}

LLVM IR (-O2):
define i32 @constant_time_lt(i32 %0, i32 %1) {
%3 = xor i32 %0, %1
%4 = xor i32 %3, -1
%5 = sub i32 %0, %1
%6 = and i32 %5, %4
%7 = xor i32 %0, -1
%8 = and i32 %7, %1
%9 = or i32 %6, %8
%10 = tail call i32 @constant_time_msb(i32 %9)
ret i32 %10
}
int locationtest(unsigned int number, int i) {
  if (i < 0 || i > 32)
    return -1;
  unsigned int mask, result;
  mask = 1U << (i - 1);
  result = number & mask;
  return result == 0 ? 0 : 1;
}


x86 assembly (clang, -O0):
<locationtest>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     111e <locationtest+0x1e>
cmpl   $0x20,-0xc(%rbp)
jle    112a <locationtest+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <locationtest+0x56>
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<locationtest>:
lea    -0x1(%rsi),%ecx
shr    %cl,%edi
and    $0x1,%edi
cmp    $0x21,%esi
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @locationtest(i32 %0, i32 %1) {
%3 = icmp ugt i32 %1, 32
%4 = add nsw i32 %1, -1
%5 = lshr i32 %0, %4
%6 = and i32 %5, 1
%7 = select i1 %3, i32 -1, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ calc_rounds(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ init_core(unsigned char *, unsigned char const *,
                             unsigned char const *, unsigned char const *);
int crypto_core(unsigned char *out, const unsigned char *in,
                const unsigned char *k, const unsigned char *c) {
  unsigned char xj[128];
  init_core(xj, c, k, in);
  calc_rounds(xj, out, 20);
  return 0;
}


x86 assembly (clang, -O0):
<crypto_core>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
call   1030 <init_core@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x14,%edx
call   1040 <calc_rounds@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_core>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rcx,%rsi
mov    %rax,%rcx
call   1030 <init_core@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x14,%edx
call   1040 <calc_rounds@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @crypto_core(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [128 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %8
%12 = load i8*, i8** %7
%13 = load i8*, i8** %6
%14 = call i32 @init_core(i8* %10, i8* %11, i8* %12, i8* %13)
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%16 = load i8*, i8** %5
%17 = call i32 @calc_rounds(i8* %15, i8* %16, i32 20)
ret i32 0
}

LLVM IR (-O2):
define i32 @crypto_core(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [128 x i8]
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%7 = call i32 @init_core(i8* %6, i8* %3, i8* %2, i8* %1)
%8 = call i32 @calc_rounds(i8* %6, i8* %0, i32 20)
ret i32 0
}
/* Variables and functions */
int Maxi(int, int);
int Max3i(int a, int b, int c) { return Maxi(Maxi(a, b), c); }


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

x86 assembly (clang, -O2):
<Max3i>:
push   %rbx
mov    %edx,%ebx
call   1030 <Maxi@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <Maxi@plt>

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

LLVM IR (-O2):
define i32 @Max3i(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @Maxi(i32 %0, i32 %1)
%5 = tail call i32 @Maxi(i32 %4, i32 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ dbg(char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int);
int globerr(const char *epath, int eerrno) {
  dbg("%s: %s\n", epath, strerror(eerrno));
  return 0;
}


x86 assembly (clang, -O0):
<globerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <strerror@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xeb4(%rip),%rdi
call   1030 <dbg@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<globerr>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <strerror@plt>
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <dbg@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %s\0A\00"
define i32 @globerr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @strerror(i32 %6)
%8 = call i32 @dbg(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\0A\00"
define i32 @globerr(i8* %0, i32 %1) {
%3 = tail call i32 @strerror(i32 %1)
%4 = tail call i32 @dbg(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
ret i32 0
}
/* Variables and functions */
long exchange(long *, int);
int main() {
  long a = 4;
  long b = exchange(&a, 3);
  return a + b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x4,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <exchange@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x4,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1030 <exchange@plt>
add    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 4, i64* %2
%4 = call i64 @exchange(i64* %2, i32 3)
store i64 %4, i64* %3
%5 = load i64, i64* %2
%6 = load i64, i64* %3
%7 = add nsw i64 %5, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 4, i64* %1
%3 = call i64 @exchange(i64* %1, i32 3)
%4 = load i64, i64* %1
%5 = add nsw i64 %4, %3
%6 = trunc i64 %5 to i32
ret i32 %6
}
void cam_crate_zinit(const int c) {}


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

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

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

LLVM IR (-O2):
define void @cam_crate_zinit(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: wc [-l] [-w] [-c] <filelist>\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: wc [-l] [-w] [-c] <filelist>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: wc [-l] [-w] [-c] <filelist>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
scalar_t__ isdigit(unsigned char);
int dectoi(char c) {
  if (isdigit((unsigned char)c))
    return c - '0';
  else
    return -1;
}


x86 assembly (clang, -O0):
<dectoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1140 <dectoi+0x30>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <dectoi+0x37>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dectoi>:
push   %rbx
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <isdigit@plt>
add    $0xffffffd0,%ebx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @dectoi(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @isdigit(i8 zeroext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %2
br label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %12
12: ; preds = %11, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @dectoi(i8 signext %0) {
%2 = tail call i64 @isdigit(i8 zeroext %0)
%3 = icmp eq i64 %2, 0
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
/* Variables and functions */
bool int_equals(void *keyA, void *keyB) { return (keyA == keyB); }


x86 assembly (clang, -O0):
<int_equals>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_equals>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @int_equals(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 = load i8*, i8** %4
%7 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @int_equals(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ ungetch(char);
void ungets(char s[]) {
  int i;
  i = strlen(s);
  while (i > 0)
    ungetch(s[--i]);
}


x86 assembly (clang, -O0):
<ungets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1160 <ungets+0x40>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <ungetch@plt>
jmp    1138 <ungets+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ungets>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1157 <ungets+0x37>
mov    %eax,%ebx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
movsbl (%r14,%rax,1),%edi
call   1040 <ungetch@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1140 <ungets+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @ungets(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add nsw i64 %7, -1
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @ungetch(i8 signext %11)
%13 = icmp ugt i64 %7, 1
br i1 %13, label %6, label %14
14: ; preds = %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *mymalloc(size_t size) {
  void *tmp = malloc(size);
  if (tmp == NULL) {
    perror("malloc");
    exit(EXIT_FAILURE);
  }
  return tmp;
}


x86 assembly (clang, -O0):
<mymalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <mymalloc+0x3e>
lea    0xea5(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"malloc\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @mymalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *get_date(char *date) {
  time_t ts;
  ts = time(NULL);
  strftime(date, sizeof(char) * 35, "%a, %d %b %Y %X GMT", gmtime(&ts));
  return date;
}


x86 assembly (clang, -O0):
<get_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <gmtime@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%ecx
mov    $0x23,%esi
lea    0xe95(%rip),%rdx
call   1040 <strftime@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_date>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <gmtime@plt>
lea    0xeac(%rip),%rdx
mov    %rbx,%rdi
mov    $0x23,%esi
mov    %eax,%ecx
call   1040 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%a, %d %b %Y %X GMT\00"
define i8* @get_date(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @time(i32* null)
store i32 %4, i32* %3
%5 = load i8*, i8** %2
%6 = call i32 @gmtime(i32* %3)
%7 = call i32 @strftime(i8* %5, i32 35, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@.str = [20 x i8] c"%a, %d %b %Y %X GMT\00"
define i8* @get_date(i8* returned %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call i32 @gmtime(i32* %2)
%6 = call i32 @strftime(i8* %0, i32 35, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i8* %0
}
/* Variables and functions */
unsigned int sad_mx_n_simd(unsigned char const *, int, unsigned char const *,
                           int, unsigned int, int, int);
unsigned int vp8_sad16x8_simd(const unsigned char *src_ptr, int src_stride,
                              const unsigned char *ref_ptr, int ref_stride,
                              unsigned int max_sad) {
  return sad_mx_n_simd(src_ptr, src_stride, ref_ptr, ref_stride, max_sad, 16,
                       8);
}


x86 assembly (clang, -O0):
<vp8_sad16x8_simd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    $0x10,%r9d
movl   $0x8,(%rsp)
call   1030 <sad_mx_n_simd@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_sad16x8_simd>:
push   %rax
movl   $0x8,(%rsp)
mov    $0x10,%r9d
call   1030 <sad_mx_n_simd@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @vp8_sad16x8_simd(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @sad_mx_n_simd(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 16, i32 8)
ret i32 %6
}
/* Variables and functions */
int android_sensors_set(int, float, float, float);
int sensor_set(int sensorId, float a, float b, float c) {
  return android_sensors_set(sensorId, a, b, c);
}


x86 assembly (clang, -O0):
<sensor_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
call   1030 <android_sensors_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sensor_set>:
jmp    1030 <android_sensors_set@plt>

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

LLVM IR (-O2):
define i32 @sensor_set(i32 %0, float %1, float %2, float %3) {
%5 = tail call i32 @android_sensors_set(i32 %0, float %1, float %2, float %3)
ret i32 %5
}
int get_int(char *array) {
  return ((array[0] & 0xff) + ((array[1] << 8) & 0xff00) +
          ((array[2] << 16) & 0xff0000) + ((array[3] << 24) & 0xff000000));
}


x86 assembly (clang, -O0):
<get_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
and    $0xff0000,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
and    $0xff000000,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int>:
movzbl (%rdi),%eax
movzbl 0x1(%rdi),%ecx
shl    $0x8,%ecx
movzwl %cx,%ecx
or     %eax,%ecx
movzbl 0x2(%rdi),%eax
movzbl %al,%edx
shl    $0x10,%edx
or     %ecx,%edx
movzbl 0x3(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @get_int(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = and i32 %6, 255
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = and i32 %12, 65280
%14 = add nsw i32 %7, %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = shl i32 %18, 16
%20 = and i32 %19, 16711680
%21 = add nsw i32 %14, %20
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = shl i32 %25, 24
%27 = and i32 %26, -16777216
%28 = add i32 %21, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @get_int(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = shl nsw i32 %6, 8
%8 = and i32 %7, 65280
%9 = or i32 %8, %3
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = shl nsw i32 %12, 16
%14 = and i32 %13, 16711680
%15 = or i32 %9, %14
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl nuw i32 %18, 24
%20 = or i32 %15, %19
ret i32 %20
}
int iszero(int v, int *s) {
  if (v == 0)
    (*s)--;
}


x86 assembly (clang, -O0):
<iszero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1120 <iszero+0x20>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iszero>:
test   %edi,%edi
je     1105 <iszero+0x5>
ret
addl   $0xffffffff,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @iszero(i32 %0, i32* nocapture %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* %1
%6 = add nsw i32 %5, -1
store i32 %6, i32* %1
br label %7
7: ; preds = %4, %2
ret i32 undef
}
void HandleKey(int keycode, int bDown) {}


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

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

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

LLVM IR (-O2):
define void @HandleKey(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_fizzbuzz(char *);
int /*<<< orphan*/ set_fizzbuzz(int *, char *);
void run_fizzbuzz_until_with_buffer(int number, char *buffer) {
  int i;
  for (i = 1; i <= number; i++) {
    set_fizzbuzz(&i, buffer);
    print_fizzbuzz(buffer);
  }
}


x86 assembly (clang, -O0):
<run_fizzbuzz_until_with_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1166 <run_fizzbuzz_until_with_buffer+0x46>
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
call   1030 <set_fizzbuzz@plt>
mov    -0x10(%rbp),%rdi
call   1040 <print_fizzbuzz@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <run_fizzbuzz_until_with_buffer+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_fizzbuzz_until_with_buffer>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
test   %edi,%edi
jle    1162 <run_fizzbuzz_until_with_buffer+0x42>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xc(%rsp),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <set_fizzbuzz@plt>
mov    %rbx,%rdi
call   1040 <print_fizzbuzz@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
cmp    %ebp,%eax
jl     1140 <run_fizzbuzz_until_with_buffer+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @run_fizzbuzz_until_with_buffer(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 1, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = call i32 @set_fizzbuzz(i32* %5, i8* %11)
%13 = load i8*, i8** %4
%14 = call i32 @print_fizzbuzz(i8* %13)
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 @run_fizzbuzz_until_with_buffer(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%5 = icmp slt i32 %0, 1
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = call i32 @set_fizzbuzz(i32* %3, i8* %1)
%8 = call i32 @print_fizzbuzz(i8* %1)
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = icmp slt i32 %9, %0
br i1 %11, label %6, label %12
12: ; preds = %6, %2
ret void
}
char *strchr(const char *s, int c) {
  c &= 0xff;
  do {
    if (*s == c)
      return (char *)s;
    else
      s++;
  } while (*s);
  return 0;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1133 <strchr+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1159 <strchr+0x59>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <strchr+0x44>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1116 <strchr+0x16>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movzbl %sil,%ecx
mov    (%rdi),%dl
nopl   0x0(%rax)
movsbl %dl,%edx
cmp    %edx,%ecx
je     1125 <strchr+0x25>
movzbl 0x1(%rax),%edx
add    $0x1,%rax
test   %dl,%dl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = and i32 %1, 255
%4 = load i8, i8* %0
br label %5
5: ; preds = %10, %2
%6 = phi i8 [ %4, %2 ], [ %12, %10 ]
%7 = phi i8* [ %0, %2 ], [ %11, %10 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %3, %8
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %10, %5
%15 = phi i8* [ %7, %5 ], [ null, %10 ]
ret i8* %15
}
int f(x)
int x;
{ return x - x; }


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

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

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ rand();
unsigned int get_random_whole_number(void) {
  unsigned int random_number;
  random_number = (unsigned int)rand();
  return (random_number);
}


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

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

LLVM IR (-O0):
define i32 @get_random_whole_number() {
%1 = alloca i32
%2 = call i64 (...) @rand()
%3 = trunc i64 %2 to i32
store i32 %3, i32* %1
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @get_random_whole_number() {
%1 = tail call i64 (...) @rand()
%2 = trunc i64 %1 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ dobeep();
int getch();
int save_done();
int zz(void) {
  int c = getch();
  if (c != 'Z' && c != 'z') {
    dobeep();
    return 0;
  }
  return save_done();
}


x86 assembly (clang, -O0):
<zz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getch@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x5a,-0x8(%rbp)
je     1169 <zz+0x39>
cmpl   $0x7a,-0x8(%rbp)
je     1169 <zz+0x39>
mov    $0x0,%al
call   1030 <dobeep@plt>
movl   $0x0,-0x4(%rbp)
jmp    1173 <zz+0x43>
mov    $0x0,%al
call   1040 <save_done@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zz>:
push   %rax
xor    %eax,%eax
call   1050 <getch@plt>
and    $0xffffffdf,%eax
cmp    $0x5a,%eax
jne    1148 <zz+0x18>
xor    %eax,%eax
pop    %rcx
jmp    1040 <save_done@plt>
xor    %eax,%eax
call   1030 <dobeep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @zz() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getch()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 90
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 122
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @dobeep()
store i32 0, i32* %1
br label %13
11: ; preds = %6, %0
%12 = call i32 (...) @save_done()
store i32 %12, i32* %1
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
define i32 @zz() {
%1 = tail call i32 (...) @getch()
%2 = and i32 %1, -33
%3 = icmp eq i32 %2, 90
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (...) @dobeep()
br label %8
6: ; preds = %0
%7 = tail call i32 (...) @save_done()
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ 0, %4 ], [ %7, %6 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
__attribute__((always_)) void tu_clear_line(void) { fputs("\x1b[2K", stdout); }


x86 assembly (clang, -O0):
<tu_clear_line>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tu_clear_line>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2K\00"
@stdout = global i32 0
define void @tu_clear_line() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2K\00"
@stdout = global i32 0
define void @tu_clear_line() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
void error_init() {}


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

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

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

LLVM IR (-O2):
define void @error_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void printFileOpenError(char *filePath) {
  fprintf(stderr, "Could not open file: %s\n", filePath);
}


x86 assembly (clang, -O0):
<printFileOpenError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFileOpenError>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Could not open file: %s\0A\00"
define void @printFileOpenError(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Could not open file: %s\0A\00"
define void @printFileOpenError(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void myprint(int count, char *aa) {
  int k = 0;
  for (; k < count; k++, aa++)
    printf("%.2x ", (unsigned char)*aa);
  printf("\n");
}


x86 assembly (clang, -O0):
<myprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1161 <myprint+0x51>
mov    -0x10(%rbp),%rax
movzbl (%rax),%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1126 <myprint+0x16>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myprint>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1158 <myprint+0x38>
mov    %rsi,%r15
mov    %edi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1140 <myprint+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%.2x \00"
define void @myprint(i32 %0, i8* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ 0, %2 ]
%6 = phi i8* [ %11, %4 ], [ %1, %2 ]
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i32 %5, 1
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = icmp eq i32 %10, %0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
double MtoCM(double M) { return M * 100; }


x86 assembly (clang, -O0):
<MtoCM>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<MtoCM>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @MtoCM(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.000000e+02
ret double %4
}

LLVM IR (-O2):
define double @MtoCM(double %0) {
%2 = fmul double %0, 1.000000e+02
ret double %2
}
/* Variables and functions */
scalar_t__ floor(float);
float floorf(float x) { return (float)floor(x); }


x86 assembly (clang, -O0):
<floorf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <floor@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floorf>:
push   %rax
call   1030 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @floorf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @floor(float %3)
%5 = sitofp i64 %4 to float
ret float %5
}

LLVM IR (-O2):
define float @floorf(float %0) {
%2 = tail call i64 @floor(float %0)
%3 = sitofp i64 %2 to float
ret float %3
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int spi_disable_blockprotect_generic(struct flashrom_flashctx *, int, int, int,
                                     int);
int spi_disable_blockprotect_at2x_global_unprotect(
    struct flashrom_flashctx *flash) {
  return spi_disable_blockprotect_generic(flash, 0x0C, 1 << 7, 1 << 4, 0x00);
}


x86 assembly (clang, -O0):
<spi_disable_blockprotect_at2x_global_unprotect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xc,%esi
mov    $0x80,%edx
mov    $0x10,%ecx
xor    %r8d,%r8d
call   1030 <spi_disable_blockprotect_generic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_disable_blockprotect_at2x_global_unprotect>:
mov    $0xc,%esi
mov    $0x80,%edx
mov    $0x10,%ecx
xor    %r8d,%r8d
jmp    1030 <spi_disable_blockprotect_generic@plt>

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at2x_global_unprotect(%struct.flashrom_flashctx* %0) {
%2 = alloca %struct.flashrom_flashctx*
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %2
%3 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %2
%4 = call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %3, i32 12, i32 128, i32 16, i32 0)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at2x_global_unprotect(%struct.flashrom_flashctx* %0) {
%2 = tail call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %0, i32 12, i32 128, i32 16, i32 0)
ret i32 %2
}
int iabs(int a) { return a < 0 ? -a : a; }


x86 assembly (clang, -O0):
<iabs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <iabs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <iabs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @iabs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int LUMI_main(int, char **);
int main(int argc, char *argv[]) { return LUMI_main(argc, argv); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <LUMI_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <LUMI_main@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @LUMI_main(i32 %0, i8** %1)
ret i32 %3
}