xunge/DecIR huggingface dataset:
void do_ushort_math(unsigned short int *x) {
  printf("%s: X before: %d\n", __func__, *x);
  *x += 5;
  printf("%s: X after: %d\n", __func__, *x);
}


x86 assembly (clang, -O0):
<do_ushort_math>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
lea    0xed6(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzwl (%rax),%ecx
add    $0x5,%ecx
mov    %cx,(%rax)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
lea    0xece(%rip),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_ushort_math>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzwl (%rdi),%edx
lea    0xedf(%rip),%rdi
lea    0xeea(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movzwl (%rbx),%eax
add    $0x5,%eax
mov    %ax,(%rbx)
movzwl %ax,%edx
lea    0xedc(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s: X before: %d\0A\00"
@__func__.do_ushort_math = [15 x i8] c"do_ushort_math\00"
@.str.1 = [17 x i8] c"%s: X after: %d\0A\00"
define void @do_ushort_math(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.do_ushort_math, i64 0, i64 0), i32 %5)
%7 = load i16*, i16** %2
%8 = load i16, i16* %7
%9 = zext i16 %8 to i32
%10 = add nsw i32 %9, 5
%11 = trunc i32 %10 to i16
store i16 %11, i16* %7
%12 = load i16*, i16** %2
%13 = load i16, i16* %12
%14 = zext i16 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.do_ushort_math, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s: X before: %d\0A\00"
@__func__.do_ushort_math = [15 x i8] c"do_ushort_math\00"
@.str.1 = [17 x i8] c"%s: X after: %d\0A\00"
define void @do_ushort_math(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = zext i16 %2 to i32
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.do_ushort_math, i64 0, i64 0), i32 %3)
%5 = load i16, i16* %0
%6 = add i16 %5, 5
store i16 %6, i16* %0
%7 = zext i16 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.do_ushort_math, i64 0, i64 0), i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ex1();
int /*<<< orphan*/ ex2();
int /*<<< orphan*/ ex3();
int /*<<< orphan*/ ex4();
int /*<<< orphan*/ ex5();
int /*<<< orphan*/ ex6();
int /*<<< orphan*/ print(char *);
int main(int argc, char **argv) {
  print("LISTA DE EXERCICIOS DE FDA - 03");
  ex1();
  ex2();
  ex3();
  ex4();
  ex5();
  ex6();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rdi
call   1060 <print@plt>
mov    $0x0,%al
call   1040 <ex1@plt>
mov    $0x0,%al
call   1090 <ex2@plt>
mov    $0x0,%al
call   1050 <ex3@plt>
mov    $0x0,%al
call   1080 <ex4@plt>
mov    $0x0,%al
call   1030 <ex5@plt>
mov    $0x0,%al
call   1070 <ex6@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe88(%rip),%rdi
call   1060 <print@plt>
xor    %eax,%eax
call   1040 <ex1@plt>
xor    %eax,%eax
call   1090 <ex2@plt>
xor    %eax,%eax
call   1050 <ex3@plt>
xor    %eax,%eax
call   1080 <ex4@plt>
xor    %eax,%eax
call   1030 <ex5@plt>
xor    %eax,%eax
call   1070 <ex6@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"LISTA DE EXERCICIOS DE FDA - 03\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @print(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @ex1()
%8 = call i32 (...) @ex2()
%9 = call i32 (...) @ex3()
%10 = call i32 (...) @ex4()
%11 = call i32 (...) @ex5()
%12 = call i32 (...) @ex6()
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"LISTA DE EXERCICIOS DE FDA - 03\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @print(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @ex1()
%5 = tail call i32 (...) @ex2()
%6 = tail call i32 (...) @ex3()
%7 = tail call i32 (...) @ex4()
%8 = tail call i32 (...) @ex5()
%9 = tail call i32 (...) @ex6()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
int debugclose(void) {
  closelog();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @debugclose() {
%1 = tail call i32 (...) @closelog()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int put_int(int x) {
  printf("%d\n", x);
  return 0;
}


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

x86 assembly (clang, -O2):
<put_int>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @put_int(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(short *);
short *malloc(int);
int main() {
  short *test = malloc(sizeof(short) * 3);
  test[1] = 9;
  free(test);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movw   $0x9,0x2(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
call   1040 <malloc@plt>
movw   $0x9,0x2(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16*
store i32 0, i32* %1
%3 = call i16* @malloc(i32 6)
store i16* %3, i16** %2
%4 = load i16*, i16** %2
%5 = getelementptr inbounds i16, i16* %4, i64 1
store i16 9, i16* %5
%6 = load i16*, i16** %2
%7 = call i32 @free(i16* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i16* @malloc(i32 6)
%2 = getelementptr inbounds i16, i16* %1, i64 1
store i16 9, i16* %2
%3 = tail call i32 @free(i16* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printfunE(void *, void *);
void __attribute__((no_instrument_function))
__cyg_profile_func_enter(void *this_fn, void *call_site) {
  printfunE(this_fn, call_site);
}


x86 assembly (clang, -O0):
<__cyg_profile_func_enter>:
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 <printfunE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cyg_profile_func_enter>:
jmp    1030 <printfunE@plt>

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

LLVM IR (-O2):
define void @__cyg_profile_func_enter(i8* %0, i8* %1) {
%3 = tail call i32 @printfunE(i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int PECIDomainValid(unsigned long);
void PECIDomainDisable(unsigned long ulBase, unsigned long ulDomain) {
  DEBUG_ASSERT(ulBase == 0x400B0000);
  DEBUG_ASSERT(PECIDomainValid(ulDomain));
  (*((volatile unsigned long *)(ulBase + 0x00000000))) &= ~(1 << ulDomain);
}


x86 assembly (clang, -O0):
<PECIDomainDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x400b0000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdi
call   1040 <PECIDomainValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
and    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PECIDomainDisable>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x400b0000,%r14
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %rbx,%rdi
call   1040 <PECIDomainValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    $0xfffffffe,%eax
mov    %ebx,%ecx
rol    %cl,%eax
cltq
and    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @PECIDomainDisable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1074462720
%7 = zext i1 %6 to i32
%8 = call i32 @DEBUG_ASSERT(i32 %7)
%9 = load i64, i64* %4
%10 = call i32 @PECIDomainValid(i64 %9)
%11 = call i32 @DEBUG_ASSERT(i32 %10)
%12 = load i64, i64* %4
%13 = trunc i64 %12 to i32
%14 = shl i32 1, %13
%15 = xor i32 %14, -1
%16 = sext i32 %15 to i64
%17 = load i64, i64* %3
%18 = add i64 %17, 0
%19 = inttoptr i64 %18 to i64*
%20 = load volatile i64, i64* %19
%21 = and i64 %20, %16
store volatile i64 %21, i64* %19
ret void
}

LLVM IR (-O2):
define void @PECIDomainDisable(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074462720
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = tail call i32 @PECIDomainValid(i64 %1)
%7 = tail call i32 @DEBUG_ASSERT(i32 %6)
%8 = trunc i64 %1 to i32
%9 = shl nuw i32 1, %8
%10 = xor i32 %9, -1
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %0 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, %11
store volatile i64 %14, i64* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ munmap(char *, size_t);
void anonfree(char *loc, size_t size) { munmap(loc, size); }


x86 assembly (clang, -O0):
<anonfree>:
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 <munmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anonfree>:
jmp    1030 <munmap@plt>

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

LLVM IR (-O2):
define void @anonfree(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t bit_rotl_u64(uint64_t x, int r) {
  return ((x << r) | (x >> (64 - r)));
}


x86 assembly (clang, -O0):
<bit_rotl_u64>:
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    $0x40,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bit_rotl_u64(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 64, %9
%11 = ashr i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @bit_rotl_u64(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub nsw i32 64, %1
%5 = ashr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int fib(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x = fib(10);
  printf("%d\n", x);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <fib@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @fib(i32 10)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @fib(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x84() {
  Assert_real((isbdigit(132) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              665, ("isbdigit should be 0 for 0x84"));
}


x86 assembly (clang, -O0):
<t_isbdigit_0x84>:
push   %rbp
mov    %rsp,%rbp
mov    $0x84,%edi
call   1040 <isbdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x299,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isbdigit_0x84>:
push   %rax
mov    $0x84,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x299,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x84\00"
define void @t_isbdigit_0x84() {
%1 = call i64 @isbdigit(i32 132)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 665, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x84\00"
define void @t_isbdigit_0x84() {
%1 = tail call i64 @isbdigit(i32 132)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 665, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void error(char *message) {
  fputs(message, stderr);
  putc('\n', stderr);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%esi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fputs(i8* %3, i32 %4)
%6 = load i32, i32* @stderr
%7 = call i32 @putc(i8 signext 10, i32 %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* %0, i32 %2)
%4 = load i32, i32* @stderr
%5 = tail call i32 @putc(i8 signext 10, i32 %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ write_config_bits_PIC24(unsigned long, unsigned char *, char,
                                           int);
void write_data_P24KA1(unsigned long address, unsigned char *data,
                       char blocksize, char lastblock) {
  write_config_bits_PIC24(address + 0x7FFE00, data, blocksize, 0x4004);
}


x86 assembly (clang, -O0):
<write_data_P24KA1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x7ffe00,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4004,%ecx
movsbl -0x11(%rbp),%edx
call   1030 <write_config_bits_PIC24@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_data_P24KA1>:
add    $0x7ffe00,%rdi
mov    $0x4004,%ecx
jmp    1030 <write_config_bits_PIC24@plt>

LLVM IR (-O0):
define void @write_data_P24KA1(i64 %0, i8* %1, i8 signext %2, i8 signext %3) {
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8
store i64 %0, i64* %5
store i8* %1, i8** %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i64, i64* %5
%10 = add i64 %9, 8388096
%11 = load i8*, i8** %6
%12 = load i8, i8* %7
%13 = call i32 @write_config_bits_PIC24(i64 %10, i8* %11, i8 signext %12, i32 16388)
ret void
}

LLVM IR (-O2):
define void @write_data_P24KA1(i64 %0, i8* %1, i8 signext %2, i8 signext %3) {
%5 = add i64 %0, 8388096
%6 = tail call i32 @write_config_bits_PIC24(i64 %5, i8* %1, i8 signext %2, i32 16388)
ret void
}
/* Type definitions */
typedef scalar_t__ const uint8_t;

/* Variables and functions */
void *memchr8(const void *s, uint8_t c, size_t n) {
  register const uint8_t *p = (const uint8_t *)s;
  while (n--) {
    if (*p == c)
      return ((void *)p);
    p++;
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<memchr8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1160 <memchr8+0x60>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jne    114f <memchr8+0x4f>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1168 <memchr8+0x68>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    1118 <memchr8+0x18>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memchr8>:
test   %rdx,%rdx
je     1122 <memchr8+0x22>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %rsi,(%rax)
je     1124 <memchr8+0x24>
add    $0xffffffffffffffff,%rdx
add    $0x8,%rax
test   %rdx,%rdx
jne    1110 <memchr8+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @memchr8(i8* %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %18, label %5
5: ; preds = %3
%6 = bitcast i8* %0 to i64*
br label %7
7: ; preds = %5, %15
%8 = phi i64 [ %10, %15 ], [ %2, %5 ]
%9 = phi i64* [ %16, %15 ], [ %6, %5 ]
%10 = add i64 %8, -1
%11 = load i64, i64* %9
%12 = icmp eq i64 %11, %1
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = bitcast i64* %9 to i8*
br label %18
15: ; preds = %7
%16 = getelementptr inbounds i64, i64* %9, i64 1
%17 = icmp eq i64 %10, 0
br i1 %17, label %18, label %7
18: ; preds = %15, %3, %13
%19 = phi i8* [ %14, %13 ], [ null, %3 ], [ null, %15 ]
ret i8* %19
}
/* Variables and functions */
unsigned int __mib_chain_total(int);
unsigned int _mib_chain_total(int id) { return __mib_chain_total(id); }


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

x86 assembly (clang, -O2):
<_mib_chain_total>:
jmp    1030 <__mib_chain_total@plt>

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

LLVM IR (-O2):
define i32 @_mib_chain_total(i32 %0) {
%2 = tail call i32 @__mib_chain_total(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ dy_stack_iterator_impl(void (*)(int *));
void dy_stack_iterator(void (*fn)(int *x)) { dy_stack_iterator_impl(fn); }


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

x86 assembly (clang, -O2):
<dy_stack_iterator>:
jmp    1030 <dy_stack_iterator_impl@plt>

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

LLVM IR (-O2):
define void @dy_stack_iterator(void (i32*)* %0) {
%2 = tail call i32 @dy_stack_iterator_impl(void (i32*)* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void usage(char *s) {
  printf("USAGE: %s r\n"
         "       %s w <reg0> <reg1> <reg2>\n",
         s, s);
}


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

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

LLVM IR (-O0):
@.str = [46 x i8] c"USAGE: %s r\0A %s w <reg0> <reg1> <reg2>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"USAGE: %s r\0A %s w <reg0> <reg1> <reg2>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __mf_set_options(char *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(int);
int main() {
  volatile int *k = (int *)malloc(sizeof(int));
  volatile int l;
  if (k == NULL)
    abort();
  *k = 5;
  free((void *)k);
  __mf_set_options("-ignore-reads");
  l = *k;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <main+0x2f>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
lea    0xe77(%rip),%rdi
call   1060 <__mf_set_options@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x4,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     117f <main+0x3f>
mov    %rax,%rbx
movl   $0x5,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
lea    0xe94(%rip),%rdi
call   1060 <__mf_set_options@plt>
mov    (%rbx),%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"-ignore-reads\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %0
%11 = load i32*, i32** %2
store volatile i32 5, i32* %11
%12 = load i32*, i32** %2
%13 = bitcast i32* %12 to i8*
%14 = call i32 @free(i8* %13)
%15 = call i32 @__mf_set_options(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%16 = load i32*, i32** %2
%17 = load volatile i32, i32* %16
store volatile i32 %17, i32* %3
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"-ignore-reads\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
%4 = bitcast i32* %1 to i8*
%5 = icmp eq i64 %2, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %0
store volatile i32 5, i32* %3
%9 = inttoptr i64 %2 to i8*
%10 = tail call i32 @free(i8* %9)
%11 = tail call i32 @__mf_set_options(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%12 = load volatile i32, i32* %3
store volatile i32 %12, i32* %1
ret i32 0
}
extern long div_ll_X_l_rem(long long divs, long div, long *rem) {
  long dum2;
  __asm__("divl %2" : "=a"(dum2), "=d"(*rem) : "rm"(div), "A"(divs));
  return dum2;
}


x86 assembly (clang, -O0):
<div_ll_X_l_rem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,-0x28(%rbp)
divl   -0x28(%rbp)
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,-0x20(%rbp)
mov    %rdx,(%rax)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i64 @div_ll_X_l_rem(i64 %0, i64 %1, i64* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64* %2, i64** %6
%8 = load i64*, i64** %6
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = call { i64, i64 } asm "divl $2", "={ax},={dx},rm,A,~{dirflag},~{fpsr},~{flags}"(i64 %9, i64 %10)
%12 = extractvalue { i64, i64 } %11, 0
%13 = extractvalue { i64, i64 } %11, 1
store i64 %12, i64* %7
store i64 %13, i64* %8
%14 = load i64, i64* %7
ret i64 %14
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ FF_trick(char **);
void FF_hand(char *hand[]) {
  int i = 0;
  while (i < 3)
    FF_trick(&hand[(i++) * 4]);
  FF_trick(&hand[9]);
}


x86 assembly (clang, -O0):
<FF_hand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1152 <FF_hand+0x42>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
shl    $0x2,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <FF_trick@plt>
jmp    1123 <FF_hand+0x13>
mov    -0x8(%rbp),%rdi
add    $0x48,%rdi
call   1030 <FF_trick@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FF_hand>:
push   %rbx
mov    %rdi,%rbx
call   1030 <FF_trick@plt>
lea    0x20(%rbx),%rdi
call   1030 <FF_trick@plt>
lea    0x40(%rbx),%rdi
call   1030 <FF_trick@plt>
add    $0x48,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <FF_trick@plt>

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

LLVM IR (-O2):
define void @FF_hand(i8** %0) {
%2 = tail call i32 @FF_trick(i8** %0)
%3 = getelementptr inbounds i8*, i8** %0, i64 4
%4 = tail call i32 @FF_trick(i8** %3)
%5 = getelementptr inbounds i8*, i8** %0, i64 8
%6 = tail call i32 @FF_trick(i8** %5)
%7 = getelementptr inbounds i8*, i8** %0, i64 9
%8 = tail call i32 @FF_trick(i8** %7)
ret void
}
/* Variables and functions */
scalar_t__ strncmp(char const *, char const *, int);
bool match_sentence_id(const char *str, const char *id) {
  return strncmp(str, id, (3)) == 0;
}


x86 assembly (clang, -O0):
<match_sentence_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_sentence_id>:
push   %rax
mov    $0x3,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @match_sentence_id(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 i64 @strncmp(i8* %5, i8* %6, i32 3)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @match_sentence_id(i8* %0, i8* %1) {
%3 = tail call i64 @strncmp(i8* %0, i8* %1, i32 3)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *add_linked_list(struct node *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
struct node *add_series_to_linked_list(void) {
  struct node *first;
  int i;
  printf("enter numbers!(enter 0 to leave loop)\r\n");
  for (;;) {
    scanf("%d", &i);
    if (i == 0)
      return first;
    first = add_linked_list(first, i);
  }
}


x86 assembly (clang, -O0):
<add_series_to_linked_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1168 <add_series_to_linked_list+0x38>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <add_linked_list@plt>
mov    %rax,-0x8(%rbp)
jmp    1144 <add_series_to_linked_list+0x14>

x86 assembly (clang, -O2):
<add_series_to_linked_list>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [40 x i8] c"enter numbers!(enter 0 to leave loop)\0D\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define %struct.node* @add_series_to_linked_list() {
%1 = alloca %struct.node*
%2 = alloca i32
%3 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %10, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = load %struct.node*, %struct.node** %1
ret %struct.node* %9
10: ; preds = %4
%11 = load %struct.node*, %struct.node** %1
%12 = load i32, i32* %2
%13 = call %struct.node* @add_linked_list(%struct.node* %11, i32 %12)
store %struct.node* %13, %struct.node** %1
br label %4
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str.1 = [3 x i8] c"%d\00"
@str = [39 x i8] c"enter numbers!(enter 0 to leave loop)\0D\00"
define %struct.node* @add_series_to_linked_list() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
ret %struct.node* undef
}
int test_imm_BDuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xBD << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BDuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 189
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int get_num(char *, char *);
char *long2str(char *, int);
char *macmul(char *arg) {
  return (long2str(arg, get_num("mul", arg) * get_num("mul", arg)));
}


x86 assembly (clang, -O0):
<macmul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <get_num@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1030 <get_num@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdi
imul   %eax,%esi
call   1040 <long2str@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macmul>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <get_num@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <get_num@plt>
imul   %eax,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <long2str@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"mul\00"
define i8* @macmul(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @get_num(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @get_num(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = mul nsw i32 %5, %7
%9 = call i8* @long2str(i8* %3, i32 %8)
ret i8* %9
}

LLVM IR (-O2):
@.str = [4 x i8] c"mul\00"
define i8* @macmul(i8* %0) {
%2 = tail call i32 @get_num(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @get_num(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = mul nsw i32 %3, %2
%5 = tail call i8* @long2str(i8* %0, i32 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ nfs_arya_1(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char *host;
  if (argc < 2) {
    printf("usage: %s server_host\n", argv[0]);
    exit(1);
  }
  host = argv[1];
  nfs_arya_1(host);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <nfs_arya_1@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     114f <main+0x1f>
mov    (%rsi),%rsi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x8(%rsi),%rdi
call   1040 <nfs_arya_1@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"usage: %s server_host\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = call i32 @nfs_arya_1(i8* %19)
%21 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"usage: %s server_host\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @nfs_arya_1(i8* %10)
%12 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int recv(int, void *, int, int);
int tcp_recv(int skt, void *ptr, int len, int flags) {
  return recv(skt, ptr, len, flags);
}


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

x86 assembly (clang, -O2):
<tcp_recv>:
jmp    1030 <recv@plt>

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

LLVM IR (-O2):
define i32 @tcp_recv(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @recv(i32 %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
void ext_exp2exp() {}


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

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

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

LLVM IR (-O2):
define void @ext_exp2exp() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void show_help(char *msg) {
  printf("Arguments error: %s\n", msg);
  printf("Usage:\n");
  printf("led_tool red_val green_val blue_val\n\n");
  printf("Where red_val, green_val and blue_val are [0..255] brightness "
         "level\n\n");
}


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

x86 assembly (clang, -O2):
<show_help>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Arguments error: %s\0A\00"
@.str.1 = [8 x i8] c"Usage:\0A\00"
@.str.2 = [38 x i8] c"led_tool red_val green_val blue_val\0A\0A\00"
@.str.3 = [70 x i8] c"Where red_val, green_val and blue_val are [0..255] brightness level\0A\0A\00"
define void @show_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Arguments error: %s\0A\00"
@str = [7 x i8] c"Usage:\00"
@str.4 = [37 x i8] c"led_tool red_val green_val blue_val\0A\00"
@str.5 = [69 x i8] c"Where red_val, green_val and blue_val are [0..255] brightness level\0A\00"
define void @show_help(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str.5, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ go(int /*<<< orphan*/, int, int, int, int, int, int, int,
                      int, int);
void handle(int sig) {
  go(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
  exit(0);
}


x86 assembly (clang, -O0):
<handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
movl   $0x6,(%rsp)
movl   $0x7,0x8(%rsp)
movl   $0x8,0x10(%rsp)
movl   $0x9,0x18(%rsp)
call   1030 <go@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handle>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
push   $0x9
push   $0x8
push   $0x7
push   $0x6
call   1030 <go@plt>
add    $0x20,%rsp
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @handle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @go(i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @handle(i32 %0) {
%2 = tail call i32 @go(i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ readidew(int /*<<< orphan*/);
uint16_t ide_read_pri_w(uint16_t addr, void *priv) { return readidew(0); }


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

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

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

LLVM IR (-O2):
define i32 @ide_read_pri_w(i32 %0, i8* nocapture readnone %1) {
%3 = tail call i32 @readidew(i32 0)
ret i32 %3
}
unsigned int bytes2uint(char *bytes) {
  return ((unsigned char)bytes[0] << 24) + ((unsigned char)bytes[1] << 16) +
         ((unsigned char)bytes[2] << 8) + (unsigned char)bytes[3];
}


x86 assembly (clang, -O0):
<bytes2uint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
add    %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bytes2uint(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
ret i32 %18
}