xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *xrealloc(void *ptr, size_t size) {
  ptr = realloc(ptr, size);
  if (ptr)
    return ptr;
  fprintf(stderr, "out of memory\n");
  exit(1);
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1166 <xrealloc+0x36>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <xrealloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i8*, i8** %3
ret i8* %11
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %2
ret i8* %3
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_FBint8_mem(signed char *val) {
  return ((*val) & (0xFB << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_FBint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 251
%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_FBint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -5
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
yyerror(char *s) { fprintf(stderr, "error: %s\n", s); }


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yyerror>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"error: %s\0A\00"
define i32 @yyerror(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %3
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"error: %s\0A\00"
define i32 @yyerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 undef
}
int main() {
  int x, y, z;
  x = 0;
  if (y > 5) {
    x++;
    z++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0xc(%rbp)
jle    112e <main+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
primFun(primReturnIO) { IOReturn(IOArg(1)); }


x86 assembly (clang, -O0):
<primFun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <IOArg@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1040 <IOReturn@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primFun>:
push   %rax
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <IOArg@plt>
mov    %eax,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <IOReturn@plt>

LLVM IR (-O0):
define i32 @primFun(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @IOArg to i32 (i32, ...)*)(i32 1)
%5 = call i32 (i32, ...) bitcast (i32 (...)* @IOReturn to i32 (i32, ...)*)(i32 %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @primFun(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @IOArg to i32 (i32, ...)*)(i32 1)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @IOReturn to i32 (i32, ...)*)(i32 %2)
ret i32 undef
}
int f(int year, int month) {
  if (month <= 2)
    return (year - 1);
  else
    return year;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     1122 <f+0x22>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1128 <f+0x28>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
xor    %ecx,%ecx
cmp    $0x3,%esi
setl   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @f(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* %5
%7 = icmp sle i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 3
%4 = sext i1 %3 to i32
%5 = add nsw i32 %4, %0
ret i32 %5
}
int dns_v_rel(void) { return 0x20160809; }


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

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

LLVM IR (-O0):
define i32 @dns_v_rel() {
ret i32 538314761
}

LLVM IR (-O2):
define i32 @dns_v_rel() {
ret i32 538314761
}
/* Variables and functions */
int /*<<< orphan*/ __invpcid(int /*<<< orphan*/, int /*<<< orphan*/, int);
void invpcid_flush_all_nonglobals(void) { __invpcid(0, 0, 3); }


x86 assembly (clang, -O0):
<invpcid_flush_all_nonglobals>:
push   %rbp
mov    %rsp,%rbp
xor    %esi,%esi
mov    $0x3,%edx
mov    %esi,%edi
call   1030 <__invpcid@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<invpcid_flush_all_nonglobals>:
xor    %edi,%edi
xor    %esi,%esi
mov    $0x3,%edx
jmp    1030 <__invpcid@plt>

LLVM IR (-O0):
define void @invpcid_flush_all_nonglobals() {
%1 = call i32 @__invpcid(i32 0, i32 0, i32 3)
ret void
}

LLVM IR (-O2):
define void @invpcid_flush_all_nonglobals() {
%1 = tail call i32 @__invpcid(i32 0, i32 0, i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_aupdate_write_begin() {
  printf("NOT IMPLEMENTED:"
         "pa_aupdate_write_begin"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"NOT IMPLEMENTED:pa_aupdate_write_begin\0A\00"
define i32 @pa_aupdate_write_begin() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [39 x i8] c"NOT IMPLEMENTED:pa_aupdate_write_begin\00"
define i32 @pa_aupdate_write_begin() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void defaultCallback(const char *Message) { printf("%s", Message); }


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

x86 assembly (clang, -O2):
<defaultCallback>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @defaultCallback(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @defaultCallback(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
double AT_histoOld_lower_bin_limit(long const, double const *, long const);
double AT_histoOld_upper_bin_limit(long const, double const *, long const);
double AT_histoOld_get_bin_width(const long number_of_bins,
                                 const double bin_centers[],
                                 const long bin_no) {
  double lower_limit =
      AT_histoOld_lower_bin_limit(number_of_bins, bin_centers, bin_no);
  double upper_limit =
      AT_histoOld_upper_bin_limit(number_of_bins, bin_centers, bin_no);
  return (upper_limit - lower_limit);
}


x86 assembly (clang, -O0):
<AT_histoOld_get_bin_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <AT_histoOld_lower_bin_limit@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <AT_histoOld_upper_bin_limit@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AT_histoOld_get_bin_width>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <AT_histoOld_lower_bin_limit@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <AT_histoOld_upper_bin_limit@plt>
subsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @AT_histoOld_get_bin_width(i64 %0, double* %1, i64 %2) {
%4 = alloca i64
%5 = alloca double*
%6 = alloca i64
%7 = alloca double
%8 = alloca double
store i64 %0, i64* %4
store double* %1, double** %5
store i64 %2, i64* %6
%9 = load i64, i64* %4
%10 = load double*, double** %5
%11 = load i64, i64* %6
%12 = call double @AT_histoOld_lower_bin_limit(i64 %9, double* %10, i64 %11)
store double %12, double* %7
%13 = load i64, i64* %4
%14 = load double*, double** %5
%15 = load i64, i64* %6
%16 = call double @AT_histoOld_upper_bin_limit(i64 %13, double* %14, i64 %15)
store double %16, double* %8
%17 = load double, double* %8
%18 = load double, double* %7
%19 = fsub double %17, %18
ret double %19
}

LLVM IR (-O2):
define double @AT_histoOld_get_bin_width(i64 %0, double* %1, i64 %2) {
%4 = tail call double @AT_histoOld_lower_bin_limit(i64 %0, double* %1, i64 %2)
%5 = tail call double @AT_histoOld_upper_bin_limit(i64 %0, double* %1, i64 %2)
%6 = fsub double %5, %4
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int, int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ output_w32(int);
void emit_fnegs(int s, int d) {
  assert(s == 31);
  assert(d == 31);
  assem_debug("fnegs s%d,s%d", d, s);
  output_w32(0x1e214000 | s << 5 | d);
}


x86 assembly (clang, -O0):
<emit_fnegs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1f,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x1f,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe93(%rip),%rdi
call   1030 <assem_debug@plt>
mov    -0x4(%rbp),%edi
shl    $0x5,%edi
or     $0x1e214000,%edi
or     -0x8(%rbp),%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fnegs>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x1f,%ebx
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x1f,%ebp
sete   %dil
call   1050 <assert@plt>
lea    0xea6(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <assem_debug@plt>
shl    $0x5,%ebx
or     %ebp,%ebx
or     $0x1e214000,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"fnegs s%d,s%d\00"
define void @emit_fnegs(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 = icmp eq i32 %5, 31
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 31
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = call i32 @assem_debug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %3
%17 = shl i32 %16, 5
%18 = or i32 505495552, %17
%19 = load i32, i32* %4
%20 = or i32 %18, %19
%21 = call i32 @output_w32(i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"fnegs s%d,s%d\00"
define void @emit_fnegs(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 31
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp eq i32 %1, 31
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @assem_debug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
%10 = shl i32 %0, 5
%11 = or i32 %10, %1
%12 = or i32 %11, 505495552
%13 = tail call i32 @output_w32(i32 %12)
ret void
}
/* Variables and functions */
scalar_t__ locked();
int rand();
int /*<<< orphan*/ unlock();
int f() {
  if (rand() % 2 == 0) {
    if (locked()) {
      unlock();
    }
  } else {
    f();
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117d <f+0x3d>
mov    $0x0,%al
call   1050 <locked@plt>
cmp    $0x0,%rax
je     1178 <f+0x38>
mov    $0x0,%al
call   1030 <unlock@plt>
jmp    1182 <f+0x42>
call   1040 <f@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
test   $0x1,%al
jne    1140 <f+0x10>
xor    %eax,%eax
call   1040 <locked@plt>
test   %rax,%rax
je     115e <f+0x2e>
xor    %eax,%eax
call   1030 <unlock@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = call i64 (...) @locked()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 (...) @unlock()
br label %10
10: ; preds = %8, %5
br label %13
11: ; preds = %0
%12 = call i32 @f()
br label %13
13: ; preds = %11, %10
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
define i32 @f() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %9, %0
%5 = tail call i64 (...) @locked()
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = tail call i32 (...) @unlock()
br label %13
9: ; preds = %0, %9
%10 = tail call i32 (...) @rand()
%11 = and i32 %10, 1
%12 = icmp eq i32 %11, 0
br i1 %12, label %4, label %9
13: ; preds = %4, %7
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void exit_end() { printf("\nGoodBye!"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"\0AGoodBye!\00"
define void @exit_end() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"\0AGoodBye!\00"
define void @exit_end() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int testCompare(const void *one, const void *two) {
  return strcmp((char *)one, (char *)two);
}


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

x86 assembly (clang, -O2):
<testCompare>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @testCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Type definitions */
struct state {
  int dummy;
};
struct debug_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cli_unbreak(struct state *context, struct debug_state *dbg_context,
                 char **args) {
  printf("NOT IMPLEMENTED YET\n");
}


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

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

LLVM IR (-O0):
%struct.state = type { i32 }
%struct.debug_state = type { i32 }
@.str = [21 x i8] c"NOT IMPLEMENTED YET\0A\00"
define void @cli_unbreak(%struct.state* %0, %struct.debug_state* %1, i8** %2) {
%4 = alloca %struct.state*
%5 = alloca %struct.debug_state*
%6 = alloca i8**
store %struct.state* %0, %struct.state** %4
store %struct.debug_state* %1, %struct.debug_state** %5
store i8** %2, i8*** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.state = type { i32 }
%struct.debug_state = type { i32 }
@str = [20 x i8] c"NOT IMPLEMENTED YET\00"
define void @cli_unbreak(%struct.state* nocapture readnone %0, %struct.debug_state* nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_RADIO_FIFOP_PIN() { return 0x01 & (inp_emulate(-2) >> 3); }


x86 assembly (clang, -O0):
<TOSH_READ_RADIO_FIFOP_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
sar    $0x3,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_RADIO_FIFOP_PIN>:
push   %rax
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
shr    $0x3,%al
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_RADIO_FIFOP_PIN() {
%1 = call i32 @inp_emulate(i32 -2)
%2 = ashr i32 %1, 3
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_RADIO_FIFOP_PIN() {
%1 = tail call i32 @inp_emulate(i32 -2)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 3
%4 = and i8 %3, 1
ret i8 %4
}
void osTaskSwitch(void) {}


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

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

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

LLVM IR (-O2):
define void @osTaskSwitch() {
ret void
}
int iterated_bitcount(unsigned int n) {
  int count = 0;
  while (n) {
    count += n & 0x1u;
    n >>= 1;
  }
  return count;
}


x86 assembly (clang, -O0):
<iterated_bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <iterated_bitcount+0x32>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <iterated_bitcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iterated_bitcount>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <iterated_bitcount+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <iterated_bitcount+0x10>
ret

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

LLVM IR (-O2):
define i32 @iterated_bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add i32 %4, %6
%8 = lshr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  const int ANSWER = 3;
  int guess;
  scanf("%d", &guess);
  if (guess != ANSWER)
    printf("true");
  else
    printf("false");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x3,-0xc(%rbp)
je     1161 <main+0x41>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    116d <main+0x4d>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x3,0x4(%rsp)
lea    0xeca(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 3
%6 = select i1 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%7 = call i32 @printf(i8* dereferenceable(1) %6)
ret i32 0
}
char *match(str, sym)
register char *str;
char sym;
{
  while (*str != sym)
    str++;
  return (str);
}


x86 assembly (clang, -O0):
<match>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     1132 <match+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110e <match+0xe>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match>:
mov    %rdi,%rax
movsbl %sil,%ecx
add    $0xffffffffffffffff,%rax
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rax),%edx
add    $0x1,%rax
cmp    %edx,%ecx
jne    1110 <match+0x10>
ret

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

LLVM IR (-O2):
define i8* @match(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %5, %2
%6 = phi i8* [ %0, %2 ], [ %10, %5 ]
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %4, %8
%10 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %9, label %11, label %5
11: ; preds = %5
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int self_test();
int main(void) {
  int st;
  printf("LOKI97 Self_test\n");
  st = self_test();
  printf("LOKI97 self_test returned %s (%d)\n", (st ? "OK" : "BAD"), st);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <self_test@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
lea    0xee7(%rip),%rsi
lea    0xedd(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x8(%rbp),%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef2(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <self_test@plt>
test   %eax,%eax
lea    0xed9(%rip),%rcx
lea    0xecf(%rip),%rsi
cmove  %rcx,%rsi
lea    0xea1(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"LOKI97 Self_test\0A\00"
@.str.1 = [35 x i8] c"LOKI97 self_test returned %s (%d)\0A\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [4 x i8] c"BAD\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @self_test()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"LOKI97 self_test returned %s (%d)\0A\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [4 x i8] c"BAD\00"
@str = [17 x i8] c"LOKI97 Self_test\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @self_test()
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %2)
ret i32 0
}
/* Variables and functions */
int YabSockInit() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @YabSockInit() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ rightRot(unsigned char *);
void rightRotKeys(unsigned char left[], unsigned char right[]) {
  rightRot(left);
  rightRot(right);
}


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

x86 assembly (clang, -O2):
<rightRotKeys>:
push   %rbx
mov    %rsi,%rbx
call   1030 <rightRot@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <rightRot@plt>

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

LLVM IR (-O2):
define void @rightRotKeys(i8* %0, i8* %1) {
%3 = tail call i32 @rightRot(i8* %0)
%4 = tail call i32 @rightRot(i8* %1)
ret void
}
void vnum_test10(int *data) {
  int i = data[0];
  int m = i + 1;
  int j = data[1];
  int n = j + 1;
  data[2] = m + n;
  if (i == j)
    data[3] = (m - n) * 21;
}


x86 assembly (clang, -O0):
<vnum_test10>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1156 <vnum_test10+0x56>
mov    -0x10(%rbp),%eax
sub    -0x18(%rbp),%eax
imul   $0x15,%eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vnum_test10>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
lea    (%rcx,%rax,1),%edx
add    $0x2,%edx
mov    %edx,0x8(%rdi)
cmp    %ecx,%eax
jne    1123 <vnum_test10+0x23>
add    $0x1,%eax
add    $0x1,%ecx
sub    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,4),%eax
mov    %eax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @vnum_test10(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %2
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %6
%17 = load i32, i32* %4
%18 = load i32, i32* %6
%19 = add nsw i32 %17, %18
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 2
store i32 %19, i32* %21
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %32
25: ; preds = %1
%26 = load i32, i32* %4
%27 = load i32, i32* %6
%28 = sub nsw i32 %26, %27
%29 = mul nsw i32 %28, 21
%30 = load i32*, i32** %2
%31 = getelementptr inbounds i32, i32* %30, i64 3
store i32 %29, i32* %31
br label %32
32: ; preds = %25, %1
ret void
}

LLVM IR (-O2):
define void @vnum_test10(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 1
%7 = add nsw i32 %6, %3
%8 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %7, i32* %8
%9 = icmp eq i32 %2, %5
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = sub nsw i32 %3, %6
%12 = mul nsw i32 %11, 21
%13 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %12, i32* %13
br label %14
14: ; preds = %10, %1
ret void
}
void UpnpPresentationRequest(void *upnptoken, struct packetheader *packet) {}


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

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

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

LLVM IR (-O2):
%struct.packetheader = type opaque
define void @UpnpPresentationRequest(i8* nocapture %0, %struct.packetheader* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ stdout;
void my_c_hello(const char *msg) { fprintf(stdout, msg); }


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

x86 assembly (clang, -O2):
<my_c_hello>:
mov    %rdi,%rsi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @my_c_hello(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @my_c_hello(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __disable_irq();
int __get_PRIMASK();
int __sd_nvic_irq_disable(void) {
  int pm = __get_PRIMASK();
  __disable_irq();
  return pm;
}


x86 assembly (clang, -O0):
<__sd_nvic_irq_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <__get_PRIMASK@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__disable_irq@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sd_nvic_irq_disable>:
push   %rbx
xor    %eax,%eax
call   1040 <__get_PRIMASK@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__disable_irq@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @__sd_nvic_irq_disable() {
%1 = alloca i32
%2 = call i32 (...) @__get_PRIMASK()
store i32 %2, i32* %1
%3 = call i32 (...) @__disable_irq()
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @__sd_nvic_irq_disable() {
%1 = tail call i32 (...) @__get_PRIMASK()
%2 = tail call i32 (...) @__disable_irq()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ ldo_power_off();
int /*<<< orphan*/ operation_sleep();
int /*<<< orphan*/ set_wakeup_timer(int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/);
void operation_sleep_notimer(void) {
  ldo_power_off();
  set_wakeup_timer(0, 0, 0);
  delay(100);
  operation_sleep();
}


x86 assembly (clang, -O0):
<operation_sleep_notimer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <ldo_power_off@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1050 <set_wakeup_timer@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x0,%al
call   1040 <operation_sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_sleep_notimer>:
push   %rax
xor    %eax,%eax
call   1060 <ldo_power_off@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <set_wakeup_timer@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <operation_sleep@plt>

LLVM IR (-O0):
define void @operation_sleep_notimer() {
%1 = call i32 (...) @ldo_power_off()
%2 = call i32 @set_wakeup_timer(i32 0, i32 0, i32 0)
%3 = call i32 @delay(i32 100)
%4 = call i32 (...) @operation_sleep()
ret void
}

LLVM IR (-O2):
define void @operation_sleep_notimer() {
%1 = tail call i32 (...) @ldo_power_off()
%2 = tail call i32 @set_wakeup_timer(i32 0, i32 0, i32 0)
%3 = tail call i32 @delay(i32 100)
%4 = tail call i32 (...) @operation_sleep()
ret void
}
FNIEMOP_DEF(iemOp_mov_Td_Rd) {
  IEMOP_MNEMONIC("mov Td,Rd");
  return IEMOP_RAISE_INVALID_OPCODE();
}


x86 assembly (clang, -O0):
<FNIEMOP_DEF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1040 <IEMOP_MNEMONIC@plt>
mov    $0x0,%al
call   1030 <IEMOP_RAISE_INVALID_OPCODE@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [10 x i8] c"mov Td,Rd\00"
define i32 @FNIEMOP_DEF(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @IEMOP_MNEMONIC to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @IEMOP_RAISE_INVALID_OPCODE()
ret i32 %4
}

LLVM IR (-O2):
@.str = [10 x i8] c"mov Td,Rd\00"
define i32 @FNIEMOP_DEF(i32 %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @IEMOP_MNEMONIC to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @IEMOP_RAISE_INVALID_OPCODE()
ret i32 %3
}
/* Variables and functions */
int write(int, char const *, int);
int g_file_write(int fd, const char *ptr, int len) {
  return write(fd, ptr, len);
}


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

x86 assembly (clang, -O2):
<g_file_write>:
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @g_file_write(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ at_init();
int /*<<< orphan*/ ide_init();
int /*<<< orphan*/ scat_init();
void at_scat_init() {
  at_init();
  ide_init();
  scat_init();
}


x86 assembly (clang, -O0):
<at_scat_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <at_init@plt>
mov    $0x0,%al
call   1050 <ide_init@plt>
mov    $0x0,%al
call   1040 <scat_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<at_scat_init>:
push   %rax
xor    %eax,%eax
call   1030 <at_init@plt>
xor    %eax,%eax
call   1050 <ide_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <scat_init@plt>

LLVM IR (-O0):
define void @at_scat_init() {
%1 = call i32 (...) @at_init()
%2 = call i32 (...) @ide_init()
%3 = call i32 (...) @scat_init()
ret void
}

LLVM IR (-O2):
define void @at_scat_init() {
%1 = tail call i32 (...) @at_init()
%2 = tail call i32 (...) @ide_init()
%3 = tail call i32 (...) @scat_init()
ret void
}
/* Variables and functions */
int sci_get_chip_id();
int soc_id_is_sc8735gv0(void) {
  return ((sci_get_chip_id() & (0xFFFFFFFF)) == ((0x8730b000) & (0xFFFFFFFF)));
}


x86 assembly (clang, -O0):
<soc_id_is_sc8735gv0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sci_get_chip_id@plt>
and    $0xffffffff,%eax
cmp    $0x8730b000,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<soc_id_is_sc8735gv0>:
push   %rax
xor    %eax,%eax
call   1030 <sci_get_chip_id@plt>
xor    %ecx,%ecx
cmp    $0x8730b000,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @soc_id_is_sc8735gv0() {
%1 = call i32 (...) @sci_get_chip_id()
%2 = and i32 %1, -1
%3 = icmp eq i32 %2, -2026852352
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @soc_id_is_sc8735gv0() {
%1 = tail call i32 (...) @sci_get_chip_id()
%2 = icmp eq i32 %1, -2026852352
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ WaterPumpC__ReqValue__changed();
void DisseminatorP__0__DisseminationValue__changed(void) {
  WaterPumpC__ReqValue__changed();
}


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

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

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

LLVM IR (-O2):
define void @DisseminatorP__0__DisseminationValue__changed() {
%1 = tail call i32 (...) @WaterPumpC__ReqValue__changed()
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rotl32(uint32_t x, uint32_t y) { return (x << y) | (x >> (32 - y)); }


x86 assembly (clang, -O0):
<rotl32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotl32>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
sar    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rotl32(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 = shl i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = ashr i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rotl32(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = ashr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
int isname(c)
char c;
{ return (!isspace(c)); }


x86 assembly (clang, -O0):
<isname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isname>:
push   %rax
movsbl %dil,%edi
call   1030 <isspace@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @isname(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 @isspace(i32 %5)
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @isname(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = tail call i32 @isspace(i32 %3)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void compute_hash(const void *key, size_t key_len, uint32_t *h1, uint32_t *h2) {
  extern void hashlittle2(const void *key, size_t length, uint32_t *pc,
                          uint32_t *pb);
  *h1 = 0x3ac5d673;
  *h2 = 0x6d7839d0;
  hashlittle2(key, key_len, h1, h2);
  if (*h1 != *h2) {
    return;
  } else {
    *h2 = ~*h2;

    ;
  }
}


x86 assembly (clang, -O0):
<compute_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x3ac5d673,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x6d7839d0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <hashlittle2@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
je     1168 <compute_hash+0x58>
jmp    1177 <compute_hash+0x67>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_hash>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
movl   $0x3ac5d673,(%rdx)
movl   $0x6d7839d0,(%rcx)
call   1030 <hashlittle2@plt>
mov    (%rbx),%eax
cmp    (%r14),%eax
jne    1137 <compute_hash+0x27>
not    %eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @compute_hash(i8* %0, i64 %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i32*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32*, i32** %7
store i32 986044019, i32* %9
%10 = load i32*, i32** %8
store i32 1836595664, i32* %10
%11 = load i8*, i8** %5
%12 = load i64, i64* %6
%13 = load i32*, i32** %7
%14 = load i32*, i32** %8
%15 = load i32*, i32** %7
%16 = load i32, i32* %15
%17 = load i32*, i32** %8
%18 = load i32, i32* %17
%19 = icmp ne i32 %16, %18
br i1 %19, label %20, label %21
20: ; preds = %4
br label %26
21: ; preds = %4
%22 = load i32*, i32** %8
%23 = load i32, i32* %22
%24 = xor i32 %23, -1
%25 = load i32*, i32** %8
store i32 %24, i32* %25
br label %26
26: ; preds = %20, %21
ret void
}

LLVM IR (-O2):
define void @compute_hash(i8* %0, i64 %1, i32* %2, i32* %3) {
store i32 986044019, i32* %2
store i32 1836595664, i32* %3
tail call void @hashlittle2(i8* %0, i64 %1, i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = xor i32 %5, -1
store i32 %9, i32* %3
br label %10
10: ; preds = %4, %8
ret void
}