xunge/DecIR huggingface dataset:
unsigned int ft_get_double_len(double n, unsigned int precision) {
  unsigned int len;
  double x;
  len = 1;
  x = n;
  if (x < 1.0)
    len++;
  while (x >= 1) {
    len++;
    x /= 10.0;
  }
  return (len + precision + 1);
}


x86 assembly (clang, -O0):
<ft_get_double_len>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1139 <ft_get_double_len+0x39>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113e <ft_get_double_len+0x3e>
movsd  -0x18(%rbp),%xmm0
movsd  0xeb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1179 <ft_get_double_len+0x79>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe9d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113e <ft_get_double_len+0x3e>
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_get_double_len>:
movsd  0xef8(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
add    $0x1,%eax
ucomisd %xmm1,%xmm0
jb     113d <ft_get_double_len+0x3d>
movsd  0xee6(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%eax
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jae    1130 <ft_get_double_len+0x30>
add    %edi,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ft_get_double_len(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
store i32 1, i32* %5
%7 = load double, double* %3
store double %7, double* %6
%8 = load double, double* %6
%9 = fcmp olt double %8, 1.000000e+00
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* %5
%12 = add i32 %11, 1
store i32 %12, i32* %5
br label %13
13: ; preds = %10, %2
br label %14
14: ; preds = %17, %13
%15 = load double, double* %6
%16 = fcmp oge double %15, 1.000000e+00
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* %5
%19 = add i32 %18, 1
store i32 %19, i32* %5
%20 = load double, double* %6
%21 = fdiv double %20, 1.000000e+01
store double %21, double* %6
br label %14
22: ; preds = %14
%23 = load i32, i32* %5
%24 = load i32, i32* %4
%25 = add i32 %23, %24
%26 = add i32 %25, 1
ret i32 %26
}

LLVM IR (-O2):
define i32 @ft_get_double_len(double %0, i32 %1) {
%3 = fcmp olt double %0, 1.000000e+00
%4 = select i1 %3, i32 2, i32 1
%5 = fcmp ult double %0, 1.000000e+00
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi double [ %10, %6 ], [ %0, %2 ]
%8 = phi i32 [ %9, %6 ], [ %4, %2 ]
%9 = add i32 %8, 1
%10 = fdiv double %7, 1.000000e+01
%11 = fcmp ult double %10, 1.000000e+00
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = phi i32 [ %4, %2 ], [ %9, %6 ]
%14 = add i32 %13, 1
%15 = add i32 %14, %1
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void amaret_local_A1_toggle__E() { printf("Pin.toggle\n"); }


x86 assembly (clang, -O0):
<amaret_local_A1_toggle__E>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<amaret_local_A1_toggle__E>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Pin.toggle\0A\00"
define void @amaret_local_A1_toggle__E() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [11 x i8] c"Pin.toggle\00"
define void @amaret_local_A1_toggle__E() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello World!, 日本語テスト\n");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"Hello World!, \E6\97\A5\E6\9C\AC\E8\AA\9E\E3\83\86\E3\82\B9\E3\83\88\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [33 x i8] c"Hello World!, \E6\97\A5\E6\9C\AC\E8\AA\9E\E3\83\86\E3\82\B9\E3\83\88\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret i32 0
}
long div_ceil(long dividend, long divisor) {
  return (dividend + divisor - 1) / divisor;
}


x86 assembly (clang, -O0):
<div_ceil>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    $0x1,%rax
cqto
idivq  -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<div_ceil>:
lea    (%rdi,%rsi,1),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     111a <div_ceil+0x1a>
cqto
idiv   %rsi
ret
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
define i64 @div_ceil(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
%6 = load i64, i64* %4
%7 = add nsw i64 %5, %6
%8 = sub nsw i64 %7, 1
%9 = load i64, i64* %4
%10 = sdiv i64 %8, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @div_ceil(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = sdiv i64 %4, %1
ret i64 %5
}
int gbspos2row(pos)
int pos;
{ return (1 + (pos / 64)); }


x86 assembly (clang, -O0):
<gbspos2row>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gbspos2row>:
lea    0x3f(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x6,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @gbspos2row(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 64
%5 = add nsw i32 1, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @gbspos2row(i32 %0) {
%2 = sdiv i32 %0, 64
%3 = add nsw i32 %2, 1
ret i32 %3
}
long double test_tanhl(long double x) { return __builtin_tanhl(x); }


x86 assembly (clang, -O0):
<test_tanhl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <tanhl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_tanhl>:
jmp    1030 <tanhl@plt>

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

LLVM IR (-O2):
define x86_fp80 @test_tanhl(x86_fp80 %0) {
%2 = tail call x86_fp80 @tanhl(x86_fp80 %0)
ret x86_fp80 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void merror(void *ptr, char *what) {
  if (ptr)
    return;
  fprintf(stderr, "Not enough memory for %s\n", what);
  exit(1);
}


x86 assembly (clang, -O0):
<merror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1141 <merror+0x21>
add    $0x10,%rsp
pop    %rbp
ret
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xeab(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<merror>:
test   %rdi,%rdi
je     1126 <merror+0x6>
ret
push   %rax
mov    %rsi,%rdx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Not enough memory for %s\0A\00"
define void @merror(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %2
ret void
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %4
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Not enough memory for %s\0A\00"
define void @merror(i8* readnone %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %5, label %4
4: ; preds = %2
ret void
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ log_init(char *);
void amf_comp_init(void) { log_init("AMF"); }


x86 assembly (clang, -O0):
<amf_comp_init>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <log_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<amf_comp_init>:
lea    0xee9(%rip),%rdi
jmp    1030 <log_init@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"AMF\00"
define void @amf_comp_init() {
%1 = tail call i32 @log_init(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void helpAndLeave(const char *progname, int status) {
  fprintf(stderr, "Usage: %s <file>\n", progname);
  exit(status);
}


x86 assembly (clang, -O0):
<helpAndLeave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<helpAndLeave>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %4
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ lasvm_error(char *);
void *malloc(int);
void *xmalloc(int n) {
  void *p = malloc(n);
  if (!p)
    lasvm_error("Function malloc() has returned NULL.\n");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114e <xmalloc+0x2e>
lea    0xeb7(%rip),%rdi
call   1040 <lasvm_error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <lasvm_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Function malloc() has returned NULL.\0A\00"
define i8* @xmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @lasvm_error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [38 x i8] c"Function malloc() has returned NULL.\0A\00"
define noalias i8* @xmalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @lasvm_error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int func(int, int *);
int main() {
  int asdf = 3;
  int t1 = asdf;
  int t2 = func(4, &asdf);
  int t3 = asdf;
  return t1 + t2 + t3;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edi
call   1030 <func@plt>
mov    0x4(%rsp),%ecx
add    %ecx,%eax
add    $0x3,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 3, i32* %1
%3 = call i32 @func(i32 4, i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %3, 3
%6 = add nsw i32 %5, %4
ret i32 %6
}
unsigned char nand_read_one_byte(void) {
  return (*(volatile unsigned char *)0x4E000010) & 0xff;
}


x86 assembly (clang, -O0):
<nand_read_one_byte>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4e000010,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0xff,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_read_one_byte>:
mov    0x4e000010,%al
ret

LLVM IR (-O0):
define zeroext i8 @nand_read_one_byte() {
%1 = load volatile i8, i8* inttoptr (i64 1308622864 to i8*)
%2 = zext i8 %1 to i32
%3 = and i32 %2, 255
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define zeroext i8 @nand_read_one_byte() {
%1 = load volatile i8, i8* inttoptr (i64 1308622864 to i8*)
ret i8 %1
}
/* Variables and functions */
int lsmdb_cursor_cmp(void *const, void *const, int);
int lsmdb_cursor_cmp_rev(void *const a, void *const b) {
  return lsmdb_cursor_cmp(a, b, -1);
}


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

x86 assembly (clang, -O2):
<lsmdb_cursor_cmp_rev>:
mov    $0xffffffff,%edx
jmp    1030 <lsmdb_cursor_cmp@plt>

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

LLVM IR (-O2):
define i32 @lsmdb_cursor_cmp_rev(i8* %0, i8* %1) {
%3 = tail call i32 @lsmdb_cursor_cmp(i8* %0, i8* %1, i32 -1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ lgen(char *, char *, int);
void cgldsw(int n) { lgen("%s\t%c%d,%%eax", "movl", n); }


x86 assembly (clang, -O0):
<cgldsw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <lgen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgldsw>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xeee(%rip),%rsi
jmp    1030 <lgen@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%s\09%c%d,%%eax\00"
@.str.1 = [5 x i8] c"movl\00"
define void @cgldsw(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @lgen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s\09%c%d,%%eax\00"
@.str.1 = [5 x i8] c"movl\00"
define void @cgldsw(i32 %0) {
%2 = tail call i32 @lgen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool ComparatorValueGet(uint32_t ui32Base, uint32_t ui32Comp) {
  ;
  ;
  if ((*((volatile uint32_t *)(ui32Base + (ui32Comp * 0x20) + 0x00000020))) &
      0x00000002) {
    return (true);
  } else {
    return (false);
  }
}


x86 assembly (clang, -O0):
<ComparatorValueGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x5,%ecx
add    %ecx,%eax
add    $0x20,%eax
cltq
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1134 <ComparatorValueGet+0x34>
movl   $0x1,-0x4(%rbp)
jmp    113b <ComparatorValueGet+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorValueGet>:
shl    $0x5,%esi
lea    (%rdi,%rsi,1),%eax
add    $0x20,%eax
cltq
mov    (%rax),%eax
shr    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ComparatorValueGet(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = mul nsw i32 %7, 32
%9 = add nsw i32 %6, %8
%10 = add nsw i32 %9, 32
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
%14 = and i32 %13, 2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 1, i32* %3
br label %18
17: ; preds = %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @ComparatorValueGet(i32 %0, i32 %1) {
%3 = shl nsw i32 %1, 5
%4 = add i32 %0, 32
%5 = add i32 %4, %3
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = lshr i32 %8, 1
%10 = and i32 %9, 1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
extern void PrintFixString(char *s, int len) {
  int i;
  for (i = 0; i < len; i++) {
    if (*s == 0) {
      putchar('.');
    } else {
      putchar(*s);
    }
    s++;
  }
}


x86 assembly (clang, -O0):
<PrintFixString>:
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    1177 <PrintFixString+0x67>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1151 <PrintFixString+0x41>
mov    $0x2e,%edi
call   1030 <putchar@plt>
jmp    115d <PrintFixString+0x4d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <PrintFixString+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintFixString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    114b <PrintFixString+0x3b>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
mov    $0x2e,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%eax
test   %al,%al
cmove  %ebp,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <PrintFixString+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @PrintFixString(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %24, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %27
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 @putchar(i8 signext 46)
br label %21
17: ; preds = %10
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = call i32 @putchar(i8 signext %19)
br label %21
21: ; preds = %17, %15
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
br label %24
24: ; preds = %21
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %6
27: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @PrintFixString(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2, %4
%5 = phi i32 [ %12, %4 ], [ 0, %2 ]
%6 = phi i8* [ %11, %4 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = select i1 %8, i8 46, i8 %7
%10 = tail call i32 @putchar(i8 signext %9)
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = add nuw nsw i32 %5, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %4
14: ; preds = %4, %2
ret void
}
int odd(int n) {
  if (n % 2 != 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<odd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1127 <odd+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <odd+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<odd>:
mov    %edi,%eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @odd(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ TOSH_MAKE_GIO3_OUTPUT();
void HUMIDITY_MAKE_DATA_OUTPUT() { TOSH_MAKE_GIO3_OUTPUT(); }


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

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

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

LLVM IR (-O2):
define void @HUMIDITY_MAKE_DATA_OUTPUT() {
%1 = tail call i32 (...) @TOSH_MAKE_GIO3_OUTPUT()
ret void
}
/* Variables and functions */
int mus_big_endian_int(unsigned char *);
int mus_little_endian_int(unsigned char *);
int big_or_little_endian_int(unsigned char *n, int little) {
  if (little)
    return (mus_little_endian_int(n));
  return (mus_big_endian_int(n));
}


x86 assembly (clang, -O0):
<big_or_little_endian_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     114a <big_or_little_endian_int+0x2a>
mov    -0x10(%rbp),%rdi
call   1040 <mus_little_endian_int@plt>
mov    %eax,-0x4(%rbp)
jmp    1156 <big_or_little_endian_int+0x36>
mov    -0x10(%rbp),%rdi
call   1030 <mus_big_endian_int@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big_or_little_endian_int>:
test   %esi,%esi
je     1129 <big_or_little_endian_int+0x9>
jmp    1040 <mus_little_endian_int@plt>
jmp    1030 <mus_big_endian_int@plt>

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

LLVM IR (-O2):
define i32 @big_or_little_endian_int(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @mus_little_endian_int(i8* %0)
br label %8
6: ; preds = %2
%7 = tail call i32 @mus_big_endian_int(i8* %0)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ digitalWrite(int, int);
void glow(int pin, int time) {
  digitalWrite(pin, time);
  delay(time);
  digitalWrite(pin, time);
}


x86 assembly (clang, -O0):
<glow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <digitalWrite@plt>
mov    -0x8(%rbp),%edi
call   1040 <delay@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <digitalWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glow>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <digitalWrite@plt>
mov    %ebx,%edi
call   1040 <delay@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <digitalWrite@plt>

LLVM IR (-O0):
define void @glow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @digitalWrite(i32 %5, i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @delay(i32 %8)
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @digitalWrite(i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
define void @glow(i32 %0, i32 %1) {
%3 = tail call i32 @digitalWrite(i32 %0, i32 %1)
%4 = tail call i32 @delay(i32 %1)
%5 = tail call i32 @digitalWrite(i32 %0, i32 %1)
ret void
}
void test_flipper_free_world() { return; }


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

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

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

LLVM IR (-O2):
define void @test_flipper_free_world() {
ret void
}
__attribute__((always_)) int raw_irqs_disabled_flags(unsigned long flags) {
  return !(flags & 0x00000200);
}


x86 assembly (clang, -O0):
<raw_irqs_disabled_flags>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x200,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_irqs_disabled_flags>:
xor    %eax,%eax
test   $0x200,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @raw_irqs_disabled_flags(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 512
%5 = icmp ne i64 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @raw_irqs_disabled_flags(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i32 %2, 9
%4 = and i32 %3, 1
%5 = xor i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello(void) { printf("Hello, world.\n"); }


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, world.\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, world.\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct iphdr {
  int /*<<< orphan*/ protocol;
};
typedef int /*<<< orphan*/ __u8;
typedef int __u64;

/* Variables and functions */
__u8 get_ip_protocol(void *pkt, void *end, __u64 offset) {
  struct iphdr *ip = pkt + offset;
  if (pkt + offset + sizeof(*ip) > end)
    return 0;
  return ip->protocol;
}


x86 assembly (clang, -O0):
<get_ip_protocol>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
add    $0x4,%rax
cmp    -0x18(%rbp),%rax
jbe    1143 <get_ip_protocol+0x43>
movl   $0x0,-0x4(%rbp)
jmp    114c <get_ip_protocol+0x4c>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ip_protocol>:
movslq %edx,%rcx
lea    (%rdi,%rcx,1),%rdx
add    $0x4,%rdx
xor    %eax,%eax
cmp    %rsi,%rdx
ja     1117 <get_ip_protocol+0x17>
add    %rcx,%rdi
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.iphdr = type { i32 }
define i32 @get_ip_protocol(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.iphdr*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = getelementptr i8, i8* %9, i64 %11
%13 = bitcast i8* %12 to %struct.iphdr*
store %struct.iphdr* %13, %struct.iphdr** %8
%14 = load i8*, i8** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr i8, i8* %14, i64 %16
%18 = getelementptr i8, i8* %17, i64 4
%19 = load i8*, i8** %6
%20 = icmp ugt i8* %18, %19
br i1 %20, label %21, label %22
21: ; preds = %3
store i32 0, i32* %4
br label %26
22: ; preds = %3
%23 = load %struct.iphdr*, %struct.iphdr** %8
%24 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %23, i32 0, i32 0
%25 = load i32, i32* %24
store i32 %25, i32* %4
br label %26
26: ; preds = %22, %21
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @get_ip_protocol(i8* %0, i8* readnone %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr i8, i8* %0, i64 %4
%6 = getelementptr i8, i8* %5, i64 4
%7 = icmp ugt i8* %6, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = bitcast i8* %5 to i32*
%10 = load i32, i32* %9
br label %11
11: ; preds = %3, %8
%12 = phi i32 [ %10, %8 ], [ 0, %3 ]
ret i32 %12
}
/* Type definitions */
struct item_head {
  int dummy;
};

/* Variables and functions */
int ih_item_len(struct item_head *);
int direct_bytes_number(struct item_head *ih, int block_size) {
  return ih_item_len(ih);
}


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

x86 assembly (clang, -O2):
<direct_bytes_number>:
jmp    1030 <ih_item_len@plt>

LLVM IR (-O0):
%struct.item_head = type { i32 }
define i32 @direct_bytes_number(%struct.item_head* %0, i32 %1) {
%3 = alloca %struct.item_head*
%4 = alloca i32
store %struct.item_head* %0, %struct.item_head** %3
store i32 %1, i32* %4
%5 = load %struct.item_head*, %struct.item_head** %3
%6 = call i32 @ih_item_len(%struct.item_head* %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.item_head = type { i32 }
define i32 @direct_bytes_number(%struct.item_head* %0, i32 %1) {
%3 = tail call i32 @ih_item_len(%struct.item_head* %0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __udivmoddi4(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/ *);
uint64_t __udivdi3(uint64_t num, uint64_t den) {
  return __udivmoddi4(num, den, NULL);
}


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

x86 assembly (clang, -O2):
<__udivdi3>:
xor    %edx,%edx
jmp    1030 <__udivmoddi4@plt>

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

LLVM IR (-O2):
define i32 @__udivdi3(i32 %0, i32 %1) {
%3 = tail call i32 @__udivmoddi4(i32 %0, i32 %1, i32* null)
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ same_screen;
};
typedef TYPE_1__ XButtonReleasedEvent;

/* Variables and functions */
int get_XButtonReleasedEvent_same_screen(void *_p) {
  return (int)((XButtonReleasedEvent *)_p)->same_screen;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XButtonReleasedEvent_same_screen(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
void s3c6400_default_sdhci2(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @s3c6400_default_sdhci2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int, int, int, int, int, int, int, int, int, int);
int main() {
  foo(1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x1,0x10(%rsp)
movl   $0x1,0x18(%rsp)
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
push   $0x1
push   $0x1
push   $0x1
push   $0x1
call   1030 <foo@plt>
add    $0x20,%rsp
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1)
ret i32 0
}
int error_code(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @error_code() {
ret i32 0
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int nanosleep(struct timespec const *, struct timespec *);
int thrd_sleep(const struct timespec *timepoint, struct timespec *remaining) {
  int result = 0;
  result = nanosleep(timepoint, remaining);
  return result;
}


x86 assembly (clang, -O0):
<thrd_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <nanosleep@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thrd_sleep>:
jmp    1030 <nanosleep@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @thrd_sleep(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
%5 = alloca i32
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
store i32 0, i32* %5
%6 = load %struct.timespec*, %struct.timespec** %3
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i32 @nanosleep(%struct.timespec* %6, %struct.timespec* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @thrd_sleep(%struct.timespec* %0, %struct.timespec* %1) {
%3 = tail call i32 @nanosleep(%struct.timespec* %0, %struct.timespec* %1)
ret i32 %3
}
/* Variables and functions */
char const *strstart(char const *str, char const *start) {
  do {
    if (*start == '\0')
      return str;
  } while (*str++ == *start++);
  return NULL;
}


x86 assembly (clang, -O0):
<strstart>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1129 <strstart+0x29>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1162 <strstart+0x62>
jmp    112e <strstart+0x2e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     110c <strstart+0xc>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strstart>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsi),%ecx
test   %cl,%cl
je     1128 <strstart+0x28>
lea    0x1(%rax),%rdx
add    $0x1,%rsi
cmp    %cl,(%rax)
mov    %rdx,%rax
je     1110 <strstart+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strstart(i8* %0, i8* nocapture %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = phi i8* [ %1, %2 ], [ %11, %8 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = load i8, i8* %4
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = icmp eq i8 %10, %6
br i1 %12, label %3, label %13
13: ; preds = %8, %3
%14 = phi i8* [ %4, %3 ], [ null, %8 ]
ret i8* %14
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t swap16(uint16_t x) {
  return ((x >> 8) & 0x00ff) | ((x << 8) & 0xff00);
}


x86 assembly (clang, -O0):
<swap16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap16>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @swap16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = and i32 %4, 255
%6 = load i32, i32* %2
%7 = shl i32 %6, 8
%8 = and i32 %7, 65280
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @swap16(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
int access(char const *, int /*<<< orphan*/);
bool is_file_exist(const char *file_name) {
  bool ret = false;
  if (access(file_name, F_OK) != -1) {
    ret = true;
  }
  return ret;
}


x86 assembly (clang, -O0):
<is_file_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0xffffffff,%eax
je     1145 <is_file_exist+0x35>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_file_exist>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @is_file_exist(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = load i32, i32* @F_OK
%6 = call i32 @access(i8* %4, i32 %5)
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %3
br label %9
9: ; preds = %8, %1
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @is_file_exist(i8* nocapture %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
float raw_sigmoid_derivative_at(float y) { return y * (1.0 - y); }


x86 assembly (clang, -O0):
<raw_sigmoid_derivative_at>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xedd(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_sigmoid_derivative_at>:
cvtss2sd %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @raw_sigmoid_derivative_at(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fsub double 1.000000e+00, %6
%8 = fmul double %4, %7
%9 = fptrunc double %8 to float
ret float %9
}

LLVM IR (-O2):
define float @raw_sigmoid_derivative_at(float %0) {
%2 = fpext float %0 to double
%3 = fsub double 1.000000e+00, %2
%4 = fmul double %3, %2
%5 = fptrunc double %4 to float
ret float %5
}
int main() {
  int a;
  while (a < 100)
    a = a + 1;
  a = 100032;
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1123 <main+0x23>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110b <main+0xb>
movl   $0x186c0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 100032
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void delay_period() { sleep(1); }


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

x86 assembly (clang, -O2):
<delay_period>:
mov    $0x1,%edi
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @delay_period() {
%1 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
define void @delay_period() {
%1 = tail call i32 @sleep(i32 1)
ret void
}
int palin(int n) {
  int orig = n, rev = 0;
  while (n) {
    int x = n % 10;
    rev = rev * 10 + x;
    x /= 10;
  }
  if (orig == rev)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<palin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1149 <palin+0x49>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
imul   $0xa,-0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    1114 <palin+0x14>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1161 <palin+0x61>
movl   $0x1,-0x4(%rbp)
jmp    1168 <palin+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @palin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
%7 = load i32, i32* %3
store i32 %7, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %11, %1
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %3
%13 = srem i32 %12, 10
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = mul nsw i32 %14, 10
%16 = load i32, i32* %6
%17 = add nsw i32 %15, %16
store i32 %17, i32* %5
%18 = load i32, i32* %6
%19 = sdiv i32 %18, 10
store i32 %19, i32* %6
br label %8
20: ; preds = %8
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %2
br label %26
25: ; preds = %20
store i32 0, i32* %2
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @palin(i32 %0) {
%2 = icmp eq i32 %0, 0
ret i32 1
}
int tiger_ord(char *s) { return s[0]; }


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

x86 assembly (clang, -O2):
<tiger_ord>:
movsbl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @tiger_ord(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
ret i32 %6
}

LLVM IR (-O2):
define i32 @tiger_ord(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
ret i32 %3
}