xunge/DecIR huggingface dataset:
int dquot_writeback_dquots(struct super_block *sb, int type) { return 0; }


x86 assembly (clang, -O0):
<dquot_writeback_dquots>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.super_block = type opaque
define i32 @dquot_writeback_dquots(%struct.super_block* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
bool isLineAComment(const char *const line) { return line[0] == '#'; }


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

x86 assembly (clang, -O2):
<isLineAComment>:
xor    %eax,%eax
cmpb   $0x23,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @isLineAComment(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 35
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @isLineAComment(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 35
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int main(int /*<<< orphan*/, char const **);
int start_init_process(uint64_t argc, const char **argv) {
  return main(argc, argv);
}


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

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

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

LLVM IR (-O2):
define i32 @start_init_process(i32 %0, i8** %1) {
%3 = tail call i32 @main(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ write(int, char *, int);
void do_suspend(void) {
  int fd = open("/sys/power/state", O_RDWR);
  if (fd >= 0) {
    write(fd, "mem\n", 4);
    close(fd);
  } else
    sleep(5);
}


x86 assembly (clang, -O0):
<do_suspend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xea8(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     118b <do_suspend+0x4b>
mov    -0x4(%rbp),%edi
lea    0xe9d(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
jmp    1195 <do_suspend+0x55>
mov    $0x5,%edi
call   1060 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_suspend>:
push   %rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1050 <open@plt>
test   %eax,%eax
js     1177 <do_suspend+0x37>
mov    %eax,%ebx
lea    0xeae(%rip),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>
mov    $0x5,%edi
pop    %rbx
jmp    1060 <sleep@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"/sys/power/state\00"
@O_RDWR = global i32 0
@.str.1 = [5 x i8] c"mem\0A\00"
define void @do_suspend() {
%1 = alloca i32
%2 = load i32, i32* @O_RDWR
%3 = call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %2)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* %1
%8 = call i32 @write(i32 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%9 = load i32, i32* %1
%10 = call i32 @close(i32 %9)
br label %13
11: ; preds = %0
%12 = call i32 @sleep(i32 5)
br label %13
13: ; preds = %11, %6
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"/sys/power/state\00"
@O_RDWR = global i32 0
@.str.1 = [5 x i8] c"mem\0A\00"
define void @do_suspend() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 @write(i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%6 = tail call i32 @close(i32 %2)
br label %9
7: ; preds = %0
%8 = tail call i32 @sleep(i32 5)
br label %9
9: ; preds = %7, %4
ret void
}
unsigned xrop3_226_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T ^ D;
  stk2 = S & stk3;
  stk1 = D ^ stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_226_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_226_0_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
xor    $0xff,%eax
and    %ecx,%eax
xor    $0xff,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_226_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = xor i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %6
%27 = load i32, i32* %10
%28 = and i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
ret i32 %32
}

LLVM IR (-O2):
define i32 @xrop3_226_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, 255
%8 = and i32 %7, %4
%9 = xor i32 %8, 255
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ consolestr(char *);
int /*<<< orphan*/ logGC();
void vmemDumpHeap() {
  consolestr("HEAP\n----\n");
  logGC();
}


x86 assembly (clang, -O0):
<vmemDumpHeap>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <consolestr@plt>
mov    $0x0,%al
call   1040 <logGC@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmemDumpHeap>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <consolestr@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <logGC@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"HEAP\0A----\0A\00"
define void @vmemDumpHeap() {
%1 = call i32 @consolestr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @logGC()
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"HEAP\0A----\0A\00"
define void @vmemDumpHeap() {
%1 = tail call i32 @consolestr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @logGC()
ret void
}
int test_imm_DFint8_reg(signed char val) {
  return ((val) & (-0xDF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DFint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff21,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_DFint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -223
%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_DFint8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -223
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned long long int
unsignedlonglongint_ignoring_signedlong(unsigned long long int x,
                                        signed long y) {
  return x;
}


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

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

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

LLVM IR (-O2):
define i64 @unsignedlonglongint_ignoring_signedlong(i64 returned %0, i64 %1) {
ret i64 %0
}
void ff_hevc_put_hevc_bi_w_epel_h48_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_epel_h48_12_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ numJewelsInStones(char *, char *);
int main(int argc, const char *argv[]) {
  numJewelsInStones("aA", "aAAbbbb");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"aA\00"
@.str.1 = [8 x i8] c"aAAbbbb\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
%6 = call i32 @numJewelsInStones(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"aA\00"
@.str.1 = [8 x i8] c"aAAbbbb\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @numJewelsInStones(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
double libballistics_calcFT(double temperature, double altitude) {
  double Tstd = -0.0036 * altitude + 59.0;
  double FT = (temperature - Tstd) / (459.6 + Tstd);
  return FT;
}


x86 assembly (clang, -O0):
<libballistics_calcFT>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeed(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<libballistics_calcFT>:
mulsd  0xef8(%rip),%xmm1
addsd  0xef8(%rip),%xmm1
subsd  %xmm1,%xmm0
addsd  0xef4(%rip),%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @libballistics_calcFT(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %4
%8 = call double @llvm.fmuladd.f64(double -3.600000e-03, double %7, double 5.900000e+01)
store double %8, double* %5
%9 = load double, double* %3
%10 = load double, double* %5
%11 = fsub double %9, %10
%12 = load double, double* %5
%13 = fadd double 4.596000e+02, %12
%14 = fdiv double %11, %13
store double %14, double* %6
%15 = load double, double* %6
ret double %15
}

LLVM IR (-O2):
define double @libballistics_calcFT(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %1, double -3.600000e-03, double 5.900000e+01)
%4 = fsub double %0, %3
%5 = fadd double %3, 4.596000e+02
%6 = fdiv double %4, %5
ret double %6
}
void sync_set_bit(long nr, volatile unsigned long *addr) {
  asm volatile("lock; bts %1,%0"
               : "+m"((*(volatile long *)addr))
               : "Ir"(nr)
               : "memory");
}


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

x86 assembly (clang, -O2):
<sync_set_bit>:
lock bts %rdi,(%rsi)
ret

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

LLVM IR (-O2):
define void @sync_set_bit(i64 %0, i64* %1) {
tail call void asm sideeffect "lock; bts $1,$0", "=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i64 %0, i64* elementtype(i64) %1)
ret void
}
float calcula_imc(float peso, float altura) {
  float imc;
  imc = peso / (altura * altura);
  return imc;
}


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

x86 assembly (clang, -O2):
<calcula_imc>:
mulss  %xmm1,%xmm1
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @calcula_imc(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = load float, float* %4
%9 = fmul float %7, %8
%10 = fdiv float %6, %9
store float %10, float* %5
%11 = load float, float* %5
ret float %11
}

LLVM IR (-O2):
define float @calcula_imc(float %0, float %1) {
%3 = fmul float %1, %1
%4 = fdiv float %0, %3
ret float %4
}
void write_port(char *port_num, char val) { *port_num = val; }


x86 assembly (clang, -O0):
<write_port>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_port>:
mov    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @write_port(i8* nocapture writeonly %0, i8 signext %1) {
store i8 %1, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WINE_ERR(int /*<<< orphan*/);
void foo() { WINE_ERR(0); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <WINE_ERR@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %edi,%edi
jmp    1030 <WINE_ERR@plt>

LLVM IR (-O0):
define void @foo() {
%1 = call i32 @WINE_ERR(i32 0)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 @WINE_ERR(i32 0)
ret void
}
unsigned int readb(unsigned int addr) {
  return *((volatile unsigned char *)addr);
}


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

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

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

LLVM IR (-O2):
define i32 @readb(i32 %0) {
%2 = zext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = load volatile i8, i8* %3
%5 = zext i8 %4 to i32
ret i32 %5
}
void yy_1_MagicWord(char *yytext, int yyleng) {
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @yy_1_MagicWord(i8* nocapture %0, i32 %1) {
ret void
}
int check(const char *c) {
  if (c[0] == 'x')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
jne    1124 <check+0x24>
movl   $0x1,-0x4(%rbp)
jmp    112b <check+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
xor    %eax,%eax
cmpb   $0x78,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @check(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 120
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct StringTable {
  int dummy;
};

/* Variables and functions */
void *findString(struct StringTable *, int /*<<< orphan*/);
int /*<<< orphan*/ makeStringFromInt(int);
void *findInt(struct StringTable *st, int key) {
  return findString(st, makeStringFromInt(key));
}


x86 assembly (clang, -O0):
<findInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <makeStringFromInt@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <findString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findInt>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <makeStringFromInt@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <findString@plt>

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

LLVM IR (-O2):
%struct.StringTable = type { i32 }
define i8* @findInt(%struct.StringTable* %0, i32 %1) {
%3 = tail call i32 @makeStringFromInt(i32 %1)
%4 = tail call i8* @findString(%struct.StringTable* %0, i32 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ leseLongLong();
int /*<<< orphan*/ printf(char *);
int main() {
  leseLongLong();
  printf("--------Ende--------");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <leseLongLong@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"--------Ende--------\00"
define i32 @main() {
%1 = tail call i32 (...) @leseLongLong()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ PUT32(int, int);
void led_off(void) { PUT32(0x20200028, 1 << 16); }


x86 assembly (clang, -O0):
<led_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20200028,%edi
mov    $0x10000,%esi
call   1030 <PUT32@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_off>:
mov    $0x20200028,%edi
mov    $0x10000,%esi
jmp    1030 <PUT32@plt>

LLVM IR (-O0):
define void @led_off() {
%1 = call i32 @PUT32(i32 538968104, i32 65536)
ret void
}

LLVM IR (-O2):
define void @led_off() {
%1 = tail call i32 @PUT32(i32 538968104, i32 65536)
ret void
}
int is_aztec_solver(int solver) {
  if (solver >= 100 && solver <= 105) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_aztec_solver>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jl     1127 <is_aztec_solver+0x27>
cmpl   $0x69,-0x8(%rbp)
jg     1127 <is_aztec_solver+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <is_aztec_solver+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_aztec_solver>:
add    $0xffffff9c,%edi
xor    %eax,%eax
cmp    $0x6,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_aztec_solver(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 100
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 105
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_aztec_solver(i32 %0) {
%2 = add i32 %0, -100
%3 = icmp ult i32 %2, 6
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ atomic_add_uint64_t(int /*<<< orphan*/ *, int);
uint64_t atomic_inc_uint64_t(uint64_t *var) {
  return atomic_add_uint64_t(var, 1);
}


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

x86 assembly (clang, -O2):
<atomic_inc_uint64_t>:
mov    $0x1,%esi
jmp    1030 <atomic_add_uint64_t@plt>

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

LLVM IR (-O2):
define i32 @atomic_inc_uint64_t(i32* %0) {
%2 = tail call i32 @atomic_add_uint64_t(i32* %0, i32 1)
ret i32 %2
}
/* Variables and functions */
double exp(double);
double normal_density(double x) {
  return 1.12837916709551257390 / 2 / 1.41421356237309504880 * exp(-x * x / 2);
}


x86 assembly (clang, -O0):
<normal_density>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xec2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xea6(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normal_density>:
push   %rax
mulsd  %xmm0,%xmm0
mulsd  0xee3(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xede(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @normal_density(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = fdiv double %6, 2.000000e+00
%8 = call double @exp(double %7)
%9 = fmul double 0x3FD9884533D43650, %8
ret double %9
}

LLVM IR (-O2):
define double @normal_density(double %0) {
%2 = fneg double %0
%3 = fmul double %2, %0
%4 = fmul double %3, 5.000000e-01
%5 = tail call double @exp(double %4)
%6 = fmul double %5, 0x3FD9884533D43650
ret double %6
}
float i(float x) { return (x <= 0.f ? -1.f : 1.f); }


x86 assembly (clang, -O0):
<i>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeea(%rip),%xmm3
movss  0xee6(%rip),%xmm2
xorps  %xmm1,%xmm1
cmpless %xmm1,%xmm0
movaps %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<i>:
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
setae  %al
lea    0xeee(%rip),%rcx
movss  (%rcx,%rax,4),%xmm0
ret

LLVM IR (-O0):
define float @i(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp ole float %3, 0.000000e+00
%5 = zext i1 %4 to i64
%6 = select i1 %4, float -1.000000e+00, float 1.000000e+00
ret float %6
}

LLVM IR (-O2):
define float @i(float %0) {
%2 = fcmp ole float %0, 0.000000e+00
%3 = select i1 %2, float -1.000000e+00, float 1.000000e+00
ret float %3
}
int mps_message_send(struct mps_fifo *fifo, struct mps_message *msg) {}


x86 assembly (clang, -O0):
<mps_message_send>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mps_fifo = type opaque
%struct.mps_message = type opaque
define i32 @mps_message_send(%struct.mps_fifo* %0, %struct.mps_message* %1) {
%3 = alloca i32
%4 = alloca %struct.mps_fifo*
%5 = alloca %struct.mps_message*
store %struct.mps_fifo* %0, %struct.mps_fifo** %4
store %struct.mps_message* %1, %struct.mps_message** %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.mps_fifo = type opaque
%struct.mps_message = type opaque
define i32 @mps_message_send(%struct.mps_fifo* nocapture readnone %0, %struct.mps_message* nocapture readnone %1) {
ret i32 undef
}
/* Variables and functions */
int memcmp(void const *, void const *, int);
int long_cmp(const void *elt1, const void *elt2) {
  return memcmp(elt1, elt2, sizeof(long));
}


x86 assembly (clang, -O0):
<long_cmp>:
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,%edx
call   1030 <memcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_cmp>:
mov    $0x8,%edx
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @long_cmp(i8* %0, i8* %1) {
%3 = tail call i32 @memcmp(i8* %0, i8* %1, i32 8)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
scalar_t__ _mm_packs_pi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ abort();
void __attribute__((no))
check_packs_pi32(unsigned long long int src1, unsigned long long int src2,
                 unsigned long long int res_ref) {
  unsigned long long int res;
  res = (unsigned long long int)_mm_packs_pi32((__m64)src1, (__m64)src2);
  if (res != res_ref)
    abort();
}


x86 assembly (clang, -O0):
<check_packs_pi32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    %eax,%esi
call   1040 <_mm_packs_pi32@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     115e <check_packs_pi32+0x3e>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_packs_pi32>:
push   %rbx
mov    %rdx,%rbx
call   1040 <_mm_packs_pi32@plt>
cmp    %rbx,%rax
jne    1130 <check_packs_pi32+0x10>
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @check_packs_pi32(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %4
%9 = trunc i64 %8 to i32
%10 = load i64, i64* %5
%11 = trunc i64 %10 to i32
%12 = call i64 @_mm_packs_pi32(i32 %9, i32 %11)
store i64 %12, i64* %7
%13 = load i64, i64* %7
%14 = load i64, i64* %6
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @check_packs_pi32(i64 %0, i64 %1, i64 %2) {
%4 = trunc i64 %0 to i32
%5 = trunc i64 %1 to i32
%6 = tail call i64 @_mm_packs_pi32(i32 %4, i32 %5)
%7 = icmp eq i64 %6, %2
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %3
ret void
}
/* Variables and functions */
double sqrt(double);
double y_top(double x) { return sqrt(1.0 - x * x); }


x86 assembly (clang, -O0):
<y_top>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<y_top>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xee0(%rip),%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1133 <y_top+0x23>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @y_top(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fneg double %3
%6 = call double @llvm.fmuladd.f64(double %5, double %4, double 1.000000e+00)
%7 = call double @sqrt(double %6)
ret double %7
}

LLVM IR (-O2):
define double @y_top(double %0) {
%2 = fneg double %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double %0, double 1.000000e+00)
%4 = tail call double @sqrt(double %3)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ test3_g();
void test3_h(void) { test3_g(); }


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

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

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

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

/* Variables and functions */
int fgethex2(int /*<<< orphan*/ *);
int fgethex4(FILE *fp) {
  int hi, lo;
  hi = fgethex2(fp);
  lo = fgethex2(fp);
  return (hi << 8) | lo;
}


x86 assembly (clang, -O0):
<fgethex4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgethex2@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgethex2@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgethex4>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <fgethex2@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <fgethex2@plt>
shl    $0x8,%ebp
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fgethex4(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @fgethex2(i32* %5)
store i32 %6, i32* %3
%7 = load i32*, i32** %2
%8 = call i32 @fgethex2(i32* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = shl i32 %9, 8
%11 = load i32, i32* %4
%12 = or i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @fgethex4(i32* %0) {
%2 = tail call i32 @fgethex2(i32* %0)
%3 = tail call i32 @fgethex2(i32* %0)
%4 = shl i32 %2, 8
%5 = or i32 %4, %3
ret i32 %5
}
char ltou(char c) {
  if (c >= 'a' && c <= 'z')
    return c - 'a' + 'A';
  else
    return c;
}


x86 assembly (clang, -O0):
<ltou>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jl     1136 <ltou+0x36>
movsbl -0x2(%rbp),%eax
cmp    $0x7a,%eax
jg     1136 <ltou+0x36>
movsbl -0x2(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %al,-0x1(%rbp)
jmp    113c <ltou+0x3c>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltou>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @ltou(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 97
%15 = add nsw i32 %14, 65
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
br label %19
17: ; preds = %7, %1
%18 = load i8, i8* %3
store i8 %18, i8* %2
br label %19
19: ; preds = %17, %11
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @ltou(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *dstrset(char *oldstr, const char *newstr) {
  free(oldstr);
  return (char *)newstr;
}


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

x86 assembly (clang, -O2):
<dstrset>:
push   %rbx
mov    %rsi,%rbx
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @dstrset(i8* nocapture %0, i8* readnone returned %1) {
%3 = tail call i32 @free(i8* %0)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void *thread2(void *d) {
  int count2 = 1;
  while (count2 <= 3) {
    printf("Thread 2: %d\n", count2++);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<thread2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jg     1149 <thread2+0x39>
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
jmp    1123 <thread2+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread2>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Thread 2: %d\0A\00"
define i8* @thread2(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 3
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %4
11: ; preds = %4
ret i8* null
}

LLVM IR (-O2):
@.str = [14 x i8] c"Thread 2: %d\0A\00"
define noalias i8* @thread2(i8* nocapture readnone %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 3)
ret i8* null
}
decdhl(lower) int lower;
{
  if (lower)
    esc("#4");
  else
    esc("#3");
}


x86 assembly (clang, -O0):
<decdhl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1138 <decdhl+0x28>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <esc@plt>
jmp    1146 <decdhl+0x36>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <esc@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decdhl>:
test   %edi,%edi
lea    0xeea(%rip),%rax
lea    0xee0(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
jmp    1030 <esc@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"\00"
@.str.1 = [3 x i8] c"\00"
define i32 @decdhl(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @esc to i32 (i8*, ...)*)(i8* %3)
ret i32 undef
}
/* Type definitions */
struct json_object {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ json_object_new_string(char *);
int /*<<< orphan*/ json_object_object_add(struct json_object *, char *,
                                          int /*<<< orphan*/);
void controller_get_events(struct json_object *request,
                           struct json_object *response) {
  json_object_object_add(response, "result",
                         json_object_new_string("controller_get_events"));
}


x86 assembly (clang, -O0):
<controller_get_events>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xec8(%rip),%rdi
call   1030 <json_object_new_string@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xeaf(%rip),%rsi
call   1040 <json_object_object_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<controller_get_events>:
push   %rbx
mov    %rsi,%rbx
lea    0xedc(%rip),%rdi
call   1030 <json_object_new_string@plt>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
pop    %rbx
jmp    1040 <json_object_object_add@plt>

LLVM IR (-O0):
%struct.json_object = type { i32 }
@.str = [7 x i8] c"result\00"
@.str.1 = [22 x i8] c"controller_get_events\00"
define void @controller_get_events(%struct.json_object* %0, %struct.json_object* %1) {
%3 = alloca %struct.json_object*
%4 = alloca %struct.json_object*
store %struct.json_object* %0, %struct.json_object** %3
store %struct.json_object* %1, %struct.json_object** %4
%5 = load %struct.json_object*, %struct.json_object** %4
%6 = call i32 @json_object_new_string(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @json_object_object_add(%struct.json_object* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
%struct.json_object = type { i32 }
@.str = [7 x i8] c"result\00"
@.str.1 = [22 x i8] c"controller_get_events\00"
define void @controller_get_events(%struct.json_object* nocapture readnone %0, %struct.json_object* %1) {
%3 = tail call i32 @json_object_new_string(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @json_object_object_add(%struct.json_object* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Type definitions */
struct tcb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printsiginfo_at(struct tcb *, unsigned long);
int /*<<< orphan*/ printsignal(int);
int /*<<< orphan*/ tprints(char *);
void print_sigqueueinfo(struct tcb *tcp, int sig, unsigned long uinfo) {
  printsignal(sig);
  tprints(", ");
  printsiginfo_at(tcp, uinfo);
}


x86 assembly (clang, -O0):
<print_sigqueueinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <printsignal@plt>
lea    0xeae(%rip),%rdi
call   1050 <tprints@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <printsiginfo_at@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sigqueueinfo>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <printsignal@plt>
lea    0xeb8(%rip),%rdi
call   1050 <tprints@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printsiginfo_at@plt>

LLVM IR (-O0):
%struct.tcb = type { i32 }
@.str = [3 x i8] c", \00"
define void @print_sigqueueinfo(%struct.tcb* %0, i32 %1, i64 %2) {
%4 = alloca %struct.tcb*
%5 = alloca i32
%6 = alloca i64
store %struct.tcb* %0, %struct.tcb** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i32, i32* %5
%8 = call i32 @printsignal(i32 %7)
%9 = call i32 @tprints(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = load %struct.tcb*, %struct.tcb** %4
%11 = load i64, i64* %6
%12 = call i32 @printsiginfo_at(%struct.tcb* %10, i64 %11)
ret void
}

LLVM IR (-O2):
%struct.tcb = type { i32 }
@.str = [3 x i8] c", \00"
define void @print_sigqueueinfo(%struct.tcb* %0, i32 %1, i64 %2) {
%4 = tail call i32 @printsignal(i32 %1)
%5 = tail call i32 @tprints(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printsiginfo_at(%struct.tcb* %0, i64 %2)
ret void
}
int in_vlm_compat_mode() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @in_vlm_compat_mode() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ color(int);
int /*<<< orphan*/ io_hlt();
int /*<<< orphan*/ printk(char *);
void int_Divide_error(void) {
  color(0xff0000);
  printk("Divide error!!!");
  io_hlt();
}


x86 assembly (clang, -O0):
<int_Divide_error>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff0000,%edi
call   1050 <color@plt>
lea    0xebb(%rip),%rdi
call   1030 <printk@plt>
mov    $0x0,%al
call   1040 <io_hlt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_Divide_error>:
push   %rax
mov    $0xff0000,%edi
call   1050 <color@plt>
lea    0xebe(%rip),%rdi
call   1030 <printk@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <io_hlt@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Divide error!!!\00"
define void @int_Divide_error() {
%1 = call i32 @color(i32 16711680)
%2 = call i32 @printk(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @io_hlt()
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Divide error!!!\00"
define void @int_Divide_error() {
%1 = tail call i32 @color(i32 16711680)
%2 = tail call i32 @printk(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @io_hlt()
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compare(const void *p, const void *q) {
  const char **pp = (const char **)p;
  const char **qq = (const char **)q;
  return strcmp(*pp, *qq);
}


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

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

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
void rop3_112_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D & S;
  stk2 = ~stk2;
  stk1 = T & stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_112_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_112_0_1>:
mov    (%rdi),%r8b
mov    %r8d,%ecx
and    %sil,%cl
not    %cl
mov    %edx,%eax
and    %sil,%al
and    %cl,%al
not    %sil
and    %dl,%sil
and    %r8b,%sil
or     %al,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_112_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = and i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = and i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = and i32 %27, %29
%31 = load i8, i8* %7
%32 = zext i8 %31 to i32
%33 = load i8, i8* %6
%34 = zext i8 %33 to i32
%35 = xor i32 %34, -1
%36 = and i32 %32, %35
%37 = or i32 %30, %36
%38 = load i8, i8* %6
%39 = zext i8 %38 to i32
%40 = load i8, i8* %5
%41 = zext i8 %40 to i32
%42 = xor i32 %41, -1
%43 = and i32 %39, %42
%44 = load i8*, i8** %4
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = and i32 %43, %46
%48 = or i32 %37, %47
%49 = trunc i32 %48 to i8
%50 = load i8*, i8** %4
store i8 %49, i8* %50
ret void
}

LLVM IR (-O2):
define void @rop3_112_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
%6 = xor i8 %5, -1
%7 = and i8 %2, %1
%8 = and i8 %7, %6
%9 = xor i8 %1, -1
%10 = and i8 %9, %2
%11 = and i8 %10, %4
%12 = or i8 %8, %11
store i8 %12, i8* %0
ret void
}