xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ F_RDLCK;
int /*<<< orphan*/ F_SETLKW;
int get_file_lock(int, int /*<<< orphan*/, int /*<<< orphan*/);
int get_readw_lock(int fd) { return (get_file_lock(fd, F_SETLKW, F_RDLCK)); }


x86 assembly (clang, -O0):
<get_readw_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
call   1030 <get_file_lock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_readw_lock>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
jmp    1030 <get_file_lock@plt>

LLVM IR (-O0):
@F_SETLKW = global i32 0
@F_RDLCK = global i32 0
define i32 @get_readw_lock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETLKW
%5 = load i32, i32* @F_RDLCK
%6 = call i32 @get_file_lock(i32 %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@F_SETLKW = global i32 0
@F_RDLCK = global i32 0
define i32 @get_readw_lock(i32 %0) {
%2 = load i32, i32* @F_SETLKW
%3 = load i32, i32* @F_RDLCK
%4 = tail call i32 @get_file_lock(i32 %0, i32 %2, i32 %3)
ret i32 %4
}
int fossil_isalpha(char c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}


x86 assembly (clang, -O0):
<fossil_isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <fossil_isalpha+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    114e <fossil_isalpha+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <fossil_isalpha+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fossil_isalpha>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @fossil_isalpha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @fossil_isalpha(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
int fun311() { return 311; }


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

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

LLVM IR (-O0):
define i32 @fun311() {
ret i32 311
}

LLVM IR (-O2):
define i32 @fun311() {
ret i32 311
}
int main() {
  int age;
  if (3 >= 4) {
    3 + 4;
  } else {
    4 - 6;
  }
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void foo778(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo778(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void _irssi_deinit(void *data) { free(data); }


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

x86 assembly (clang, -O2):
<_irssi_deinit>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @_irssi_deinit(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void polf2s_(n, parray) int *n;
short parray[][2];
{ polf2s((long)*n, parray); }


x86 assembly (clang, -O0):
<polf2s_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <polf2s@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polf2s_>:
movslq (%rdi),%rdi
xor    %eax,%eax
jmp    1030 <polf2s@plt>

LLVM IR (-O0):
define void @polf2s_(i32* %0, [2 x i16]* %1) {
%3 = alloca i32*
%4 = alloca [2 x i16]*
store i32* %0, i32** %3
store [2 x i16]* %1, [2 x i16]** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = load [2 x i16]*, [2 x i16]** %4
%9 = call i32 (i64, [2 x i16]*, ...) bitcast (i32 (...)* @polf2s to i32 (i64, [2 x i16]*, ...)*)(i64 %7, [2 x i16]* %8)
ret void
}

LLVM IR (-O2):
define void @polf2s_(i32* nocapture %0, [2 x i16]* %1) {
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = tail call i32 (i64, [2 x i16]*, ...) bitcast (i32 (...)* @polf2s to i32 (i64, [2 x i16]*, ...)*)(i64 %4, [2 x i16]* %1)
ret void
}
/* Type definitions */
typedef unsigned long long time_t;

/* Variables and functions */
int /*<<< orphan*/ _SC_CLK_TCK;
unsigned long long sysconf(int /*<<< orphan*/);
time_t jiffy_to_sec(unsigned long long jiffy) {
  static unsigned long long clk_tck;
  if (clk_tck == 0)
    clk_tck = sysconf(_SC_CLK_TCK);
  return jiffy / clk_tck;
}


x86 assembly (clang, -O0):
<jiffy_to_sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,0x2f0c(%rip)
jne    113f <jiffy_to_sec+0x2f>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
mov    %rax,0x2ef1(%rip)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   0x2ee2(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jiffy_to_sec>:
push   %rbx
mov    %rdi,%rbx
mov    0x2f15(%rip),%rcx
test   %rcx,%rcx
jne    1138 <jiffy_to_sec+0x28>
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
mov    %rax,%rcx
mov    %rax,0x2ef8(%rip)
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     114e <jiffy_to_sec+0x3e>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
@jiffy_to_sec.clk_tck = internal global i64 0
@_SC_CLK_TCK = global i32 0
define i64 @jiffy_to_sec(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* @jiffy_to_sec.clk_tck
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @_SC_CLK_TCK
%7 = call i64 @sysconf(i32 %6)
store i64 %7, i64* @jiffy_to_sec.clk_tck
br label %8
8: ; preds = %5, %1
%9 = load i64, i64* %2
%10 = load i64, i64* @jiffy_to_sec.clk_tck
%11 = udiv i64 %9, %10
ret i64 %11
}

LLVM IR (-O2):
@jiffy_to_sec.clk_tck = internal unnamed_addr global i64 0
@_SC_CLK_TCK = global i32 0
define i64 @jiffy_to_sec(i64 %0) {
%2 = load i64, i64* @jiffy_to_sec.clk_tck
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @_SC_CLK_TCK
%6 = tail call i64 @sysconf(i32 %5)
store i64 %6, i64* @jiffy_to_sec.clk_tck
br label %7
7: ; preds = %4, %1
%8 = phi i64 [ %6, %4 ], [ %2, %1 ]
%9 = udiv i64 %0, %8
ret i64 %9
}
/* Variables and functions */
short rand_range(short, short);
short randomizeByPercent(short input, short percent) {
  return (
      rand_range(input * (100 - percent) / 100, input * (100 + percent) / 100));
}


x86 assembly (clang, -O0):
<randomizeByPercent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%edx
mov    $0x64,%ecx
sub    %edx,%ecx
imul   %ecx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %ax,%cx
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%edx
add    $0x64,%edx
imul   %edx,%eax
mov    $0x64,%esi
cltd
idiv   %esi
movswl %cx,%edi
movswl %ax,%esi
call   1030 <rand_range@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomizeByPercent>:
mov    $0x64,%eax
sub    %esi,%eax
imul   %edi,%eax
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x25,%rax
add    %ecx,%eax
add    $0x64,%esi
imul   %edi,%esi
movslq %esi,%rcx
imul   $0x51eb851f,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x25,%rcx
add    %edx,%ecx
movswl %ax,%edi
movswl %cx,%esi
jmp    1030 <rand_range@plt>

LLVM IR (-O0):
define signext i16 @randomizeByPercent(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = load i16, i16* %4
%8 = sext i16 %7 to i32
%9 = sub nsw i32 100, %8
%10 = mul nsw i32 %6, %9
%11 = sdiv i32 %10, 100
%12 = trunc i32 %11 to i16
%13 = load i16, i16* %3
%14 = sext i16 %13 to i32
%15 = load i16, i16* %4
%16 = sext i16 %15 to i32
%17 = add nsw i32 100, %16
%18 = mul nsw i32 %14, %17
%19 = sdiv i32 %18, 100
%20 = trunc i32 %19 to i16
%21 = call signext i16 @rand_range(i16 signext %12, i16 signext %20)
ret i16 %21
}

LLVM IR (-O2):
define signext i16 @randomizeByPercent(i16 signext %0, i16 signext %1) {
%3 = sext i16 %0 to i32
%4 = sext i16 %1 to i32
%5 = sub nsw i32 100, %4
%6 = mul nsw i32 %5, %3
%7 = sdiv i32 %6, 100
%8 = trunc i32 %7 to i16
%9 = add nsw i32 %4, 100
%10 = mul nsw i32 %9, %3
%11 = sdiv i32 %10, 100
%12 = trunc i32 %11 to i16
%13 = tail call signext i16 @rand_range(i16 signext %8, i16 signext %12)
ret i16 %13
}
/* Variables and functions */
int /*<<< orphan*/ load_cpu_nsec(int);
int map_to_cpuid(int);
int omp_get_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ omp_report_mask();
int main() {
  int nthrds, thrd, cpuid;
  int nsec = 10;
  int ierr;
#pragma omp parallel private(thrd, ierr)
  {
    thrd = omp_get_thread_num();
    nthrds = omp_get_num_threads();
    cpuid = thrd;
    ierr = map_to_cpuid(cpuid);
    omp_report_mask();
    load_cpu_nsec(nsec);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xa,-0x10(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <omp_get_num_threads@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <map_to_cpuid@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <omp_report_mask@plt>
mov    -0x10(%rbp),%edi
call   1070 <load_cpu_nsec@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
mov    %ebx,%edi
call   1040 <map_to_cpuid@plt>
xor    %eax,%eax
call   1060 <omp_report_mask@plt>
mov    $0xa,%edi
call   1070 <load_cpu_nsec@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 10, i32* %4
%6 = call i32 (...) @omp_get_thread_num()
store i32 %6, i32* %2
%7 = call i32 (...) @omp_get_num_threads()
store i32 %7, i32* %1
%8 = load i32, i32* %2
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @map_to_cpuid(i32 %9)
store i32 %10, i32* %5
%11 = call i32 (...) @omp_report_mask()
%12 = load i32, i32* %4
%13 = call i32 @load_cpu_nsec(i32 %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = tail call i32 (...) @omp_get_num_threads()
%3 = tail call i32 @map_to_cpuid(i32 %1)
%4 = tail call i32 (...) @omp_report_mask()
%5 = tail call i32 @load_cpu_nsec(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ disp_color_str(char *, int);
int /*<<< orphan*/ disp_str(char *);
void perror(char *msg) {
  disp_color_str("ERROR: ", 4);
  disp_str(msg);
  disp_str("       \n");
}


x86 assembly (clang, -O0):
<perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x4,%esi
call   1040 <disp_color_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <disp_str@plt>
lea    0xebb(%rip),%rdi
call   1030 <disp_str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perror>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x4,%esi
call   1040 <disp_color_str@plt>
mov    %rbx,%rdi
call   1030 <disp_str@plt>
lea    0xec4(%rip),%rdi
pop    %rbx
jmp    1030 <disp_str@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"ERROR: \00"
@.str.1 = [9 x i8] c" \0A\00"
define void @perror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @disp_color_str(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = load i8*, i8** %2
%5 = call i32 @disp_str(i8* %4)
%6 = call i32 @disp_str(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"ERROR: \00"
@.str.1 = [9 x i8] c" \0A\00"
define void @perror(i8* %0) {
%2 = tail call i32 @disp_color_str(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = tail call i32 @disp_str(i8* %0)
%4 = tail call i32 @disp_str(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned int MDIOPhyLinkStatusGet(unsigned int baseAddr) {
  return ((*((volatile unsigned int *)(baseAddr + (0xC)))));
}


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

x86 assembly (clang, -O2):
<MDIOPhyLinkStatusGet>:
add    $0xc,%edi
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @MDIOPhyLinkStatusGet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 12
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @MDIOPhyLinkStatusGet(i32 %0) {
%2 = add i32 %0, 12
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ cutCheckBankAccess(unsigned int, unsigned int, unsigned int,
                                      unsigned int, unsigned int, unsigned int,
                                      char *, int, char *, int);
void __cutilBankChecker(unsigned int tidx, unsigned int tidy, unsigned int tidz,
                        unsigned int bdimx, unsigned int bdimy,
                        unsigned int bdimz, char *aname, int index, char *file,
                        int line) {
  cutCheckBankAccess(tidx, tidy, tidz, bdimx, bdimy, bdimz, file, line, aname,
                     index);
}


x86 assembly (clang, -O0):
<__cutilBankChecker>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    0x20(%rbp),%rbx
mov    0x28(%rbp),%r11d
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%eax
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <cutCheckBankAccess@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cutilBankChecker>:
push   %rax
mov    0x28(%rsp),%r10d
mov    0x18(%rsp),%eax
push   %rax
push   0x18(%rsp)
push   %r10
push   0x38(%rsp)
call   1030 <cutCheckBankAccess@plt>
add    $0x20,%rsp
pop    %rax
ret

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

LLVM IR (-O2):
define void @__cutilBankChecker(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %6, i32 %7, i8* %8, i32 %9) {
%11 = tail call i32 @cutCheckBankAccess(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %8, i32 %9, i8* %6, i32 %7)
ret void
}
void wait_sem(int *sem) {
  while (*sem == 0) {
    ;
  }
  *sem = 0;
}


x86 assembly (clang, -O0):
<wait_sem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    111a <wait_sem+0x1a>
jmp    1108 <wait_sem+0x8>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_sem>:
movl   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @wait_sem(i32* nocapture %0) {
store i32 0, i32* %0
ret void
}
void clflush(void *line) { __asm volatile("clflush %0" ::"m"(line)); }


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

x86 assembly (clang, -O2):
<clflush>:
mov    %rdi,-0x8(%rsp)
clflush -0x8(%rsp)
ret

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

LLVM IR (-O2):
define void @clflush(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}
void *anna_blob_payload(void *blob) {
  int *res = (int *)blob;
  return (void *)&res[2];
}


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

x86 assembly (clang, -O2):
<anna_blob_payload>:
lea    0x8(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @anna_blob_payload(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 2
%8 = bitcast i32* %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @anna_blob_payload(i8* readnone %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 8
ret i8* %2
}
const char *ls_costN_nm3_name_out(int i) {
  switch (i) {
  case 0:
    return "o0";
  case 1:
    return "o1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<ls_costN_nm3_name_out>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <ls_costN_nm3_name_out+0x2b>
jmp    111a <ls_costN_nm3_name_out+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <ls_costN_nm3_name_out+0x3b>
jmp    114b <ls_costN_nm3_name_out+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_costN_nm3_name_out+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_costN_nm3_name_out+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm3_name_out>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @ls_costN_nm3_name_out(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @ls_costN_nm3_name_out(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
void forcePlanets(struct planet *thePlanets, double dt) {}


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

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

LLVM IR (-O0):
%struct.planet = type opaque
define void @forcePlanets(%struct.planet* %0, double %1) {
%3 = alloca %struct.planet*
%4 = alloca double
store %struct.planet* %0, %struct.planet** %3
store double %1, double* %4
ret void
}

LLVM IR (-O2):
%struct.planet = type opaque
define void @forcePlanets(%struct.planet* nocapture %0, double %1) {
ret void
}
/* Variables and functions */
scalar_t__ blueValue(unsigned short);
scalar_t__ greenValue(unsigned short);
scalar_t__ redValue(unsigned short);
int brightness(unsigned short c) {
  return ((int)redValue(c)) + ((int)greenValue(c)) + ((int)blueValue(c) >> 1);
}


x86 assembly (clang, -O0):
<brightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <redValue@plt>
mov    %eax,-0xc(%rbp)
movzwl -0x2(%rbp),%edi
call   1040 <greenValue@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
movzwl -0x2(%rbp),%edi
call   1050 <blueValue@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%eax
sar    $0x1,%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brightness>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
call   1030 <redValue@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1040 <greenValue@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    %ebp,%edi
call   1050 <blueValue@plt>
sar    %eax
add    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @brightness(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call i64 @redValue(i16 zeroext %3)
%5 = trunc i64 %4 to i32
%6 = load i16, i16* %2
%7 = call i64 @greenValue(i16 zeroext %6)
%8 = trunc i64 %7 to i32
%9 = add nsw i32 %5, %8
%10 = load i16, i16* %2
%11 = call i64 @blueValue(i16 zeroext %10)
%12 = trunc i64 %11 to i32
%13 = ashr i32 %12, 1
%14 = add nsw i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @brightness(i16 zeroext %0) {
%2 = tail call i64 @redValue(i16 zeroext %0)
%3 = trunc i64 %2 to i32
%4 = tail call i64 @greenValue(i16 zeroext %0)
%5 = trunc i64 %4 to i32
%6 = add nsw i32 %5, %3
%7 = tail call i64 @blueValue(i16 zeroext %0)
%8 = trunc i64 %7 to i32
%9 = ashr i32 %8, 1
%10 = add nsw i32 %6, %9
ret i32 %10
}
char GetEncoding9() { return 0x08; }


x86 assembly (clang, -O0):
<GetEncoding9>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetEncoding9>:
mov    $0x8,%al
ret

LLVM IR (-O0):
define signext i8 @GetEncoding9() {
ret i8 8
}

LLVM IR (-O2):
define signext i8 @GetEncoding9() {
ret i8 8
}
/* Variables and functions */
int golomb_iter_can_has(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @golomb_iter_can_has() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gpio_set_value(int, int /*<<< orphan*/);
void module_motor_off(void) { gpio_set_value(21, 0); }


x86 assembly (clang, -O0):
<module_motor_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x15,%edi
xor    %esi,%esi
call   1030 <gpio_set_value@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_motor_off>:
mov    $0x15,%edi
xor    %esi,%esi
jmp    1030 <gpio_set_value@plt>

LLVM IR (-O0):
define void @module_motor_off() {
%1 = call i32 @gpio_set_value(i32 21, i32 0)
ret void
}

LLVM IR (-O2):
define void @module_motor_off() {
%1 = tail call i32 @gpio_set_value(i32 21, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("sgrep -e pattern input\n");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"sgrep -e pattern input\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@str = [23 x i8] c"sgrep -e pattern input\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ stringReverse(char *);
int main() {
  char str[] = "Test String 3";
  stringReverse(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xed2(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0x12(%rbp),%rdi
call   1030 <stringReverse@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x3320676e697274,%rax
mov    %rax,0xe(%rsp)
movabs $0x7274532074736554,%rax
53 74 72
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <stringReverse@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.str = [14 x i8] c"Test String 3\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
store i32 0, i32* %1
%3 = bitcast [14 x i8]* %2 to i8*
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%5 = call i32 @stringReverse(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [14 x i8] c"Test String 3\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%3 = call i32 @stringReverse(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SPI2_DriverIRQHandler();
__attribute__((weak)) void SPI2_IRQHandler(void) { SPI2_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @SPI2_IRQHandler() {
%1 = call i32 (...) @SPI2_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @SPI2_IRQHandler() {
%1 = tail call i32 (...) @SPI2_DriverIRQHandler()
ret void
}
int _strcmp(char *s1, char *s2) {
  int i = 0;
  while (s1[i] == s2[i] && s1[i])
    i++;
  return (s1[i] - s2[i]);
}


x86 assembly (clang, -O0):
<_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rdx
movsbl (%rax,%rdx,1),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x15(%rbp)
jne    114d <_strcmp+0x4d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    115d <_strcmp+0x5d>
jmp    116b <_strcmp+0x6b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <_strcmp+0x13>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strcmp>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
test   %eax,%eax
je     1124 <_strcmp+0x24>
add    $0x1,%rcx
cmp    %dl,%al
je     1110 <_strcmp+0x10>
movsbl %dl,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @_strcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %30, %2
%7 = load i8*, i8** %3
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %12, %18
br i1 %19, label %20, label %28
20: ; preds = %6
%21 = load i8*, i8** %3
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br label %28
28: ; preds = %20, %6
%29 = phi i1 [ false, %6 ], [ %27, %20 ]
br i1 %29, label %30, label %33
30: ; preds = %28
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %6
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = load i8*, i8** %4
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = sub nsw i32 %39, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @_strcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %12, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %1, i64 %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %6, %8
%10 = icmp eq i8 %6, 0
%11 = or i1 %10, %9
%12 = add nuw i64 %4, 1
br i1 %11, label %13, label %3
13: ; preds = %3
%14 = sext i8 %6 to i32
%15 = sext i8 %8 to i32
%16 = sub nsw i32 %14, %15
ret i32 %16
}
/* Variables and functions */
char *very_ugly_ipv6_code(char *, int, int);
char *index6_id(char *ip, int bitmask) {
  return very_ugly_ipv6_code(ip, bitmask, 1);
}


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

x86 assembly (clang, -O2):
<index6_id>:
mov    $0x1,%edx
jmp    1030 <very_ugly_ipv6_code@plt>

LLVM IR (-O0):
define i8* @index6_id(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 i8* @very_ugly_ipv6_code(i8* %5, i32 %6, i32 1)
ret i8* %7
}

LLVM IR (-O2):
define i8* @index6_id(i8* %0, i32 %1) {
%3 = tail call i8* @very_ugly_ipv6_code(i8* %0, i32 %1, i32 1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void __free(void *ptr) {
  if (ptr)
    free(ptr);
}


x86 assembly (clang, -O0):
<__free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <__free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__free>:
test   %rdi,%rdi
je     111a <__free+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @__free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @__free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int mus_write(int, int, int, int, int **);
int write_sound(int tfd, int beg, int end, int chans, int **bufs) {
  return (mus_write(tfd, beg, end, chans, bufs));
}


x86 assembly (clang, -O0):
<write_sound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
call   1030 <mus_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_sound>:
jmp    1030 <mus_write@plt>

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

LLVM IR (-O2):
define i32 @write_sound(i32 %0, i32 %1, i32 %2, i32 %3, i32** %4) {
%6 = tail call i32 @mus_write(i32 %0, i32 %1, i32 %2, i32 %3, i32** %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Sys_Error(char *);
long write(int, void *, long);
void SafeWrite(int handle, void *buffer, long count) {
  if (write(handle, buffer, count) != count)
    Sys_Error("File write failure");
}


x86 assembly (clang, -O0):
<SafeWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <write@plt>
cmp    -0x18(%rbp),%rax
je     1159 <SafeWrite+0x39>
lea    0xeac(%rip),%rdi
call   1030 <Sys_Error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SafeWrite>:
push   %rbx
mov    %rdx,%rbx
call   1040 <write@plt>
cmp    %rbx,%rax
jne    1130 <SafeWrite+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
pop    %rbx
jmp    1030 <Sys_Error@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"File write failure\00"
define void @SafeWrite(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i64 @write(i32 %7, i8* %8, i64 %9)
%11 = load i64, i64* %6
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @Sys_Error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"File write failure\00"
define void @SafeWrite(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @write(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @Sys_Error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int RTFToToken(int, int, int, int);
int RTFExecuteToToken(int class, int major, int minor) {
  return RTFToToken(class, major, minor, 1);
}


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

x86 assembly (clang, -O2):
<RTFExecuteToToken>:
mov    $0x1,%ecx
jmp    1030 <RTFToToken@plt>

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

LLVM IR (-O2):
define i32 @RTFExecuteToToken(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @RTFToToken(i32 %0, i32 %1, i32 %2, i32 1)
ret i32 %4
}
int test_imm_33int32_reg(int val) { return ((val) & (0x33 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_33int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x33,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_33int32_reg(i32 %0) {
%2 = and i32 %0, 51
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int chkdirective(buf)
char *buf;
{
  int dirctvflg, i;
  for (i = dirctvflg = 0; (buf[i]) && (buf[i] != ';'); i++)
    if (buf[i] == ':') {
      dirctvflg = 1;
      break;
    }
  return dirctvflg;
}


x86 assembly (clang, -O0):
<chkdirective>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1145 <chkdirective+0x45>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1155 <chkdirective+0x55>
jmp    1189 <chkdirective+0x89>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    1176 <chkdirective+0x76>
movl   $0x1,-0xc(%rbp)
jmp    1189 <chkdirective+0x89>
jmp    117b <chkdirective+0x7b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <chkdirective+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chkdirective>:
movzbl (%rdi),%eax
test   %al,%al
je     1115 <chkdirective+0x15>
cmp    $0x3a,%al
je     1118 <chkdirective+0x18>
cmp    $0x3b,%al
je     1115 <chkdirective+0x15>
add    $0x1,%rdi
jmp    1100 <chkdirective>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @chkdirective(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i64 [ %7, %6 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %8
i8 59, label %8
i8 58, label %9
]
6: ; preds = %2
%7 = add nuw i64 %3, 1
br label %2
8: ; preds = %2, %2
br label %9
9: ; preds = %2, %8
%10 = phi i32 [ 0, %8 ], [ 1, %2 ]
ret i32 %10
}
/* Variables and functions */
int strcasecmp(char const *const, char const *const);
int name_cmp(const char *const *a, const char *const *b) {
  return strcasecmp(*a, *b);
}


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

x86 assembly (clang, -O2):
<name_cmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcasecmp@plt>

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

LLVM IR (-O2):
define i32 @name_cmp(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcasecmp(i8* %3, i8* %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, void *);
int /*<<< orphan*/ pthread_self();
void str_alloc_destroy_accu(void *accu) {
  printf("Thread %lx: freeing buffer at %p\n", pthread_self(), accu);
  free(accu);
}


x86 assembly (clang, -O0):
<str_alloc_destroy_accu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_alloc_destroy_accu>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xebe(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Thread %lx: freeing buffer at %p\0A\00"
define void @str_alloc_destroy_accu(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @pthread_self()
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Thread %lx: freeing buffer at %p\0A\00"
define void @str_alloc_destroy_accu(i8* %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %2, i8* %0)
%4 = tail call i32 @free(i8* %0)
ret void
}
int func(void) {
  int n = 3;
  int m = 5;
  n = ((1) ? (2) : (3));
  m = ((1) ?: (2));
  return 0;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @func() {
ret i32 0
}
/* Variables and functions */
int rand();
int ut_lRand(int limit) { return limit != 0 ? rand() % limit : 0; }


x86 assembly (clang, -O0):
<ut_lRand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1138 <ut_lRand+0x28>
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x8(%rbp)
jmp    1142 <ut_lRand+0x32>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <ut_lRand+0x32>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ut_lRand>:
test   %edi,%edi
je     1125 <ut_lRand+0x15>
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ut_lRand(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, %0
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
/* Type definitions */
struct hashtable {
  int dummy;
};

/* Variables and functions */
int ht_free(struct hashtable *, unsigned int);
int ht_search(struct hashtable *, void *, unsigned int *);
int ht_rm(struct hashtable *t, void *key) {
  int ret;
  unsigned int index;
  if ((ret = ht_search(t, key, &index)) != 1)
    return ret;
  return ht_free(t, index);
}


x86 assembly (clang, -O0):
<ht_rm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <ht_search@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x1,%eax
je     1158 <ht_rm+0x38>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <ht_rm+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <ht_free@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ht_rm>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rdx
call   1040 <ht_search@plt>
cmp    $0x1,%eax
jne    1143 <ht_rm+0x23>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <ht_free@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.hashtable = type { i32 }
define i32 @ht_rm(%struct.hashtable* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.hashtable*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store %struct.hashtable* %0, %struct.hashtable** %4
store i8* %1, i8** %5
%8 = load %struct.hashtable*, %struct.hashtable** %4
%9 = load i8*, i8** %5
%10 = call i32 @ht_search(%struct.hashtable* %8, i8* %9, i32* %7)
store i32 %10, i32* %6
%11 = icmp ne i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %6
store i32 %13, i32* %3
br label %18
14: ; preds = %2
%15 = load %struct.hashtable*, %struct.hashtable** %4
%16 = load i32, i32* %7
%17 = call i32 @ht_free(%struct.hashtable* %15, i32 %16)
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %12
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.hashtable = type { i32 }
define i32 @ht_rm(%struct.hashtable* %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @ht_search(%struct.hashtable* %0, i8* %1, i32* %3)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = call i32 @ht_free(%struct.hashtable* %0, i32 %8)
br label %10
10: ; preds = %2, %7
%11 = phi i32 [ %9, %7 ], [ %5, %2 ]
ret i32 %11
}