xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ *Mem_Alloc(int);
int /*<<< orphan*/ Mem_Dump();
scalar_t__ Mem_Init(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  assert(Mem_Init(4096) == 0);
  assert(Mem_Alloc(4095) == NULL);
  Mem_Dump();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0xfff,%edi
call   1060 <Mem_Alloc@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1040 <Mem_Dump@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0xfff,%edi
call   1060 <Mem_Alloc@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1040 <Mem_Dump@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @Mem_Init(i32 4096)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32* @Mem_Alloc(i32 4095)
%7 = icmp eq i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 (...) @Mem_Dump()
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @Mem_Init(i32 4096)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32* @Mem_Alloc(i32 4095)
%6 = icmp eq i32* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 (...) @Mem_Dump()
%10 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ f1(char *, int);
int main() {
  f1("abc", 1);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
define i32 @main() {
%1 = tail call i32 @f1(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
void CRTFree(void *mm_context, void *ptr) {
  (void)(1 ? (void)0 : ((void)mm_context));
  free(ptr);
}


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

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

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

LLVM IR (-O2):
define void @CRTFree(i8* nocapture readnone %0, i8* nocapture %1) {
tail call void @free(i8* %1)
ret void
}
signed short GetMcGainReg(signed short swVol) {
  signed short swGain = (swVol + 128) / 256;
  signed short swRet = 3;
  if (swGain < 18) {
    swRet = 0;
  } else if (swGain < 23) {
    swRet = 1;
  } else if (swGain < 28) {
    swRet = 2;
  } else {
  }
  return swRet;
}


x86 assembly (clang, -O0):
<GetMcGainReg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x80,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %ax,-0x4(%rbp)
movw   $0x3,-0x6(%rbp)
movswl -0x4(%rbp),%eax
cmp    $0x12,%eax
jge    113e <GetMcGainReg+0x3e>
movw   $0x0,-0x6(%rbp)
jmp    117d <GetMcGainReg+0x7d>
movswl -0x4(%rbp),%eax
cmp    $0x17,%eax
jge    1156 <GetMcGainReg+0x56>
movw   $0x1,-0x6(%rbp)
jmp    1178 <GetMcGainReg+0x78>
movswl -0x4(%rbp),%eax
cmp    $0x1c,%eax
jge    116e <GetMcGainReg+0x6e>
movw   $0x2,-0x6(%rbp)
jmp    1173 <GetMcGainReg+0x73>
jmp    1173 <GetMcGainReg+0x73>
jmp    1178 <GetMcGainReg+0x78>
jmp    117d <GetMcGainReg+0x7d>
movswl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMcGainReg>:
cmp    $0x1180,%edi
jge    110b <GetMcGainReg+0xb>
xor    %eax,%eax
ret
movzwl %di,%ecx
mov    $0x1,%ax
cmp    $0x1680,%ecx
jb     1128 <GetMcGainReg+0x28>
cmp    $0x1b80,%ecx
mov    $0x3,%ax
sbb    $0x0,%ax
ret

LLVM IR (-O0):
define signext i16 @GetMcGainReg(i16 signext %0) {
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %2
%5 = load i16, i16* %2
%6 = sext i16 %5 to i32
%7 = add nsw i32 %6, 128
%8 = sdiv i32 %7, 256
%9 = trunc i32 %8 to i16
store i16 %9, i16* %3
store i16 3, i16* %4
%10 = load i16, i16* %3
%11 = sext i16 %10 to i32
%12 = icmp slt i32 %11, 18
br i1 %12, label %13, label %14
13: ; preds = %1
store i16 0, i16* %4
br label %27
14: ; preds = %1
%15 = load i16, i16* %3
%16 = sext i16 %15 to i32
%17 = icmp slt i32 %16, 23
br i1 %17, label %18, label %19
18: ; preds = %14
store i16 1, i16* %4
br label %26
19: ; preds = %14
%20 = load i16, i16* %3
%21 = sext i16 %20 to i32
%22 = icmp slt i32 %21, 28
br i1 %22, label %23, label %24
23: ; preds = %19
store i16 2, i16* %4
br label %25
24: ; preds = %19
br label %25
25: ; preds = %24, %23
br label %26
26: ; preds = %25, %18
br label %27
27: ; preds = %26, %13
%28 = load i16, i16* %4
ret i16 %28
}

LLVM IR (-O2):
define signext i16 @GetMcGainReg(i16 signext %0) {
%2 = icmp slt i16 %0, 4480
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = icmp ult i16 %0, 5760
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = icmp ult i16 %0, 7040
%7 = select i1 %6, i16 2, i16 3
br label %8
8: ; preds = %5, %3, %1
%9 = phi i16 [ 0, %1 ], [ 1, %3 ], [ %7, %5 ]
ret i16 %9
}
IR0RX1(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*p0) = (p1[x1]); }


x86 assembly (clang, -O0):
<IR0RX1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0RX1>:
movslq %esi,%rax
movss  (%rcx,%rax,4),%xmm0
movss  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define i32 @IR0RX1(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = load i32, i32* %11
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
%20 = load float, float* %19
%21 = load float*, float** %12
store float %20, float* %21
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @IR0RX1(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds float, float* %5, i64 %7
%9 = load float, float* %8
store float %9, float* %4
ret i32 undef
}
int test_imm_92int16_reg(short val) {
  return ((val) & (0x92 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_92int16_reg(i16 signext %0) {
%2 = and i16 %0, 146
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
void mainbis() { f(10); }


x86 assembly (clang, -O0):
<mainbis>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <f@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mainbis>:
mov    $0xa,%edi
jmp    1030 <f@plt>

LLVM IR (-O0):
define void @mainbis() {
%1 = call i32 @f(i32 10)
ret void
}

LLVM IR (-O2):
define void @mainbis() {
%1 = tail call i32 @f(i32 10)
ret void
}
/* Type definitions */
struct timeval {
  long long tv_usec;
  scalar_t__ tv_sec;
};
typedef int clock_t;

/* Variables and functions */
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
clock_t msclock(void) {
  long long int usecs;
  struct timeval tv;
  if (gettimeofday(&tv, NULL) == 1)
    return (-1);
  usecs = ((long long int)tv.tv_sec) * ((long long int)1000000) + tv.tv_usec;
  return ((clock_t)(usecs / (1000000 / 1000)));
}


x86 assembly (clang, -O0):
<msclock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x1,%eax
jne    113a <msclock+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115b <msclock+0x4b>
imul   $0xf4240,-0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msclock>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x1,%ecx
je     1157 <msclock+0x47>
imul   $0xf4240,0x10(%rsp),%rax
add    0x8(%rsp),%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
imul   %rcx
mov    %rdx,%rax
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x7,%rax
add    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i32 @msclock() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca %struct.timeval
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 -1, i32* %1
br label %17
7: ; preds = %0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%9 = load i64, i64* %8
%10 = mul nsw i64 %9, 1000000
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%12 = load i64, i64* %11
%13 = add nsw i64 %10, %12
store i64 %13, i64* %2
%14 = load i64, i64* %2
%15 = sdiv i64 %14, 1000
%16 = trunc i64 %15 to i32
store i32 %16, i32* %1
br label %17
17: ; preds = %7, %6
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @msclock() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i32 %3, 1
br i1 %4, label %14, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = mul nsw i64 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = add nsw i64 %8, %10
%12 = sdiv i64 %11, 1000
%13 = trunc i64 %12 to i32
br label %14
14: ; preds = %0, %5
%15 = phi i32 [ %13, %5 ], [ -1, %0 ]
ret i32 %15
}
void avpriv_new_chapter() {}


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

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

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

LLVM IR (-O2):
define void @avpriv_new_chapter() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void exit_with_user_message(const char *msg, const char *detail) {
  fputs(msg, stderr);
  fputs(": ", stderr);
  fputs(detail, stderr);
  fputc('\n', stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<exit_with_user_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
lea    0xe9e(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<exit_with_user_message>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x2ea2(%rip),%rbx
mov    (%rbx),%esi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xeb2(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c": \00"
define void @exit_with_user_message(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 i32, i32* @stderr
%7 = call i32 @fputs(i8* %5, i32 %6)
%8 = load i32, i32* @stderr
%9 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %4
%11 = load i32, i32* @stderr
%12 = call i32 @fputs(i8* %10, i32 %11)
%13 = load i32, i32* @stderr
%14 = call i32 @fputc(i8 signext 10, i32 %13)
%15 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c": \00"
define void @exit_with_user_message(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* %0, i32 %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* %1, i32 %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fputc(i8 signext 10, i32 %9)
%11 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_10166() {
  Assert_real((isqrt(10166) == 100),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              1490, ("Integer square root of 10166 should be 100"));
}


x86 assembly (clang, -O0):
<t_sqrt_10166>:
push   %rbp
mov    %rsp,%rbp
mov    $0x27b6,%edi
call   1030 <isqrt@plt>
cmp    $0x64,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x5d2,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_10166>:
push   %rax
mov    $0x27b6,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x5d2,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [43 x i8] c"Integer square root of 10166 should be 100\00"
define void @t_sqrt_10166() {
%1 = call i32 @isqrt(i32 10166)
%2 = icmp eq i32 %1, 100
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1490, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [43 x i8] c"Integer square root of 10166 should be 100\00"
define void @t_sqrt_10166() {
%1 = tail call i32 @isqrt(i32 10166)
%2 = icmp eq i32 %1, 100
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1490, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret void
}
char *strcpy(char *dst, const char *src) {
  char *ret = dst;
  while ((*dst++ = *src++))
    ;
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Variables and functions */
int random();
int rnd(int num) { return (random() % num); }


x86 assembly (clang, -O0):
<rnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rnd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @random()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @rnd(i32 %0) {
%2 = tail call i32 (...) @random()
%3 = srem i32 %2, %0
ret i32 %3
}
int length(char s[]) {
  int i;
  i = 0;
  while (s[i] != '\0')
    ++i;
  return i;
}


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

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

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

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
unsigned gf_mul(unsigned a, unsigned b) {
  unsigned r;
  r = 0;
  while (a) {
    if (a & 1)
      r ^= b;
    a >>= 1;
    b = (b << 1) ^ (b & 0x80 ? 0x11d : 0x00);
  }
  return r;
}


x86 assembly (clang, -O0):
<gf_mul>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1162 <gf_mul+0x62>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1133 <gf_mul+0x33>
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    -0x8(%rbp),%esi
and    $0x80,%esi
xor    %ecx,%ecx
mov    $0x11d,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <gf_mul+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_mul>:
xor    %eax,%eax
test   %edi,%edi
je     1136 <gf_mul+0x36>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
neg    %edx
and    %esi,%edx
xor    %edx,%eax
shr    %ecx
lea    (%rsi,%rsi,1),%edx
movsbl %sil,%esi
shr    $0x7,%esi
and    $0x11d,%esi
xor    %edx,%esi
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <gf_mul+0x10>
ret

LLVM IR (-O0):
define i32 @gf_mul(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = load i32, i32* %3
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = xor i32 %15, %14
store i32 %16, i32* %5
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* %3
%19 = lshr i32 %18, 1
store i32 %19, i32* %3
%20 = load i32, i32* %4
%21 = shl i32 %20, 1
%22 = load i32, i32* %4
%23 = and i32 %22, 128
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i32 285, i32 0
%27 = xor i32 %21, %26
store i32 %27, i32* %4
br label %6
28: ; preds = %6
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @gf_mul(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %19, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %17, %4 ], [ %1, %2 ]
%7 = phi i32 [ %12, %4 ], [ %0, %2 ]
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 %6
%11 = xor i32 %10, %5
%12 = lshr i32 %7, 1
%13 = shl i32 %6, 1
%14 = and i32 %6, 128
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i32 0, i32 285
%17 = xor i32 %16, %13
%18 = icmp ult i32 %7, 2
br i1 %18, label %19, label %4
19: ; preds = %4, %2
%20 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %20
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int lstat(char const *, struct stat *);
int fileLinkStat(const char *zPath, struct stat *pStatBuf) {
  return lstat(zPath, pStatBuf);
}


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

x86 assembly (clang, -O2):
<fileLinkStat>:
jmp    1030 <lstat@plt>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @fileLinkStat(i8* nocapture %0, %struct.stat* nocapture %1) {
%3 = tail call i32 @lstat(i8* %0, %struct.stat* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ emit_token(char *);
int /*<<< orphan*/ mark_forward_branch(int);
void emit_if(void) {
  emit_token("b?branch");
  mark_forward_branch(0xC57A901f);
}


x86 assembly (clang, -O0):
<emit_if>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <emit_token@plt>
mov    $0xc57a901f,%edi
call   1030 <mark_forward_branch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_if>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <emit_token@plt>
mov    $0xc57a901f,%edi
pop    %rax
jmp    1030 <mark_forward_branch@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"b?branch\00"
define void @emit_if() {
%1 = call i32 @emit_token(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @mark_forward_branch(i32 -981823457)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"b?branch\00"
define void @emit_if() {
%1 = tail call i32 @emit_token(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @mark_forward_branch(i32 -981823457)
ret void
}
void *gc_immediate(void *o) { return o; }


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

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

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

LLVM IR (-O2):
define i8* @gc_immediate(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int x;
  int n;
  if (!(x == 0 && n > 0))
    return 0;
  while (x < n) {
    x++;
  }
  assert(x == n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1133 <main+0x23>
cmpl   $0x0,-0xc(%rbp)
jg     113f <main+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1178 <main+0x68>
jmp    1144 <main+0x34>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115e <main+0x4e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x34>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_vector(int *a, int n) {
  for (int i = 0; i < n; i++)
    printf("%d ", a[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_vector+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_vector+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_vector(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%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 = [4 x i8] c"%d \00"
define void @print_vector(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void bold_on(void) { write(1, "\033[1m", 4); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[1m\00"
define void @bold_on() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[1m\00"
define void @bold_on() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, long, long);
int expect_val(long expected, long ret) {
  printf("\tVAL Expected %ld, Got %ld\n", expected, ret);
  fflush(NULL);
  if (ret == expected) {
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<expect_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <fflush@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1167 <expect_val+0x47>
movl   $0x0,-0x4(%rbp)
jmp    116e <expect_val+0x4e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_val>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
xor    %eax,%eax
cmp    %rbx,%r14
setne  %al
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\09VAL Expected %ld, Got %ld\0A\00"
define i32 @expect_val(i64 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %6, i64 %7)
%9 = call i32 @fflush(i32* null)
%10 = load i64, i64* %5
%11 = load i64, i64* %4
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %15
14: ; preds = %2
store i32 -1, i32* %3
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [28 x i8] c"\09VAL Expected %ld, Got %ld\0A\00"
define i32 @expect_val(i64 %0, i64 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %1)
%4 = tail call i32 @fflush(i32* null)
%5 = icmp ne i64 %1, %0
%6 = sext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int source_peek(char *);
int /*<<< orphan*/ source_skip();
int source_next(char *c) {
  source_skip();
  return source_peek(c);
}


x86 assembly (clang, -O0):
<source_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <source_skip@plt>
mov    -0x8(%rbp),%rdi
call   1030 <source_peek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<source_next>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <source_skip@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <source_peek@plt>

LLVM IR (-O0):
define i32 @source_next(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @source_skip()
%4 = load i8*, i8** %2
%5 = call i32 @source_peek(i8* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @source_next(i8* %0) {
%2 = tail call i32 (...) @source_skip()
%3 = tail call i32 @source_peek(i8* %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ irc_config_compute_nick_colors();
int /*<<< orphan*/ irc_config_set_nick_colors();
int irc_config_change_nick_colors_cb(void *data, const char *option,
                                     const char *value) {
  (void)data;
  (void)option;
  (void)value;
  irc_config_set_nick_colors();
  irc_config_compute_nick_colors();
  return 0;
}


x86 assembly (clang, -O0):
<irc_config_change_nick_colors_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <irc_config_set_nick_colors@plt>
mov    $0x0,%al
call   1030 <irc_config_compute_nick_colors@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @irc_config_change_nick_colors_cb(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 (...) @irc_config_set_nick_colors()
%11 = call i32 (...) @irc_config_compute_nick_colors()
ret i32 0
}

LLVM IR (-O2):
define i32 @irc_config_change_nick_colors_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 (...) @irc_config_set_nick_colors()
%5 = tail call i32 (...) @irc_config_compute_nick_colors()
ret i32 0
}
__attribute__((always_)) void native_clts(void) { asm volatile("clts"); }


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

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

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

LLVM IR (-O2):
define void @native_clts() {
tail call void asm sideeffect "clts", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mat4d_mult_vec4d_new(double *, double const *, double *);
void mat4d_mult_vec4d(double vector[4], const double matrix[16]) {
  mat4d_mult_vec4d_new(vector, matrix, vector);
}


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

x86 assembly (clang, -O2):
<mat4d_mult_vec4d>:
mov    %rdi,%rdx
jmp    1030 <mat4d_mult_vec4d_new@plt>

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

LLVM IR (-O2):
define void @mat4d_mult_vec4d(double* %0, double* %1) {
%3 = tail call i32 @mat4d_mult_vec4d_new(double* %0, double* %1, double* %0)
ret void
}
int silly_comp(void *elem, void *other) { return *(int *)elem - *(int *)other; }


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

x86 assembly (clang, -O2):
<silly_comp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @silly_comp(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @silly_comp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ oob_real();
void oob(int ignore) {
  (void)ignore;
  oob_real();
}


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

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

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

LLVM IR (-O2):
define void @oob(i32 %0) {
%2 = tail call i32 (...) @oob_real()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ moo();
main() { moo(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @moo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @moo()
ret i32 0
}
EndOfProgram() {}


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

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

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

LLVM IR (-O2):
define i32 @EndOfProgram() {
ret i32 undef
}
int No_Configuration(void) { return -1; }


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

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

LLVM IR (-O0):
define i32 @No_Configuration() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @No_Configuration() {
ret i32 -1
}
int dosomething(int a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @dosomething(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ determineType(float, float, float);
int /*<<< orphan*/ readCoefficients(float *, float *, float *);
int /*<<< orphan*/ showResult(int /*<<< orphan*/, float, float, float);
int main() {
  float a, b, c;
  readCoefficients(&a, &b, &c);
  showResult(determineType(a, b, c), a, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <readCoefficients@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
call   1050 <determineType@plt>
mov    %eax,%edi
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
call   1030 <showResult@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <readCoefficients@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
call   1050 <determineType@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
mov    %eax,%edi
call   1030 <showResult@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = call i32 @readCoefficients(float* %1, float* %2, float* %3)
%8 = load float, float* %1
%9 = load float, float* %2
%10 = load float, float* %3
%11 = call i32 @determineType(float %8, float %9, float %10)
%12 = load float, float* %1
%13 = load float, float* %2
%14 = load float, float* %3
%15 = call i32 @showResult(i32 %11, float %12, float %13, float %14)
ret i32 0
}
int main(int argc, char *argv[]) {
  do {
    asm goto("1:"
             ".byte 0xe9 \n\t .long 0\n\t"
             ".pushsection __jump_table,  \"a\" \n\t"
             " "
             ".quad"
             " "
             "1b, %l["
             "do_trace"
             "], %c0 \n\t"
             ".popsection \n\t"
             :
             : "i"("1")
             :
             : do_trace);
  } while (0);
  return 1;
do_trace:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
jmp    1117 <main+0x17>
jmp    111c <main+0x1c>
jmp    1121 <main+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1134 <main+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
jmp    110a <main+0xa>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %2
to label %7 [label %9]
7: ; preds = %6
br label %8
8: ; preds = %7
store i32 1, i32* %3
br label %10
9: ; preds = %6
store i32 0, i32* %3
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
to label %4 [label %3]
3: ; preds = %2
br label %4
4: ; preds = %2, %3
%5 = phi i32 [ 0, %3 ], [ 1, %2 ]
ret i32 %5
}
/* Variables and functions */
int S_IROTH;
int S_IRWXG;
int S_IRWXU;
int S_IXOTH;
int /*<<< orphan*/ mkdir(char const *, int);
int slate_CreateDirectory(const char *dirname) {
  return !mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}


x86 assembly (clang, -O0):
<slate_CreateDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
or     (%rax),%esi
mov    0x2e8f(%rip),%rax
or     (%rax),%esi
mov    0x2e9e(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slate_CreateDirectory>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e9e(%rip),%rax
or     (%rax),%esi
mov    0x2ead(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @slate_CreateDirectory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @S_IRWXU
%5 = load i32, i32* @S_IRWXG
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IROTH
%8 = or i32 %6, %7
%9 = load i32, i32* @S_IXOTH
%10 = or i32 %8, %9
%11 = call i32 @mkdir(i8* %3, i32 %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @slate_CreateDirectory(i8* nocapture %0) {
%2 = load i32, i32* @S_IRWXU
%3 = load i32, i32* @S_IRWXG
%4 = or i32 %3, %2
%5 = load i32, i32* @S_IROTH
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IXOTH
%8 = or i32 %6, %7
%9 = tail call i32 @mkdir(i8* %0, i32 %8)
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
void RTDirClose(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDirClose() {
ret void
}