xunge/DecIR huggingface dataset:
int setrlimit(int resource, const struct rlimit *rlim) { return -1; }


x86 assembly (clang, -O0):
<setrlimit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.rlimit = type opaque
define i32 @setrlimit(i32 %0, %struct.rlimit* nocapture readnone %1) {
ret i32 -1
}
void __foreach(void *user_data, const void *key, void *value) {
  printf("[%s] = '%s'\n", key, value);
}


x86 assembly (clang, -O0):
<__foreach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__foreach>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"[%s] = '%s'\0A\00"
define void @__foreach(i8* nocapture readnone %0, i8* %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
/* Variables and functions */
scalar_t__ IsAlpha(char);
scalar_t__ IsNumeric(char);
int IsAlphaNumeric(char c) { return IsAlpha(c) || IsNumeric(c); }


x86 assembly (clang, -O0):
<IsAlphaNumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <IsAlpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <IsAlphaNumeric+0x3c>
movsbl -0x1(%rbp),%edi
call   1040 <IsNumeric@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsAlphaNumeric>:
push   %rbx
mov    %edi,%ebx
call   1030 <IsAlpha@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <IsAlphaNumeric+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1040 <IsNumeric@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @IsAlphaNumeric(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @IsAlpha(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @IsNumeric(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @IsAlphaNumeric(i8 signext %0) {
%2 = tail call i64 @IsAlpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @IsNumeric(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int get_gcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int m, n;
  int gcd;
  printf("Input two numbers: ");
  scanf("%d %d", &m, &n);
  gcd = get_gcd(m, n);
  printf("The GCD is %d\n\n", gcd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <get_gcd@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <get_gcd@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Input two numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [16 x i8] c"The GCD is %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 @get_gcd(i32 %7, i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Input two numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [16 x i8] c"The GCD is %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @get_gcd(i32 %7, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}
void rdr2_(dx, dy) float *dx, *dy;
{ rdr2(*dx, *dy); }


x86 assembly (clang, -O0):
<rdr2_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1030 <rdr2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdr2_>:
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%rsi),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
jmp    1030 <rdr2@plt>

LLVM IR (-O0):
define void @rdr2_(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = fpext float %6 to double
%8 = load float*, float** %4
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = call i32 (double, double, ...) bitcast (i32 (...)* @rdr2 to i32 (double, double, ...)*)(double %7, double %10)
ret void
}

LLVM IR (-O2):
define void @rdr2_(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = fpext float %3 to double
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = tail call i32 (double, double, ...) bitcast (i32 (...)* @rdr2 to i32 (double, double, ...)*)(double %4, double %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ return_union_hom_fp_partial2();
int /*<<< orphan*/ take_union_hom_fp_partial2(int /*<<< orphan*/);
void test_union_hom_fp_partial2() {
  take_union_hom_fp_partial2(return_union_hom_fp_partial2());
}


x86 assembly (clang, -O0):
<test_union_hom_fp_partial2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <return_union_hom_fp_partial2@plt>
mov    %eax,%edi
call   1040 <take_union_hom_fp_partial2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_union_hom_fp_partial2>:
push   %rax
xor    %eax,%eax
call   1030 <return_union_hom_fp_partial2@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <take_union_hom_fp_partial2@plt>

LLVM IR (-O0):
define void @test_union_hom_fp_partial2() {
%1 = call i32 (...) @return_union_hom_fp_partial2()
%2 = call i32 @take_union_hom_fp_partial2(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_union_hom_fp_partial2() {
%1 = tail call i32 (...) @return_union_hom_fp_partial2()
%2 = tail call i32 @take_union_hom_fp_partial2(i32 %1)
ret void
}
/* Variables and functions */
int get_mem(int);
int /*<<< orphan*/ put_mem(int, char);
void uart_put(char val) {
  while ((get_mem(0x3F000000 + 0x00215054) & 0x20) == 0) {
  }
  put_mem(0x3F000000 + 0x00215040, val);
}


x86 assembly (clang, -O0):
<uart_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x3f215054,%edi
call   1040 <get_mem@plt>
and    $0x20,%eax
cmp    $0x0,%eax
jne    1149 <uart_put+0x29>
jmp    112e <uart_put+0xe>
mov    $0x3f215040,%edi
movsbl -0x1(%rbp),%esi
call   1030 <put_mem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_put>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x3f215054,%edi
call   1040 <get_mem@plt>
test   $0x20,%al
je     1130 <uart_put+0x10>
movsbl %bl,%esi
mov    $0x3f215040,%edi
pop    %rbx
jmp    1030 <put_mem@plt>

LLVM IR (-O0):
define void @uart_put(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %7, %1
%4 = call i32 @get_mem(i32 1059147860)
%5 = and i32 %4, 32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i8, i8* %2
%10 = call i32 @put_mem(i32 1059147840, i8 signext %9)
ret void
}

LLVM IR (-O2):
define void @uart_put(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @get_mem(i32 1059147860)
%4 = and i32 %3, 32
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = tail call i32 @put_mem(i32 1059147840, i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test(char *);
int main() {
  test("Please reverse me");
  test("This is just a longer test");
  test("This is");
  test("This");
  test("");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <test@plt>
lea    0xeeb(%rip),%rdi
call   1030 <test@plt>
lea    0xefa(%rip),%rdi
call   1030 <test@plt>
lea    0xef6(%rip),%rdi
call   1030 <test@plt>
lea    0xec6(%rip),%rdi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"Please reverse me\00"
@.str.1 = [27 x i8] c"This is just a longer test\00"
@.str.2 = [8 x i8] c"This is\00"
@.str.3 = [5 x i8] c"This\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = call i32 @test(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Please reverse me\00"
@.str.1 = [27 x i8] c"This is just a longer test\00"
@.str.2 = [8 x i8] c"This is\00"
@.str.3 = [5 x i8] c"This\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t diminuto_absolute_int8_t_f(int8_t value) {
  return (value < 0) ? -value : value;
}


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

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

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

LLVM IR (-O2):
define i32 @diminuto_absolute_int8_t_f(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
double Percent(int /*<<< orphan*/, int /*<<< orphan*/);
double MissRate(uint16_t a, uint16_t b) { return 100.0 - Percent(a, b); }


x86 assembly (clang, -O0):
<MissRate>:
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 <Percent@plt>
movaps %xmm0,%xmm1
movsd  0xecc(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MissRate>:
push   %rax
call   1030 <Percent@plt>
movsd  0xee2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @MissRate(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 double @Percent(i32 %5, i32 %6)
%8 = fsub double 1.000000e+02, %7
ret double %8
}

LLVM IR (-O2):
define double @MissRate(i32 %0, i32 %1) {
%3 = tail call double @Percent(i32 %0, i32 %1)
%4 = fsub double 1.000000e+02, %3
ret double %4
}
__attribute__((format(printf, 1, 2))) void TRACE(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @TRACE(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _usage(void) {
  fputs("Usage: "
        "mkdir"
        " [-p][-m mode] dir...\n  -p	Create any missing intermediate "
        "pathname components\n  -m	File permission bits of the "
        "newly-created directory\n",
        stderr);
  return 1;
}


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

x86 assembly (clang, -O2):
<_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [149 x i8] c"Usage: mkdir [-p][-m mode] dir...\0A -p\09Create any missing intermediate pathname components\0A -m\09File permission bits of the newly-created directory\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [149 x i8] c"Usage: mkdir [-p][-m mode] dir...\0A -p\09Create any missing intermediate pathname components\0A -m\09File permission bits of the newly-created directory\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
int Key(char word[5]) {
  int i, key;
  for (i = 0, key = 0; i < 5 - 1; i++) {
    key = 61 * key + (int)word[i];
  }
  return key;
}


x86 assembly (clang, -O0):
<Key>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1143 <Key+0x43>
imul   $0x3d,-0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <Key+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Key>:
movsbl (%rdi),%eax
imul   $0x3d,%eax,%eax
movsbl 0x1(%rdi),%ecx
add    %eax,%ecx
imul   $0x3d,%ecx,%eax
movsbl 0x2(%rdi),%ecx
add    %eax,%ecx
imul   $0x3d,%ecx,%ecx
movsbl 0x3(%rdi),%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Key(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = mul nsw i32 %3, 61
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = add nsw i32 %4, %7
%9 = mul nsw i32 %8, 61
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = add nsw i32 %9, %12
%14 = mul nsw i32 %13, 61
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = add nsw i32 %14, %17
ret i32 %18
}
/* Type definitions */
typedef int u_int32_t;

/* Variables and functions */
u_int32_t G(u_int32_t b, u_int32_t c, u_int32_t d) { return b ^ c ^ d; }


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

x86 assembly (clang, -O2):
<G>:
mov    %edi,%eax
xor    %esi,%eax
xor    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @G(i32 %0, i32 %1, i32 %2) {
%4 = xor i32 %1, %0
%5 = xor i32 %4, %2
ret i32 %5
}
/* Type definitions */
struct kvm_cpuid_entry {
  int dummy;
};
struct kvm_cpuid2 {
  int nent;
};

/* Variables and functions */
void cpuid_init(void *data, int size) {
  struct kvm_cpuid2 *cpuid = (struct kvm_cpuid2 *)data;
  cpuid->nent =
      (size - sizeof(struct kvm_cpuid2)) / sizeof(struct kvm_cpuid_entry);
}


x86 assembly (clang, -O0):
<cpuid_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rax
sub    $0x4,%rax
shr    $0x2,%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_init>:
movslq %esi,%rax
movabs $0x3fffffffc,%rcx
add    %rax,%rcx
shr    $0x2,%rcx
mov    %ecx,(%rdi)
ret

LLVM IR (-O0):
%struct.kvm_cpuid2 = type { i32 }
define void @cpuid_init(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.kvm_cpuid2*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.kvm_cpuid2*
store %struct.kvm_cpuid2* %7, %struct.kvm_cpuid2** %5
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = sub i64 %9, 4
%11 = udiv i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = load %struct.kvm_cpuid2*, %struct.kvm_cpuid2** %5
%14 = getelementptr inbounds %struct.kvm_cpuid2, %struct.kvm_cpuid2* %13, i32 0, i32 0
store i32 %12, i32* %14
ret void
}

LLVM IR (-O2):
define void @cpuid_init(i8* nocapture writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = add nsw i64 %3, 17179869180
%5 = lshr i64 %4, 2
%6 = trunc i64 %5 to i32
%7 = bitcast i8* %0 to i32*
store i32 %6, i32* %7
ret void
}
int totalIndex(int x, int y, int nodeIndex) {
  return nodeIndex * 80 + x % 10 + 10 * y;
}


x86 assembly (clang, -O0):
<totalIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
imul   $0x50,-0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
imul   $0xa,-0x8(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<totalIndex>:
lea    (%rdx,%rdx,4),%ecx
shl    $0x4,%ecx
movslq %edi,%rax
imul   $0x66666667,%rax,%rdx
mov    %rdx,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rdx
add    %edi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%eax
lea    (%rsi,%rsi,4),%edx
lea    (%rax,%rdx,2),%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @totalIndex(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 80
%9 = load i32, i32* %4
%10 = srem i32 %9, 10
%11 = add nsw i32 %8, %10
%12 = load i32, i32* %5
%13 = mul nsw i32 10, %12
%14 = add nsw i32 %11, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @totalIndex(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, 80
%5 = srem i32 %0, 10
%6 = mul nsw i32 %1, 10
%7 = add i32 %6, %5
%8 = add i32 %7, %4
ret i32 %8
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t unpack1bit(const uint8_t byte, int bitpos) {
  return (byte & 1 << (7 - bitpos)) > (7 - bitpos);
}


x86 assembly (clang, -O0):
<unpack1bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x7,%ecx
sub    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    $0x7,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpack1bit>:
mov    $0x7,%ecx
sub    %esi,%ecx
mov    $0x1,%edx
shl    %cl,%edx
and    %edi,%edx
xor    %eax,%eax
cmp    %ecx,%edx
setg   %al
ret

LLVM IR (-O0):
define i32 @unpack1bit(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 = sub nsw i32 7, %6
%8 = shl i32 1, %7
%9 = and i32 %5, %8
%10 = load i32, i32* %4
%11 = sub nsw i32 7, %10
%12 = icmp sgt i32 %9, %11
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @unpack1bit(i32 %0, i32 %1) {
%3 = sub nsw i32 7, %1
%4 = shl nuw i32 1, %3
%5 = and i32 %4, %0
%6 = icmp sgt i32 %5, %3
%7 = zext i1 %6 to i32
ret i32 %7
}
int is_zero(char *buf, int sz) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @is_zero(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t be24getv(void *p) {
  uint8_t *a;
  uint32_t v;
  a = p;
  v = a[0] << 16;
  v |= a[1] << 8;
  v |= a[2];
  return v;
}


x86 assembly (clang, -O0):
<be24getv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
shl    $0x10,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
shl    $0x8,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<be24getv>:
mov    (%rdi),%ecx
mov    0x4(%rdi),%eax
shl    $0x10,%ecx
shl    $0x8,%eax
or     %ecx,%eax
or     0x8(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @be24getv(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = shl i32 %3, 16
%5 = getelementptr inbounds i8, i8* %0, i64 4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = shl i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 8
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = or i32 %9, %12
ret i32 %13
}
void pointerIncrement(int *value) { *value += 1; }


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

x86 assembly (clang, -O2):
<pointerIncrement>:
addl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @pointerIncrement(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *name) {
  fprintf(stderr,
          "Usage: %s [--new-plies seconds] [--fen-file fenfile] [--ply-file "
          "plyfile] [--average-only]\n",
          name);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [92 x i8] c"Usage: %s [--new-plies seconds] [--fen-file fenfile] [--ply-file plyfile] [--average-only]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [92 x i8] c"Usage: %s [--new-plies seconds] [--fen-file fenfile] [--ply-file plyfile] [--average-only]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ pimInit();
int main() {
  pimInit();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @pimInit()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ms_abi_func();
int main(void) {
  ms_abi_func();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ms_abi_func()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: brilter [-d] script-file\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"usage: brilter [-d] script-file\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"usage: brilter [-d] script-file\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void update(void) {}


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

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

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

LLVM IR (-O2):
define void @update() {
ret void
}
int test_imm_BFuint8_mem(unsigned char *val) {
  return ((*val) & (-0xBF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_BFuint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffff41,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_BFuint8_mem>:
testb  $0x41,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_BFuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 65
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int sqlite3_complete(char *);
int _is_complete(char *zSql, int nSql) {
  int rc;
  if (zSql == 0)
    return 1;
  zSql[nSql] = ';';
  zSql[nSql + 1] = 0;
  rc = sqlite3_complete(zSql);
  zSql[nSql] = 0;
  return rc;
}


x86 assembly (clang, -O0):
<_is_complete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1136 <_is_complete+0x26>
movl   $0x1,-0x4(%rbp)
jmp    1171 <_is_complete+0x61>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x3b,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1030 <sqlite3_complete@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_complete>:
test   %rdi,%rdi
je     1138 <_is_complete+0x28>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movslq %esi,%r14
movw   $0x3b,(%rdi,%r14,1)
call   1030 <sqlite3_complete@plt>
movb   $0x0,(%rbx,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @_is_complete(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 59, i8* %6
%7 = add nsw i32 %1, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 0, i8* %9
%10 = tail call i32 @sqlite3_complete(i8* %0)
store i8 0, i8* %6
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ %10, %4 ], [ 1, %2 ]
ret i32 %12
}
int collatz(int n) {
  int soma = 1;
  unsigned long long int k = (unsigned long long)n;
  while (1) {
    if (k <= 1)
      return soma;
    if (k % 2 == 1)
      k = 3 * k + 1;
    else
      k = k / 2;
    ++soma;
  }
}


x86 assembly (clang, -O0):
<collatz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
ja     1126 <collatz+0x26>
mov    -0x8(%rbp),%eax
pop    %rbp
ret
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x1,%rax
jne    114a <collatz+0x4a>
imul   $0x3,-0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1156 <collatz+0x56>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1116 <collatz+0x16>

x86 assembly (clang, -O2):
<collatz>:
mov    $0x1,%eax
cmp    $0x2,%edi
jb     113b <collatz+0x3b>
movslq %edi,%rcx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rcx,%rdx
shr    %rdx
test   $0x1,%cl
lea    0x1(%rcx,%rcx,2),%rcx
cmove  %rdx,%rcx
add    $0x1,%eax
cmp    $0x2,%rcx
jae    1120 <collatz+0x20>
ret

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

LLVM IR (-O2):
define i32 @collatz(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = sext i32 %0 to i64
br label %7
5: ; preds = %7, %1
%6 = phi i32 [ 1, %1 ], [ %16, %7 ]
ret i32 %6
7: ; preds = %3, %7
%8 = phi i64 [ %15, %7 ], [ %4, %3 ]
%9 = phi i32 [ %16, %7 ], [ 1, %3 ]
%10 = and i64 %8, 1
%11 = icmp eq i64 %10, 0
%12 = mul i64 %8, 3
%13 = add i64 %12, 1
%14 = lshr i64 %8, 1
%15 = select i1 %11, i64 %14, i64 %13
%16 = add nuw nsw i32 %9, 1
%17 = icmp ult i64 %15, 2
br i1 %17, label %5, label %7
}
int do_809() { return 809; }


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

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

LLVM IR (-O0):
define i32 @do_809() {
ret i32 809
}

LLVM IR (-O2):
define i32 @do_809() {
ret i32 809
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void my_abort(int ret, char *err_str) {
  fprintf(stderr, "Error: %s\nAborted.\n", err_str);
  exit(ret);
}


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

x86 assembly (clang, -O2):
<my_abort>:
push   %rbx
mov    %rsi,%rdx
mov    %edi,%ebx
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 = [20 x i8] c"Error: %s\0AAborted.\0A\00"
define void @my_abort(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %3
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Error: %s\0AAborted.\0A\00"
define void @my_abort(i32 %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = tail call i32 @exit(i32 %0)
unreachable
}
char get_nible(c, n)
char c;
int n;
{
  char cc;
  if (n)
    cc = c & 0xf;
  else
    cc = c >> 4;
  if (cc < 10)
    cc += '0';
  else
    cc += 'A' - 10;
  return cc;
}


x86 assembly (clang, -O0):
<get_nible>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1126 <get_nible+0x26>
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x9(%rbp)
jmp    1130 <get_nible+0x30>
movsbl -0x1(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jge    114c <get_nible+0x4c>
movsbl -0x9(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x9(%rbp)
jmp    1156 <get_nible+0x56>
movsbl -0x9(%rbp),%eax
add    $0x37,%eax
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nible>:
movsbl %dil,%ecx
and    $0xf,%edi
sar    $0x4,%ecx
test   %esi,%esi
cmovne %edi,%ecx
cmp    $0xa,%ecx
mov    $0x30,%edx
mov    $0x37,%eax
cmovl  %edx,%eax
add    %cl,%al
ret

LLVM IR (-O0):
define signext i8 @get_nible(i32 %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i8
%6 = trunc i32 %0 to i8
store i8 %6, i8* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = and i32 %11, 15
%13 = trunc i32 %12 to i8
store i8 %13, i8* %5
br label %19
14: ; preds = %2
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = ashr i32 %16, 4
%18 = trunc i32 %17 to i8
store i8 %18, i8* %5
br label %19
19: ; preds = %14, %9
%20 = load i8, i8* %5
%21 = sext i8 %20 to i32
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %5
%25 = sext i8 %24 to i32
%26 = add nsw i32 %25, 48
%27 = trunc i32 %26 to i8
store i8 %27, i8* %5
br label %33
28: ; preds = %19
%29 = load i8, i8* %5
%30 = sext i8 %29 to i32
%31 = add nsw i32 %30, 55
%32 = trunc i32 %31 to i8
store i8 %32, i8* %5
br label %33
33: ; preds = %28, %23
%34 = load i8, i8* %5
ret i8 %34
}

LLVM IR (-O2):
define signext i8 @get_nible(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = and i32 %0, 15
%5 = shl i32 %0, 24
%6 = ashr i32 %5, 28
%7 = select i1 %3, i32 %6, i32 %4
%8 = icmp slt i32 %7, 10
%9 = trunc i32 %7 to i8
%10 = select i1 %8, i8 48, i8 55
%11 = add nsw i8 %10, %9
ret i8 %11
}
void dtp_hook_end(void) {}


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

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

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

LLVM IR (-O2):
define void @dtp_hook_end() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stop();
int /*<<< orphan*/ system(char *);
void closePwm() {
  printf("Chiudo pwm\n\r");
  stop();
  system("echo 0 > /sys/class/pwm/pwmchip0/unexport");
  system("echo 1 > /sys/class/pwm/pwmchip0/unexport");
}


x86 assembly (clang, -O0):
<closePwm>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <stop@plt>
lea    0xebf(%rip),%rdi
call   1030 <system@plt>
lea    0xedd(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<closePwm>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <stop@plt>
lea    0xec2(%rip),%rdi
call   1030 <system@plt>
lea    0xee0(%rip),%rdi
pop    %rax
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Chiudo pwm\0A\0D\00"
@.str.1 = [42 x i8] c"echo 0 > /sys/class/pwm/pwmchip0/unexport\00"
@.str.2 = [42 x i8] c"echo 1 > /sys/class/pwm/pwmchip0/unexport\00"
define void @closePwm() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @stop()
%3 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Chiudo pwm\0A\0D\00"
@.str.1 = [42 x i8] c"echo 0 > /sys/class/pwm/pwmchip0/unexport\00"
@.str.2 = [42 x i8] c"echo 1 > /sys/class/pwm/pwmchip0/unexport\00"
define void @closePwm() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @stop()
%3 = tail call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void HMAC_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @HMAC_Init() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mask;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ CPU_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ CPU_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int sched_setaffinity(int /*<<< orphan*/, int, int /*<<< orphan*/ *);
void cpu_set() {
  cpu_set_t mask;
  CPU_ZERO(&mask);
  CPU_SET(0, &mask);
  CPU_SET(1, &mask);
  if (sched_setaffinity(0, sizeof(mask), &mask) == -1) {
    printf("failed to set cpu affinity\n");
    return;
  }
  return;
}


x86 assembly (clang, -O0):
<cpu_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <CPU_ZERO@plt>
xor    %edi,%edi
lea    -0x4(%rbp),%rsi
call   1060 <CPU_SET@plt>
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
call   1060 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
lea    -0x4(%rbp),%rdx
call   1040 <sched_setaffinity@plt>
cmp    $0xffffffff,%eax
jne    1194 <cpu_set+0x54>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <cpu_set+0x59>
jmp    1199 <cpu_set+0x59>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_set>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <CPU_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <CPU_SET@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1060 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
mov    %rbx,%rdx
call   1040 <sched_setaffinity@plt>
cmp    $0xffffffff,%eax
jne    1189 <cpu_set+0x49>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"failed to set cpu affinity\0A\00"
define void @cpu_set() {
%1 = alloca i32
%2 = call i32 @CPU_ZERO(i32* %1)
%3 = call i32 @CPU_SET(i32 0, i32* %1)
%4 = call i32 @CPU_SET(i32 1, i32* %1)
%5 = call i32 @sched_setaffinity(i32 0, i32 4, i32* %1)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %10
9: ; preds = %0
br label %10
10: ; preds = %9, %7
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"failed to set cpu affinity\00"
define void @cpu_set() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @CPU_ZERO(i32* %1)
%4 = call i32 @CPU_SET(i32 0, i32* %1)
%5 = call i32 @CPU_SET(i32 1, i32* %1)
%6 = call i32 @sched_setaffinity(i32 0, i32 4, i32* %1)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %0, %8
ret void
}
/* Variables and functions */
int printf(char *, int, int, char *);
int __test() { return printf("%d %d %s\n", 1, 2, "foo"); }


x86 assembly (clang, -O0):
<__test>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
lea    0xede(%rip),%rcx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__test>:
lea    0xee9(%rip),%rdi
lea    0xeec(%rip),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %s\0A\00"
@.str.1 = [4 x i8] c"foo\00"
define i32 @__test() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %s\0A\00"
@.str.1 = [4 x i8] c"foo\00"
define i32 @__test() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 %1
}
long ab(long value) {
  if (0 > value) {
    value = -value;
  }
  return value;
}


x86 assembly (clang, -O0):
<ab>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jle    111e <ab+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @ab(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp sgt i64 0, %3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
store i64 %7, i64* %2
br label %8
8: ; preds = %5, %1
%9 = load i64, i64* %2
ret i64 %9
}

LLVM IR (-O2):
define i64 @ab(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}