xunge/DecIR huggingface dataset:
/* Variables and functions */
int fibonacci(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  printf("Enter Fibonacci number:\n");
  scanf("%d", &a);
  printf("Fibonacci number:\n");
  printf("%d\n", fibonacci(a));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <fibonacci@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
call   1050 <fibonacci@plt>
lea    0xe89(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter Fibonacci number:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Fibonacci number:\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* %1
%6 = call i32 @fibonacci(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [24 x i8] c"Enter Fibonacci number:\00"
@str.4 = [18 x i8] c"Fibonacci number:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 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 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = call i32 @fibonacci(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void mul_reg32(unsigned long reg32) {
  put8(0xF7);
  put8(0xE0 + reg32);
}


x86 assembly (clang, -O0):
<mul_reg32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xf7,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
add    $0xe0,%rax
mov    %eax,%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mul_reg32>:
push   %rbx
mov    %rdi,%rbx
mov    $0xf7,%edi
call   1030 <put8@plt>
add    $0xe0,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @mul_reg32(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @put8(i32 247)
%4 = load i64, i64* %2
%5 = add i64 224, %4
%6 = trunc i64 %5 to i32
%7 = call i32 @put8(i32 %6)
ret void
}

LLVM IR (-O2):
define void @mul_reg32(i64 %0) {
%2 = tail call i32 @put8(i32 247)
%3 = trunc i64 %0 to i32
%4 = add i32 %3, 224
%5 = tail call i32 @put8(i32 %4)
ret void
}
int MultHi(int v, int coeff) { return (v * coeff) >> 8; }


x86 assembly (clang, -O0):
<MultHi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
sar    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MultHi>:
mov    %edi,%eax
imul   %esi,%eax
sar    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @MultHi(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 = mul nsw i32 %5, %6
%8 = ashr i32 %7, 8
ret i32 %8
}

LLVM IR (-O2):
define i32 @MultHi(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = ashr i32 %3, 8
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hey!\n");
  return (0);
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"hey!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct _CSSOM_StackItem_Int {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CSSOM_free(struct _CSSOM_StackItem_Int *);
void StackItem_Int_free(struct _CSSOM_StackItem_Int *item) { CSSOM_free(item); }


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

x86 assembly (clang, -O2):
<StackItem_Int_free>:
jmp    1030 <CSSOM_free@plt>

LLVM IR (-O0):
%struct._CSSOM_StackItem_Int = type { i32 }
define void @StackItem_Int_free(%struct._CSSOM_StackItem_Int* %0) {
%2 = alloca %struct._CSSOM_StackItem_Int*
store %struct._CSSOM_StackItem_Int* %0, %struct._CSSOM_StackItem_Int** %2
%3 = load %struct._CSSOM_StackItem_Int*, %struct._CSSOM_StackItem_Int** %2
%4 = call i32 @CSSOM_free(%struct._CSSOM_StackItem_Int* %3)
ret void
}

LLVM IR (-O2):
%struct._CSSOM_StackItem_Int = type { i32 }
define void @StackItem_Int_free(%struct._CSSOM_StackItem_Int* %0) {
%2 = tail call i32 @CSSOM_free(%struct._CSSOM_StackItem_Int* %0)
ret void
}
/* Variables and functions */
int ipmi_close_();
int ipmi_close(void) { return (ipmi_close_()); }


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

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

LLVM IR (-O0):
define i32 @ipmi_close() {
%1 = call i32 (...) @ipmi_close_()
ret i32 %1
}

LLVM IR (-O2):
define i32 @ipmi_close() {
%1 = tail call i32 (...) @ipmi_close_()
ret i32 %1
}
long sum(long x, long s, long n) {
  if (x == n)
    return s;
  else
    return sum(x + 1, s + 1, n);
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    113f <sum+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115c <sum+0x4c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <sum@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
lea    (%rdx,%rsi,1),%rax
sub    %rdi,%rax
cmp    %rdx,%rdi
cmove  %rsi,%rax
ret

LLVM IR (-O0):
define i64 @sum(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load i64, i64* %5
%9 = load i64, i64* %7
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load i64, i64* %6
store i64 %12, i64* %4
br label %20
13: ; preds = %3
%14 = load i64, i64* %5
%15 = add nsw i64 %14, 1
%16 = load i64, i64* %6
%17 = add nsw i64 %16, 1
%18 = load i64, i64* %7
%19 = call i64 @sum(i64 %15, i64 %17, i64 %18)
store i64 %19, i64* %4
br label %20
20: ; preds = %13, %11
%21 = load i64, i64* %4
ret i64 %21
}

LLVM IR (-O2):
define i64 @sum(i64 %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %0, %2
%5 = add i64 %2, %1
%6 = sub i64 %5, %0
%7 = select i1 %4, i64 %1, i64 %6
ret i64 %7
}
void ptrace_sandbox_permit_utime(struct pt_sandbox *p_sandbox) {
  (void)p_sandbox;
}


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

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

LLVM IR (-O0):
%struct.pt_sandbox = type opaque
define void @ptrace_sandbox_permit_utime(%struct.pt_sandbox* %0) {
%2 = alloca %struct.pt_sandbox*
store %struct.pt_sandbox* %0, %struct.pt_sandbox** %2
%3 = load %struct.pt_sandbox*, %struct.pt_sandbox** %2
ret void
}

LLVM IR (-O2):
%struct.pt_sandbox = type opaque
define void @ptrace_sandbox_permit_utime(%struct.pt_sandbox* nocapture %0) {
ret void
}
/* Type definitions */
typedef size_t ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t write(int, void const *, size_t);
void checked_write(int fd, const void *buf, size_t count) {
  ssize_t rc = write(fd, buf, count);
  assert(rc == count);
}


x86 assembly (clang, -O0):
<checked_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_write>:
push   %rbx
mov    %rdx,%rbx
call   1030 <write@plt>
xor    %edi,%edi
cmp    %rbx,%rax
sete   %dil
pop    %rbx
jmp    1040 <assert@plt>

LLVM IR (-O0):
define void @checked_write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i64 @write(i32 %8, i8* %9, i64 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = load i64, i64* %6
%14 = icmp eq i64 %12, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
ret void
}

LLVM IR (-O2):
define void @checked_write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @write(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i64 %4, %2
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
ret void
}
int btobcd(a)
int a;
{ return (((a / 10) << 4) | (a % 10)); }


x86 assembly (clang, -O0):
<btobcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
or     %edx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @btobcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 10
%5 = shl i32 %4, 4
%6 = load i32, i32* %2
%7 = srem i32 %6, 10
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @btobcd(i32 %0) {
%2 = sdiv i32 %0, 10
%3 = shl i32 %2, 4
%4 = srem i32 %0, 10
%5 = or i32 %3, %4
ret i32 %5
}
void moo(int a, int *b) {
  printf("Address of a = %d, value of a = %d\n", &a, a);
  printf("Address of b = %d, value of b = %d, value of *b = %d\n", &b, b, *b);
}


x86 assembly (clang, -O0):
<moo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edx
lea    0xed7(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0xedf(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moo>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%edx
mov    %edi,0x4(%rsp)
mov    %rsi,0x8(%rsp)
lea    0xed6(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%ecx
lea    0xee5(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Address of a = %d, value of a = %d\0A\00"
@.str.1 = [54 x i8] c"Address of b = %d, value of b = %d, value of *b = %d\0A\00"
define void @moo(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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32* %3, i32 %5)
%7 = load i32*, i32** %4
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32** %4, i32* %7, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Address of a = %d, value of a = %d\0A\00"
@.str.1 = [54 x i8] c"Address of b = %d, value of b = %d, value of *b = %d\0A\00"
define void @moo(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32* %3, i32 %0)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32** %4, i32* %1, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ solve();
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    solve();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     115f <main+0x3f>
mov    $0x0,%al
call   1030 <solve@plt>
jmp    113f <main+0x1f>
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>
subl   $0x1,0x4(%rsp)
jb     114e <main+0x2e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <solve@plt>
subl   $0x1,0x4(%rsp)
jae    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\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 = add nsw i32 %4, -1
store i32 %5, i32* %1
%6 = icmp eq i32 %4, 0
br i1 %6, label %12, label %7
7: ; preds = %0, %7
%8 = call i32 (...) @solve()
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %0
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
int random_byte_lfsr32();
uint8_t random_ubyte_in(uint8_t min, uint8_t max) {
  uint16_t a_random_byte = random_byte_lfsr32();
  a_random_byte *= (max - min + 1);
  return (uint8_t)((a_random_byte >> 8) + min);
}


x86 assembly (clang, -O0):
<random_ubyte_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <random_byte_lfsr32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_ubyte_in>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <random_byte_lfsr32@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
imul   %ebx,%eax
sar    $0x8,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_ubyte_in(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (...) @random_byte_lfsr32()
store i32 %6, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = add nsw i32 %9, 1
%11 = load i32, i32* %5
%12 = mul nsw i32 %11, %10
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = ashr i32 %13, 8
%15 = load i32, i32* %3
%16 = add nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @random_ubyte_in(i32 %0, i32 %1) {
%3 = tail call i32 (...) @random_byte_lfsr32()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = mul nsw i32 %3, %5
%7 = ashr i32 %6, 8
%8 = add nsw i32 %7, %0
ret i32 %8
}
char *fd2data(struct Fd *fd) {
  return ((char *)((0x20000000 + 32 * 4096) + (fd2num(fd)) * 4096));
}


x86 assembly (clang, -O0):
<fd2data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <fd2num@plt>
shl    $0xc,%eax
add    $0x20020000,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd2data>:
push   %rax
xor    %eax,%eax
call   1030 <fd2num@plt>
shl    $0xc,%eax
add    $0x20020000,%eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
%struct.Fd = type opaque
define i8* @fd2data(%struct.Fd* %0) {
%2 = alloca %struct.Fd*
store %struct.Fd* %0, %struct.Fd** %2
%3 = load %struct.Fd*, %struct.Fd** %2
%4 = call i32 (%struct.Fd*, ...) bitcast (i32 (...)* @fd2num to i32 (%struct.Fd*, ...)*)(%struct.Fd* %3)
%5 = mul nsw i32 %4, 4096
%6 = add nsw i32 537001984, %5
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
%struct.Fd = type opaque
define i8* @fd2data(%struct.Fd* %0) {
%2 = tail call i32 (%struct.Fd*, ...) bitcast (i32 (...)* @fd2num to i32 (%struct.Fd*, ...)*)(%struct.Fd* %0)
%3 = shl nsw i32 %2, 12
%4 = add nsw i32 %3, 537001984
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
void CyBle_BasInit(void) {}


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

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

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

LLVM IR (-O2):
define void @CyBle_BasInit() {
ret void
}
void RTFileIsValid(void) {}


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

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

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

LLVM IR (-O2):
define void @RTFileIsValid() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RecursiveReturn();
int /*<<< orphan*/ TXTOUT(char *);
void EndVAR() {
  TXTOUT("}");
  RecursiveReturn();
}


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"}\00"
define void @EndVAR() {
%1 = tail call i32 @TXTOUT(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @RecursiveReturn()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_stateI(void *state) { free(state); }


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

x86 assembly (clang, -O2):
<free_stateI>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_stateI(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ QSort1(int *, int /*<<< orphan*/, int);
void QuickSort1(int a[], int n) { QSort1(a, 0, n - 1); }


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

x86 assembly (clang, -O2):
<QuickSort1>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <QSort1@plt>

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

LLVM IR (-O2):
define void @QuickSort1(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @QSort1(i32* %0, i32 0, i32 %3)
ret void
}
short horizontalOffset(short pixWidth, short pixOffset, short resolution) {
  return (((5100 * resolution / 600 - pixWidth) + pixOffset * 2) + 7) / 8;
}


x86 assembly (clang, -O0):
<horizontalOffset>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %si,%cx
mov    %di,%dx
mov    %dx,-0x2(%rbp)
mov    %cx,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
imul   $0x13ec,%eax,%eax
mov    $0x258,%ecx
cltd
idiv   %ecx
movswl -0x2(%rbp),%ecx
sub    %ecx,%eax
movswl -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
add    $0x7,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<horizontalOffset>:
imul   $0x13ec,%edx,%eax
cltq
imul   $0x1b4e81b5,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
add    %esi,%esi
sub    %edi,%esi
lea    (%rsi,%rax,1),%ecx
add    $0x7,%ecx
add    %esi,%eax
add    $0xe,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
shr    $0x3,%eax
ret

LLVM IR (-O0):
define signext i16 @horizontalOffset(i16 signext %0, i16 signext %1, i16 signext %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = load i16, i16* %6
%8 = sext i16 %7 to i32
%9 = mul nsw i32 5100, %8
%10 = sdiv i32 %9, 600
%11 = load i16, i16* %4
%12 = sext i16 %11 to i32
%13 = sub nsw i32 %10, %12
%14 = load i16, i16* %5
%15 = sext i16 %14 to i32
%16 = mul nsw i32 %15, 2
%17 = add nsw i32 %13, %16
%18 = add nsw i32 %17, 7
%19 = sdiv i32 %18, 8
%20 = trunc i32 %19 to i16
ret i16 %20
}

LLVM IR (-O2):
define signext i16 @horizontalOffset(i16 signext %0, i16 signext %1, i16 signext %2) {
%4 = sext i16 %2 to i32
%5 = mul nsw i32 %4, 5100
%6 = sdiv i32 %5, 600
%7 = sext i16 %0 to i32
%8 = sext i16 %1 to i32
%9 = shl nsw i32 %8, 1
%10 = sub nsw i32 7, %7
%11 = add nsw i32 %10, %9
%12 = add nsw i32 %11, %6
%13 = sdiv i32 %12, 8
%14 = trunc i32 %13 to i16
ret i16 %14
}
/* Variables and functions */
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdin;
scalar_t__ valid_serial(char *);
int validate_serial() {
  char serial[24];
  fscanf(stdin, "%s", serial);
  if (valid_serial(serial))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<validate_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rdx
lea    0xec4(%rip),%rsi
call   1030 <fscanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <valid_serial@plt>
cmp    $0x0,%rax
je     1160 <validate_serial+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1167 <validate_serial+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_serial>:
push   %rbx
sub    $0x20,%rsp
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdx
call   1030 <fscanf@plt>
mov    %rbx,%rdi
call   1040 <valid_serial@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @validate_serial() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fscanf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i64 @valid_serial(i8* %2)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int age = 29;
  int height = 86;
  printf("I am %d years old.\n", age);
  printf("I am %d inches tall.\n", height);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1d,%esi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x56,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 29, i32* %2
store i32 86, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 29)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 86)
ret i32 0
}
void wifi_evt_sme_wps_credential_password(
    const struct wifi_msg_sme_wps_credential_password_evt_t *msg) {}


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

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

LLVM IR (-O0):
%struct.wifi_msg_sme_wps_credential_password_evt_t = type opaque
define void @wifi_evt_sme_wps_credential_password(%struct.wifi_msg_sme_wps_credential_password_evt_t* %0) {
%2 = alloca %struct.wifi_msg_sme_wps_credential_password_evt_t*
store %struct.wifi_msg_sme_wps_credential_password_evt_t* %0, %struct.wifi_msg_sme_wps_credential_password_evt_t** %2
ret void
}

LLVM IR (-O2):
%struct.wifi_msg_sme_wps_credential_password_evt_t = type opaque
define void @wifi_evt_sme_wps_credential_password(%struct.wifi_msg_sme_wps_credential_password_evt_t* nocapture %0) {
ret void
}
/* Variables and functions */
int fail_real(int /*<<< orphan*/, int);
int test_select_(int, int, int);
int test_select(void) {
  if (test_select_(4, 5, 6) != 5)
    return fail_real(0, 676);
  if (test_select_(0, 5, 6) != 6)
    return fail_real(0, 678);
  return 0x80000000;
}


x86 assembly (clang, -O0):
<test_select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
mov    $0x5,%esi
mov    $0x6,%edx
call   1040 <test_select_@plt>
cmp    $0x5,%eax
je     1159 <test_select+0x39>
xor    %edi,%edi
mov    $0x2a4,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    118e <test_select+0x6e>
xor    %edi,%edi
mov    $0x5,%esi
mov    $0x6,%edx
call   1040 <test_select_@plt>
cmp    $0x6,%eax
je     1187 <test_select+0x67>
xor    %edi,%edi
mov    $0x2a6,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    118e <test_select+0x6e>
movl   $0x80000000,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_select>:
push   %rax
mov    $0x4,%edi
mov    $0x5,%esi
mov    $0x6,%edx
call   1040 <test_select_@plt>
mov    $0x2a4,%esi
cmp    $0x5,%eax
jne    1161 <test_select+0x41>
xor    %edi,%edi
mov    $0x5,%esi
mov    $0x6,%edx
call   1040 <test_select_@plt>
mov    $0x2a6,%esi
cmp    $0x6,%eax
jne    1161 <test_select+0x41>
mov    $0x80000000,%eax
pop    %rcx
ret
xor    %edi,%edi
pop    %rax
jmp    1030 <fail_real@plt>

LLVM IR (-O0):
define i32 @test_select() {
%1 = alloca i32
%2 = call i32 @test_select_(i32 4, i32 5, i32 6)
%3 = icmp ne i32 %2, 5
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @fail_real(i32 0, i32 676)
store i32 %5, i32* %1
br label %12
6: ; preds = %0
%7 = call i32 @test_select_(i32 0, i32 5, i32 6)
%8 = icmp ne i32 %7, 6
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @fail_real(i32 0, i32 678)
store i32 %10, i32* %1
br label %12
11: ; preds = %6
store i32 -2147483648, i32* %1
br label %12
12: ; preds = %11, %9, %4
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @test_select() {
%1 = tail call i32 @test_select_(i32 4, i32 5, i32 6)
%2 = icmp eq i32 %1, 5
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @test_select_(i32 0, i32 5, i32 6)
%5 = icmp eq i32 %4, 6
br i1 %5, label %9, label %6
6: ; preds = %3, %0
%7 = phi i32 [ 676, %0 ], [ 678, %3 ]
%8 = tail call i32 @fail_real(i32 0, i32 %7)
br label %9
9: ; preds = %6, %3
%10 = phi i32 [ -2147483648, %3 ], [ %8, %6 ]
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;
struct scsi_cmd {
  int dummy;
};

/* Variables and functions */
uint8_t smc_allow_removal(struct scsi_cmd *cmd) {
  ;
  return 0x00;
}


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

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

LLVM IR (-O0):
%struct.scsi_cmd = type { i32 }
define i32 @smc_allow_removal(%struct.scsi_cmd* %0) {
%2 = alloca %struct.scsi_cmd*
store %struct.scsi_cmd* %0, %struct.scsi_cmd** %2
ret i32 0
}

LLVM IR (-O2):
%struct.scsi_cmd = type { i32 }
define i32 @smc_allow_removal(%struct.scsi_cmd* nocapture readnone %0) {
ret i32 0
}
int get_response(int fd) {}


x86 assembly (clang, -O0):
<get_response>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @get_response(i32 %0) {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_BMPSTRING;

/* Variables and functions */
int /*<<< orphan*/ ASN1_BMPSTRING_it;
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, const unsigned char **in,
                                   long len) {
  return (ASN1_BMPSTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                         &ASN1_BMPSTRING_it);
}


x86 assembly (clang, -O0):
<d2i_ASN1_BMPSTRING>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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
mov    0x2ea9(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_ASN1_BMPSTRING>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@ASN1_BMPSTRING_it = global i32 0
define i32* @d2i_ASN1_BMPSTRING(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @ASN1_BMPSTRING_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@ASN1_BMPSTRING_it = global i32 0
define i32* @d2i_ASN1_BMPSTRING(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @ASN1_BMPSTRING_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Variables and functions */
int /*<<< orphan*/ factorial(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number;
  long fact = 1;
  printf("Enter a number to calculate it's factorial\n");
  scanf("%d", &number);
  printf("%d! = %ld\n", number, factorial(number));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <factorial@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1040 <factorial@plt>
lea    0xe8f(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Enter a number to calculate it's factorial\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"%d! = %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i32 0, i32* %1
store i64 1, i64* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 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 = load i32, i32* %2
%8 = call i32 @factorial(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"%d! = %ld\0A\00"
@str = [43 x i8] c"Enter a number to calculate it's factorial\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 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 = call i32 @factorial(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
char *cdio_get_default_device_osx(void) { return ((void *)0); }


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

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

LLVM IR (-O0):
define i8* @cdio_get_default_device_osx() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @cdio_get_default_device_osx() {
ret i8* null
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
void copyV2() {
  int c;
  while ((c = getchar()) != EOF) {
    putchar(c);
  }
}


x86 assembly (clang, -O0):
<copyV2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2eaf(%rip),%rcx
cmp    (%rcx),%eax
je     114e <copyV2+0x2e>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    1128 <copyV2+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyV2>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rbx
cmp    (%rbx),%eax
je     1152 <copyV2+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <copyV2+0x20>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @copyV2() {
%1 = alloca i32
br label %2
2: ; preds = %6, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* %1
%8 = call i32 @putchar(i32 %7)
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @copyV2() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @putchar(i32 %5)
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("\tUSAGE: ./fsort <inputfile> <sort type> <outputfile>\n\n");
  printf("\t<sort type>:\n\tBubble\t\t\tUseful for small lists\n");
  printf("\tMore to Come\n");
}


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

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
lea    0xf35(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"\09USAGE: ./fsort <inputfile> <sort type> <outputfile>\0A\0A\00"
@.str.1 = [48 x i8] c"\09<sort type>:\0A\09Bubble\09\09\09Useful for small lists\0A\00"
@.str.2 = [15 x i8] c"\09More to Come\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [54 x i8] c"\09USAGE: ./fsort <inputfile> <sort type> <outputfile>\0A\00"
@str.3 = [47 x i8] c"\09<sort type>:\0A\09Bubble\09\09\09Useful for small lists\00"
@str.4 = [14 x i8] c"\09More to Come\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Drone online!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Drone online!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void shl_reg64_cl(unsigned int reg64) {
  put8(0x48);
  put8(0xD3);
  put8(0xE0 + reg64);
}


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

x86 assembly (clang, -O2):
<shl_reg64_cl>:
push   %rbx
mov    %edi,%ebx
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0xd3,%edi
call   1030 <put8@plt>
add    $0xe0,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @shl_reg64_cl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 72)
%4 = call i32 @put8(i32 211)
%5 = load i32, i32* %2
%6 = add i32 224, %5
%7 = call i32 @put8(i32 %6)
ret void
}

LLVM IR (-O2):
define void @shl_reg64_cl(i32 %0) {
%2 = tail call i32 @put8(i32 72)
%3 = tail call i32 @put8(i32 211)
%4 = add i32 %0, 224
%5 = tail call i32 @put8(i32 %4)
ret void
}
int compute_answer() { return 42; }


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

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

LLVM IR (-O0):
define i32 @compute_answer() {
ret i32 42
}

LLVM IR (-O2):
define i32 @compute_answer() {
ret i32 42
}
/* Variables and functions */
int coord2diaglr(size_t x, size_t y) { return x + y; }


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

x86 assembly (clang, -O2):
<coord2diaglr>:
lea    (%rsi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @coord2diaglr(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add i64 %5, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @coord2diaglr(i64 %0, i64 %1) {
%3 = add i64 %1, %0
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int sqrt(int);
int check_prime(int num) {
  int i;
  int temp;
  temp = sqrt(num);
  for (i = 2; i <= temp; i++) {
    if (num % i == 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sqrt@plt>
mov    %eax,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1168 <check_prime+0x58>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1155 <check_prime+0x45>
movl   $0x0,-0x4(%rbp)
jmp    116f <check_prime+0x5f>
jmp    115a <check_prime+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <check_prime+0x1d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prime>:
push   %rbx
mov    %edi,%ebx
call   1030 <sqrt@plt>
mov    $0x1,%ecx
cmp    $0x2,%eax
jl     114f <check_prime+0x3f>
mov    %eax,%esi
neg    %esi
mov    $0x2,%edi
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
cltd
idiv   %edi
test   %edx,%edx
je     114d <check_prime+0x3d>
lea    (%rsi,%rdi,1),%eax
add    $0x1,%eax
mov    %edi,%edx
add    $0x1,%edx
mov    %edx,%edi
cmp    $0x1,%eax
jne    1130 <check_prime+0x20>
jmp    114f <check_prime+0x3f>
xor    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = tail call i32 @sqrt(i32 %0)
%3 = icmp slt i32 %2, 2
br i1 %3, label %11, label %7
4: ; preds = %7
%5 = add nuw i32 %8, 1
%6 = icmp eq i32 %8, %2
br i1 %6, label %11, label %7
7: ; preds = %1, %4
%8 = phi i32 [ %5, %4 ], [ 2, %1 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %12
}
int test_imm_BBuint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xBB << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_BBuint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 187
%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_BBuint64_midword_reg(i64 %0) {
%2 = and i64 %0, 12255232
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int serie(int);
int main() {
  int n;
  printf("Insira N: ");
  scanf("%d", &n);
  printf("S = %d\n", serie(n));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"Insira N: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"S = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 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* %2)
%5 = load i32, i32* %2
%6 = call i32 @serie(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Insira N: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"S = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 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 = call i32 @serie(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}