xunge/DecIR huggingface dataset:
void Delay1Ms_Counting(void) {
  register int i;
  for (i = 0; i < (4200); i++) {
  }
}


x86 assembly (clang, -O0):
<Delay1Ms_Counting>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x1068,-0x4(%rbp)
jge    112b <Delay1Ms_Counting+0x2b>
jmp    111d <Delay1Ms_Counting+0x1d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <Delay1Ms_Counting+0xb>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @Delay1Ms_Counting() {
ret void
}
void makeopt2(void) {}


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

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

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

LLVM IR (-O2):
define void @makeopt2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PR_SET_NAME;
int /*<<< orphan*/ prctl(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
void ChangePrcName(int sid) {
  char szTempName[32];
  sprintf(szTempName, "scs_%04d", sid);
  prctl(PR_SET_NAME, szTempName, 0, 0, 0);
}


x86 assembly (clang, -O0):
<ChangePrcName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rsi
call   1040 <sprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <prctl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ChangePrcName>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%edx
lea    0xed2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <prctl@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"scs_%04d\00"
@PR_SET_NAME = global i32 0
define void @ChangePrcName(i32 %0) {
%2 = alloca i32
%3 = alloca [32 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @PR_SET_NAME
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%9 = call i32 @prctl(i32 %7, i8* %8, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"scs_%04d\00"
@PR_SET_NAME = global i32 0
define void @ChangePrcName(i32 %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = load i32, i32* @PR_SET_NAME
%6 = call i32 @prctl(i32 %5, i8* %3, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
void unix_error() {
  if (errno != 0) {
    fprintf(stderr, "%s", strerror(errno));
  }
}


x86 assembly (clang, -O0):
<unix_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
cmpq   $0x0,(%rax)
je     1166 <unix_error+0x46>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%rdi
call   1040 <strerror@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xe9f(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unix_error>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     1150 <unix_error+0x30>
mov    0x2ea9(%rip),%rax
mov    (%rax),%ebx
call   1040 <strerror@plt>
lea    0xebb(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
pop    %rbx
jmp    1030 <fprintf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i64 0
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @unix_error() {
%1 = load i64, i64* @errno
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = load i64, i64* @errno
%6 = call i8* @strerror(i64 %5)
%7 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @unix_error() {
%1 = load i64, i64* @errno
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i8* @strerror(i64 %1)
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %3, %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ send_to_rsocket(int /*<<< orphan*/, void *,
                                   int /*<<< orphan*/, int);
int64_t send_to_socket_noconfirm(int64_t s, void *data, int64_t length) {
  return send_to_rsocket(s, data, length, 1);
}


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

x86 assembly (clang, -O2):
<send_to_socket_noconfirm>:
mov    $0x1,%ecx
jmp    1030 <send_to_rsocket@plt>

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

LLVM IR (-O2):
define i32 @send_to_socket_noconfirm(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @send_to_rsocket(i32 %0, i8* %1, i32 %2, i32 1)
ret i32 %4
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int initialize_standard_solution(int k) {
  int fail, *b;
  double *c;
  fail = _ada_use_c2phc(503, &k, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<initialize_standard_solution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1f7,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_standard_solution>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1f7,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @initialize_standard_solution(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %4
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc(i32 503, i32* %2, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @initialize_standard_solution(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc(i32 503, i32* %2, i32* undef, double* undef)
ret i32 %3
}
/* Variables and functions */
int foo();
int callfoo() { return foo(); }


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

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

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

LLVM IR (-O2):
define i32 @callfoo() {
%1 = tail call i32 (...) @foo()
ret i32 %1
}
/* Variables and functions */
char *read_file(char *, int *, int /*<<< orphan*/);
int mmap_file(char *name, void **p_ptr, int *length_ptr, int *fd_ptr) {
  char *c;
  int length;
  if ((c = read_file(name, &length, 0)) == NULL)
    return 1;
  *p_ptr = c;
  *length_ptr = length;
  *fd_ptr = -1;
  return 0;
}


x86 assembly (clang, -O0):
<mmap_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x34(%rbp),%rsi
xor    %edx,%edx
call   1030 <read_file@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1151 <mmap_file+0x41>
movl   $0x1,-0x4(%rbp)
jmp    1176 <mmap_file+0x66>
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmap_file>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
lea    0x4(%rsp),%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1030 <read_file@plt>
test   %rax,%rax
je     1148 <mmap_file+0x38>
mov    %rax,(%r12)
mov    0x4(%rsp),%eax
mov    %eax,(%r15)
movl   $0xffffffff,(%r14)
jmp    114d <mmap_file+0x3d>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @mmap_file(i8* %0, i8** nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = call i8* @read_file(i8* %0, i32* %5, i32 0)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %4
store i8* %7, i8** %1
%10 = load i32, i32* %5
store i32 %10, i32* %2
store i32 -1, i32* %3
br label %11
11: ; preds = %4, %9
%12 = phi i32 [ 0, %9 ], [ 1, %4 ]
ret i32 %12
}
unsigned size_hint_to_size(unsigned hint) {
  unsigned i;
  for (i = 1; i < hint; i *= 2) {
  }
  return 128u > i ? 128u : i;
}


x86 assembly (clang, -O0):
<size_hint_to_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    112d <size_hint_to_size+0x2d>
jmp    111f <size_hint_to_size+0x1f>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <size_hint_to_size+0xe>
mov    $0x80,%eax
cmp    -0x8(%rbp),%eax
jbe    1148 <size_hint_to_size+0x48>
mov    $0x80,%eax
mov    %eax,-0xc(%rbp)
jmp    114e <size_hint_to_size+0x4e>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_hint_to_size>:
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%ecx
lea    (%rcx,%rcx,1),%eax
cmp    %edi,%ecx
jb     1110 <size_hint_to_size+0x10>
cmp    $0x81,%ecx
mov    $0x80,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @size_hint_to_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp ult i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %4
br label %9
9: ; preds = %8
%10 = load i32, i32* %3
%11 = mul i32 %10, 2
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
%14 = icmp ugt i32 128, %13
br i1 %14, label %15, label %16
15: ; preds = %12
br label %18
16: ; preds = %12
%17 = load i32, i32* %3
br label %18
18: ; preds = %16, %15
%19 = phi i32 [ 128, %15 ], [ %17, %16 ]
ret i32 %19
}

LLVM IR (-O2):
define i32 @size_hint_to_size(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %5, %2 ]
%4 = icmp ult i32 %3, %0
%5 = shl i32 %3, 1
br i1 %4, label %2, label %6
6: ; preds = %2
%7 = icmp ugt i32 %3, 128
%8 = select i1 %7, i32 %3, i32 128
ret i32 %8
}
/* Variables and functions */
char *level1_0_s(char *, size_t, int, char *, size_t *);
int /*<<< orphan*/ ntos(int, char *, size_t *);
char *level1_0(int num, int ge, char *regstr, size_t *reglen) {
  char str[128], *s = str, d;
  size_t len = sizeof str;
  ntos(num, str, &len);
  return level1_0_s(str, len, ge, regstr, reglen);
}


x86 assembly (clang, -O0):
<level1_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0xa8(%rbp)
movq   $0x80,-0xb8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
lea    -0xb8(%rbp),%rdx
call   1030 <ntos@plt>
lea    -0xa0(%rbp),%rdi
mov    -0xb8(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   1040 <level1_0_s@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<level1_0>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%ebp
movq   $0x80,0x8(%rsp)
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%rdx
mov    %r15,%rsi
call   1030 <ntos@plt>
mov    0x8(%rsp),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1040 <level1_0_s@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @level1_0(i32 %0, i32 %1, i8* %2, i64* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca [128 x i8]
%10 = alloca i8*
%11 = alloca i8
%12 = alloca i64
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i64* %3, i64** %8
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
store i8* %13, i8** %10
store i64 128, i64* %12
%14 = load i32, i32* %5
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%16 = call i32 @ntos(i32 %14, i8* %15, i64* %12)
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%18 = load i64, i64* %12
%19 = load i32, i32* %6
%20 = load i8*, i8** %7
%21 = load i64*, i64** %8
%22 = call i8* @level1_0_s(i8* %17, i64 %18, i32 %19, i8* %20, i64* %21)
ret i8* %22
}

LLVM IR (-O2):
define i8* @level1_0(i32 %0, i32 %1, i8* %2, i64* %3) {
%5 = alloca [128 x i8]
%6 = alloca i64
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = bitcast i64* %6 to i8*
store i64 128, i64* %6
%9 = call i32 @ntos(i32 %0, i8* %7, i64* %6)
%10 = load i64, i64* %6
%11 = call i8* @level1_0_s(i8* %7, i64 %10, i32 %1, i8* %2, i64* %3)
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ det_fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_err_footer(void) { det_fprintf(stderr, "\n"); }


x86 assembly (clang, -O0):
<print_err_footer>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <det_fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_err_footer>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <det_fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @print_err_footer() {
%1 = load i32, i32* @stderr
%2 = call i32 @det_fprintf(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @print_err_footer() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @det_fprintf(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned long opts_geti(char);
unsigned long pca_divisions(void) {
  unsigned long ndiv = 0;
  ndiv = opts_geti('D');
  if (!ndiv) {
    ndiv = 128;
  }
  return ndiv;
}


x86 assembly (clang, -O0):
<pca_divisions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x44,%edi
call   1030 <opts_geti@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1141 <pca_divisions+0x31>
movq   $0x80,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pca_divisions>:
push   %rax
mov    $0x44,%edi
call   1030 <opts_geti@plt>
test   %rax,%rax
mov    $0x80,%ecx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @pca_divisions() {
%1 = alloca i64
store i64 0, i64* %1
%2 = call i64 @opts_geti(i8 signext 68)
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp ne i64 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %0
store i64 128, i64* %1
br label %6
6: ; preds = %5, %0
%7 = load i64, i64* %1
ret i64 %7
}

LLVM IR (-O2):
define i64 @pca_divisions() {
%1 = tail call i64 @opts_geti(i8 signext 68)
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i64 128, i64 %1
ret i64 %3
}
/* Variables and functions */
scalar_t__ isLower(unsigned int);
int toUpper(unsigned int c) { return (isLower(c) ? c - ('a' - 'A') : c); }


x86 assembly (clang, -O0):
<toUpper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isLower@plt>
cmp    $0x0,%rax
je     113b <toUpper+0x2b>
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <toUpper+0x31>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toUpper>:
push   %rbx
mov    %edi,%ebx
call   1030 <isLower@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @toUpper(i32 %0) {
%2 = tail call i64 @isLower(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add i32 %0, -32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
int main(void) {
  int x;
  {
    x = 0;
    if (x == 5) {
      x += 1;
    } else {
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    112a <main+0x2a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <main+0x2f>
jmp    112f <main+0x2f>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo(void *);
void test_2(void *p, void *q) {
  if (p == NULL || q == NULL)
    return;
  foo(p);
}


x86 assembly (clang, -O0):
<test_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1136 <test_2+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    113b <test_2+0x2b>
jmp    1144 <test_2+0x34>
mov    -0x8(%rbp),%rdi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_2>:
test   %rdi,%rdi
je     111f <test_2+0xf>
test   %rsi,%rsi
je     111f <test_2+0xf>
jmp    1030 <foo@plt>
ret

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

LLVM IR (-O2):
define void @test_2(i8* %0, i8* readnone %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @foo(i8* %0)
br label %8
8: ; preds = %2, %6
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t psector_Read_DeviceId(void) {
  uint64_t (*p_psector_Read_DeviceId)(void);
  p_psector_Read_DeviceId = (uint64_t(*)(void))0x03005329U;
  return p_psector_Read_DeviceId();
}


x86 assembly (clang, -O0):
<psector_Read_DeviceId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3005329,%eax
mov    %rax,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psector_Read_DeviceId>:
mov    $0x3005329,%eax
jmp    *%rax

LLVM IR (-O0):
define i32 @psector_Read_DeviceId() {
%1 = alloca i32 ()*
store i32 ()* inttoptr (i64 50352937 to i32 ()*), i32 ()** %1
%2 = load i32 ()*, i32 ()** %1
%3 = call i32 %2()
ret i32 %3
}

LLVM IR (-O2):
define i32 @psector_Read_DeviceId() {
%1 = tail call i32 inttoptr (i64 50352937 to i32 ()*)()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ IntEnable(int);
int /*<<< orphan*/ IntRegister(int, void (*)());
void PECIIntRegister(unsigned long ulBase, void (*pfnHandler)(void)) {
  ;
  ;
  IntRegister(123, pfnHandler);
  IntEnable(123);
}


x86 assembly (clang, -O0):
<PECIIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x7b,%edi
call   1040 <IntRegister@plt>
mov    $0x7b,%edi
call   1030 <IntEnable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PECIIntRegister>:
push   %rax
mov    $0x7b,%edi
call   1040 <IntRegister@plt>
mov    $0x7b,%edi
pop    %rax
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @PECIIntRegister(i64 %0, void ()* %1) {
%3 = alloca i64
%4 = alloca void ()*
store i64 %0, i64* %3
store void ()* %1, void ()** %4
%5 = load void ()*, void ()** %4
%6 = bitcast void ()* %5 to void (...)*
%7 = call i32 @IntRegister(i32 123, void (...)* %6)
%8 = call i32 @IntEnable(i32 123)
ret void
}

LLVM IR (-O2):
define void @PECIIntRegister(i64 %0, void ()* %1) {
%3 = bitcast void ()* %1 to void (...)*
%4 = tail call i32 @IntRegister(i32 123, void (...)* %3)
%5 = tail call i32 @IntEnable(i32 123)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_append_prepend();
int /*<<< orphan*/ test_delete();
int /*<<< orphan*/ test_find();
int /*<<< orphan*/ test_reverse();
int main(void) {
  printf("Start testing doubly linked list: \n");
  test_append_prepend();
  test_find();
  test_delete();
  test_reverse();
  printf("\nAll tests done.\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <test_append_prepend@plt>
mov    $0x0,%al
call   1060 <test_find@plt>
mov    $0x0,%al
call   1050 <test_delete@plt>
mov    $0x0,%al
call   1080 <test_reverse@plt>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <test_append_prepend@plt>
xor    %eax,%eax
call   1060 <test_find@plt>
xor    %eax,%eax
call   1050 <test_delete@plt>
xor    %eax,%eax
call   1080 <test_reverse@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Start testing doubly linked list: \0A\00"
@.str.1 = [18 x i8] c"\0AAll tests done.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @test_append_prepend()
%4 = call i32 (...) @test_find()
%5 = call i32 (...) @test_delete()
%6 = call i32 (...) @test_reverse()
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @EXIT_SUCCESS
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [35 x i8] c"Start testing doubly linked list: \00"
@str.2 = [17 x i8] c"\0AAll tests done.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @test_append_prepend()
%3 = tail call i32 (...) @test_find()
%4 = tail call i32 (...) @test_delete()
%5 = tail call i32 (...) @test_reverse()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0))
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ _Exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int,
                           char const *);
int /*<<< orphan*/ stderr;
void __assert_fail(const char *expr, const char *file, int line) {
  fprintf(stderr, "%s:%d: Assertion failed: %s\n", file, line, expr);
  _Exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<__assert_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8
lea    0xeb2(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1040 <_Exit@plt>

x86 assembly (clang, -O2):
<__assert_fail>:
push   %rax
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%r8
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <_Exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"%s:%d: Assertion failed: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @__assert_fail(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i8*, i8** %4
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @_Exit(i32 %12)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"%s:%d: Assertion failed: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @__assert_fail(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %0)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @_Exit(i32 %6)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Base64decode(char *, char const *);
int /*<<< orphan*/ printf(char *, char *);
void testDecode(const char *string) {
  char decoded[1024];
  Base64decode(decoded, string);
  printf("%s\n", decoded);
}


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

x86 assembly (clang, -O2):
<testDecode>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <Base64decode@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x400,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @testDecode(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @Base64decode(i8* %3, i8* %0)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello, world!"); }


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 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ free(struct list_iter *);
void release_iter(struct list_iter *iter) { free(iter); }


x86 assembly (clang, -O0):
<release_iter>:
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):
<release_iter>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.list_iter = type { i32 }
define void @release_iter(%struct.list_iter* nocapture %0) {
%2 = tail call i32 @free(%struct.list_iter* %0)
ret void
}
/* Variables and functions */
int supcon_puts(unsigned char *);
int puts(const char *s) { return supcon_puts((unsigned char *)s); }


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

x86 assembly (clang, -O2):
<puts>:
jmp    1030 <supcon_puts@plt>

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

LLVM IR (-O2):
define i32 @puts(i8* %0) {
%2 = tail call i32 @supcon_puts(i8* %0)
ret i32 %2
}
float FloatNormalize(float value, float omin, float omax, float nmin,
                     float nmax) {
  float tmp, i;
  if ((omax - omin) < 0.00001)
    return 0.0;
  tmp = (value - omin) / (omax - omin);
  i = nmin + tmp * (nmax - nmin);
  return i;
}


x86 assembly (clang, -O0):
<FloatNormalize>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  %xmm4,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    114a <FloatNormalize+0x4a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1192 <FloatNormalize+0x92>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
subss  -0x14(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FloatNormalize>:
subss  %xmm1,%xmm2
cvtss2sd %xmm2,%xmm5
movsd  0xef0(%rip),%xmm6
ucomisd %xmm5,%xmm6
jbe    111a <FloatNormalize+0x1a>
xorps  %xmm0,%xmm0
ret
subss  %xmm1,%xmm0
divss  %xmm2,%xmm0
subss  %xmm3,%xmm4
mulss  %xmm0,%xmm4
addss  %xmm3,%xmm4
movaps %xmm4,%xmm0
ret

LLVM IR (-O0):
define float @FloatNormalize(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
%14 = load float, float* %9
%15 = load float, float* %8
%16 = fsub float %14, %15
%17 = fpext float %16 to double
%18 = fcmp olt double %17, 1.000000e-05
br i1 %18, label %19, label %20
19: ; preds = %5
store float 0.000000e+00, float* %6
br label %35
20: ; preds = %5
%21 = load float, float* %7
%22 = load float, float* %8
%23 = fsub float %21, %22
%24 = load float, float* %9
%25 = load float, float* %8
%26 = fsub float %24, %25
%27 = fdiv float %23, %26
store float %27, float* %12
%28 = load float, float* %10
%29 = load float, float* %12
%30 = load float, float* %11
%31 = load float, float* %10
%32 = fsub float %30, %31
%33 = call float @llvm.fmuladd.f32(float %29, float %32, float %28)
store float %33, float* %13
%34 = load float, float* %13
store float %34, float* %6
br label %35
35: ; preds = %20, %19
%36 = load float, float* %6
ret float %36
}

LLVM IR (-O2):
define float @FloatNormalize(float %0, float %1, float %2, float %3, float %4) {
%6 = fsub float %2, %1
%7 = fpext float %6 to double
%8 = fcmp olt double %7, 1.000000e-05
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = fsub float %0, %1
%11 = fdiv float %10, %6
%12 = fsub float %4, %3
%13 = tail call float @llvm.fmuladd.f32(float %11, float %12, float %3)
br label %14
14: ; preds = %5, %9
%15 = phi float [ %13, %9 ], [ 0.000000e+00, %5 ]
ret float %15
}
unsigned long K(int t) {
  if (t <= 19)
    return 0x5a827999;
  else if ((t >= 20) && (t <= 39))
    return 0x6ed9eba1;
  else if ((t >= 40) && (t <= 59))
    return 0x8f1bbcdc;
  else if ((t >= 60) && (t <= 79))
    return 0xca62c1d6;
  else
    return 0;
}


x86 assembly (clang, -O0):
<K>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x13,-0xc(%rbp)
jg     111e <K+0x1e>
movq   $0x5a827999,-0x8(%rbp)
5a
jmp    118b <K+0x8b>
cmpl   $0x14,-0xc(%rbp)
jl     113f <K+0x3f>
cmpl   $0x27,-0xc(%rbp)
jg     113f <K+0x3f>
movq   $0x6ed9eba1,-0x8(%rbp)
6e
jmp    118b <K+0x8b>
cmpl   $0x28,-0xc(%rbp)
jl     1161 <K+0x61>
cmpl   $0x3b,-0xc(%rbp)
jg     1161 <K+0x61>
mov    $0x8f1bbcdc,%eax
mov    %rax,-0x8(%rbp)
jmp    118b <K+0x8b>
cmpl   $0x3c,-0xc(%rbp)
jl     1183 <K+0x83>
cmpl   $0x4f,-0xc(%rbp)
jg     1183 <K+0x83>
mov    $0xca62c1d6,%eax
mov    %rax,-0x8(%rbp)
jmp    118b <K+0x8b>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<K>:
mov    $0x5a827999,%eax
cmp    $0x14,%edi
jl     112d <K+0x2d>
mov    $0x6ed9eba1,%eax
cmp    $0x28,%edi
jb     112d <K+0x2d>
mov    $0x8f1bbcdc,%eax
cmp    $0x3c,%edi
jb     112d <K+0x2d>
add    $0x3b4704fa,%rax
xor    %ecx,%ecx
cmp    $0x50,%edi
cmovae %rcx,%rax
ret

LLVM IR (-O0):
define i64 @K(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 19
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 1518500249, i64* %2
br label %29
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 20
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sle i32 %11, 39
br i1 %12, label %13, label %14
13: ; preds = %10
store i64 1859775393, i64* %2
br label %29
14: ; preds = %10, %7
%15 = load i32, i32* %3
%16 = icmp sge i32 %15, 40
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp sle i32 %18, 59
br i1 %19, label %20, label %21
20: ; preds = %17
store i64 2400959708, i64* %2
br label %29
21: ; preds = %17, %14
%22 = load i32, i32* %3
%23 = icmp sge i32 %22, 60
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp sle i32 %25, 79
br i1 %26, label %27, label %28
27: ; preds = %24
store i64 3395469782, i64* %2
br label %29
28: ; preds = %24, %21
store i64 0, i64* %2
br label %29
29: ; preds = %28, %27, %20, %13, %6
%30 = load i64, i64* %2
ret i64 %30
}

LLVM IR (-O2):
define i64 @K(i32 %0) {
%2 = icmp slt i32 %0, 20
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 40
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 60
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 80
%9 = select i1 %8, i64 3395469782, i64 0
br label %10
10: ; preds = %7, %5, %3, %1
%11 = phi i64 [ 1518500249, %1 ], [ 1859775393, %3 ], [ 2400959708, %5 ], [ %9, %7 ]
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ bios_printf(int, char *);
void s3_resume_panic() {
  bios_printf((2 | 4 | 1), "Returned from s3_resume.\n");
}


x86 assembly (clang, -O0):
<s3_resume_panic>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
lea    0xee0(%rip),%rsi
call   1030 <bios_printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<s3_resume_panic>:
lea    0xee9(%rip),%rsi
mov    $0x7,%edi
jmp    1030 <bios_printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Returned from s3_resume.\0A\00"
define void @s3_resume_panic() {
%1 = call i32 @bios_printf(i32 7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Returned from s3_resume.\0A\00"
define void @s3_resume_panic() {
%1 = tail call i32 @bios_printf(i32 7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}
void sigusr1_handler(int signum) { return; }


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

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

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

LLVM IR (-O2):
define void @sigusr1_handler(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf(" update_scp scp.bin dtb.bin\n");
  printf(" update arisc para from dtb\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c" update_scp scp.bin dtb.bin\0A\00"
@.str.1 = [29 x i8] c" update arisc para from dtb\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c" update_scp scp.bin dtb.bin\00"
@str.2 = [28 x i8] c" update arisc para from dtb\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.2, i64 0, i64 0))
ret void
}
unsigned long int or1k_rand() {
  static unsigned long int lfsr = 1;
  static int period = 0;
  lfsr = (lfsr >> 1) ^ (unsigned long int)((0 - (lfsr & 1u)) & 0xd0000001u);
  ++period;
  return lfsr;
}


x86 assembly (clang, -O0):
<or1k_rand>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f15(%rip),%rax
shr    $0x1,%rax
mov    0x2f0a(%rip),%rdx
and    $0x1,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
movabs $0xd0000001,%rdx
and    %rdx,%rcx
xor    %rcx,%rax
mov    %rax,0x2eea(%rip)
mov    0x2ef0(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ee7(%rip)
mov    0x2ed4(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<or1k_rand>:
mov    0x2f19(%rip),%rax
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
neg    %eax
and    $0xd0000001,%eax
xor    %rcx,%rax
mov    %rax,0x2eff(%rip)
addl   $0x1,0x2f04(%rip)
ret

LLVM IR (-O0):
@or1k_rand.lfsr = internal global i64 1
@or1k_rand.period = internal global i32 0
define i64 @or1k_rand() {
%1 = load i64, i64* @or1k_rand.lfsr
%2 = lshr i64 %1, 1
%3 = load i64, i64* @or1k_rand.lfsr
%4 = and i64 %3, 1
%5 = sub i64 0, %4
%6 = and i64 %5, 3489660929
%7 = xor i64 %2, %6
store i64 %7, i64* @or1k_rand.lfsr
%8 = load i32, i32* @or1k_rand.period
%9 = add nsw i32 %8, 1
store i32 %9, i32* @or1k_rand.period
%10 = load i64, i64* @or1k_rand.lfsr
ret i64 %10
}

LLVM IR (-O2):
@or1k_rand.lfsr = internal unnamed_addr global i64 1
@or1k_rand.period = internal unnamed_addr global i32 0
define i64 @or1k_rand() {
%1 = load i64, i64* @or1k_rand.lfsr
%2 = lshr i64 %1, 1
%3 = and i64 %1, 1
%4 = sub nsw i64 0, %3
%5 = and i64 %4, 3489660929
%6 = xor i64 %5, %2
store i64 %6, i64* @or1k_rand.lfsr
%7 = load i32, i32* @or1k_rand.period
%8 = add nsw i32 %7, 1
store i32 %8, i32* @or1k_rand.period
ret i64 %6
}
/* Variables and functions */
long INT_MAX;
long INT_MIN;
double scalbn(double, int);
double scalbln(double x, long n) {
  if (n < INT_MIN)
    return scalbn(x, INT_MIN);
  else if (n > INT_MAX)
    return scalbn(x, INT_MAX);
  else
    return scalbn(x, (int)n);
}


x86 assembly (clang, -O0):
<scalbln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2eb4(%rip),%rcx
cmp    (%rcx),%rax
jge    1155 <scalbln+0x45>
movsd  -0x10(%rbp),%xmm0
mov    0x2e9f(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <scalbn@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    119e <scalbln+0x8e>
mov    -0x18(%rbp),%rax
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
jle    1189 <scalbln+0x79>
movsd  -0x10(%rbp),%xmm0
mov    0x2e73(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <scalbn@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    119e <scalbln+0x8e>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1030 <scalbn@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalbln>:
mov    0x2ec9(%rip),%rax
mov    0x2eca(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rdi,%rcx
cmovge %edi,%ecx
mov    (%rax),%rax
cmp    %rdi,%rax
cmovle %ecx,%eax
mov    %eax,%edi
jmp    1030 <scalbn@plt>

LLVM IR (-O0):
@INT_MIN = global i64 0
@INT_MAX = global i64 0
define double @scalbln(double %0, i64 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i64
store double %0, double* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = load i64, i64* @INT_MIN
%8 = icmp slt i64 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load double, double* %4
%11 = load i64, i64* @INT_MIN
%12 = trunc i64 %11 to i32
%13 = call double @scalbn(double %10, i32 %12)
store double %13, double* %3
br label %28
14: ; preds = %2
%15 = load i64, i64* %5
%16 = load i64, i64* @INT_MAX
%17 = icmp sgt i64 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = load double, double* %4
%20 = load i64, i64* @INT_MAX
%21 = trunc i64 %20 to i32
%22 = call double @scalbn(double %19, i32 %21)
store double %22, double* %3
br label %28
23: ; preds = %14
%24 = load double, double* %4
%25 = load i64, i64* %5
%26 = trunc i64 %25 to i32
%27 = call double @scalbn(double %24, i32 %26)
store double %27, double* %3
br label %28
28: ; preds = %23, %18, %9
%29 = load double, double* %3
ret double %29
}

LLVM IR (-O2):
@INT_MIN = global i64 0
@INT_MAX = global i64 0
define double @scalbln(double %0, i64 %1) {
%3 = load i64, i64* @INT_MIN
%4 = icmp sgt i64 %3, %1
%5 = load i64, i64* @INT_MAX
%6 = icmp slt i64 %5, %1
%7 = select i1 %6, i64 %5, i64 %1
%8 = select i1 %4, i64 %3, i64 %7
%9 = trunc i64 %8 to i32
%10 = tail call double @scalbn(double %0, i32 %9)
ret double %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int strlen(char *);
int fgetline(FILE *fp, char *line, int max) {
  if (fgets(line, max, fp) == NULL)
    return 0;
  else
    return strlen(line);
}


x86 assembly (clang, -O0):
<fgetline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    1159 <fgetline+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1165 <fgetline+0x45>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgetline>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1142 <fgetline+0x22>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strlen@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fgetline(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %6
%9 = load i32, i32* %7
%10 = load i32*, i32** %5
%11 = call i32* @fgets(i8* %8, i32 %9, i32* %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %4
br label %17
14: ; preds = %3
%15 = load i8*, i8** %6
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %4
br label %17
17: ; preds = %14, %13
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
define i32 @fgetline(i32* nocapture %0, i8* %1, i32 %2) {
%4 = tail call i32* @fgets(i8* %1, i32 %2, i32* %0)
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %1)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ 0, %3 ]
ret i32 %9
}
void blah(void) {}


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

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

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

LLVM IR (-O2):
define void @blah() {
ret void
}
__attribute__((__nonnull__)) int evil_nonnull_func(int *pointer, void *pv) {
  if (pointer == (void *)0) {
    return 0;
  } else {
    return *pointer;
  }
  pointer = pv;
  if (!pointer)
    return 0;
  else
    return *pointer;
  if (pv == (void *)0) {
  }
}


x86 assembly (clang, -O0):
<evil_nonnull_func>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1123 <evil_nonnull_func+0x23>
movl   $0x0,-0x4(%rbp)
jmp    112c <evil_nonnull_func+0x2c>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @evil_nonnull_func(i32* nocapture %0, i8* nocapture readnone %1) {
%3 = load i32, i32* %0
ret i32 %3
}