xunge/DecIR huggingface dataset:
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main(void) { printf("%d\n", EOF); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef unsigned char volatile uint32_t;

/* Variables and functions */
uint32_t USBDevAddrGet(uint32_t ui32Base) {
  ;
  return ((*((volatile unsigned char *)(ui32Base + 0x00000000))));
}


x86 assembly (clang, -O0):
<USBDevAddrGet>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
movzbl %al,%eax
add    $0x0,%eax
cltq
mov    (%rax),%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDevAddrGet>:
mov    %dil,-0x1(%rsp)
movzbl -0x1(%rsp),%eax
mov    (%rax),%al
ret

LLVM IR (-O0):
define zeroext i8 @USBDevAddrGet(i8 zeroext %0) {
%2 = alloca i8
store volatile i8 %0, i8* %2
%3 = load volatile i8, i8* %2
%4 = zext i8 %3 to i32
%5 = add nsw i32 %4, 0
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = load volatile i8, i8* %7
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @USBDevAddrGet(i8 zeroext %0) {
%2 = alloca i8
store volatile i8 %0, i8* %2
%3 = load volatile i8, i8* %2
%4 = zext i8 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = load volatile i8, i8* %5
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ jp();
void opcode_c3() { jp(); }


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

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

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

LLVM IR (-O2):
define void @opcode_c3() {
%1 = tail call i32 (...) @jp()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ log_f(char *, unsigned int);
void target_writeb(unsigned addr, unsigned char c) {
  log_f("ERROR:linux: write at address 0x%x not allowed in this architecture\n",
        addr);
}


x86 assembly (clang, -O0):
<target_writeb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed5(%rip),%rdi
call   1030 <log_f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_writeb>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <log_f@plt>

LLVM IR (-O0):
@.str = [69 x i8] c"ERROR:linux: write at address 0x%x not allowed in this architecture\0A\00"
define void @target_writeb(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = call i32 @log_f(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [69 x i8] c"ERROR:linux: write at address 0x%x not allowed in this architecture\0A\00"
define void @target_writeb(i32 %0, i8 zeroext %1) {
%3 = tail call i32 @log_f(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
float(crealf)(float _Complex x) { return __builtin_crealf(x); }


x86 assembly (clang, -O0):
<crealf>:
push   %rbp
mov    %rsp,%rbp
movlpd %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @crealf(<2 x float> %0) {
%2 = alloca { float, float }
%3 = bitcast { float, float }* %2 to <2 x float>*
store <2 x float> %0, <2 x float>* %3
%4 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%5 = load float, float* %4
%6 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
%7 = load float, float* %6
ret float %5
}

LLVM IR (-O2):
define float @crealf(<2 x float> %0) {
%2 = extractelement <2 x float> %0, i64 0
ret float %2
}
void av_compare_ts() {}


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

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

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

LLVM IR (-O2):
define void @av_compare_ts() {
ret void
}
/* Variables and functions */
void *checkPointerError(int /*<<< orphan*/, char *, char *, int, int);
int /*<<< orphan*/ malloc(size_t);
void *allocate(size_t size, char *file, int line) {
  return checkPointerError(malloc(size), "Can't allocate memory", file, line,
                           -1);
}


x86 assembly (clang, -O0):
<allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xeb4(%rip),%rsi
mov    $0xffffffff,%r8d
call   1040 <checkPointerError@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1030 <malloc@plt>
lea    0xecc(%rip),%rsi
mov    %eax,%edi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    $0xffffffff,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <checkPointerError@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Can't allocate memory\00"
define i8* @allocate(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = call i32 @malloc(i64 %7)
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i8* @checkPointerError(i32 %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %10, i32 -1)
ret i8* %11
}

LLVM IR (-O2):
@.str = [22 x i8] c"Can't allocate memory\00"
define i8* @allocate(i64 %0, i8* %1, i32 %2) {
%4 = tail call i32 @malloc(i64 %0)
%5 = tail call i8* @checkPointerError(i32 %4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i32 -1)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ ossl_store_destroy_loaders_int();
void ossl_store_cleanup_int(void) { ossl_store_destroy_loaders_int(); }


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

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

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

LLVM IR (-O2):
define void @ossl_store_cleanup_int() {
%1 = tail call i32 (...) @ossl_store_destroy_loaders_int()
ret void
}
/* Variables and functions */
int SIGUSR1;
int /*<<< orphan*/ daemonize();
void sig_handler(int signo) {
  if (signo == SIGUSR1) {
    daemonize();
  }
  return;
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ec3(%rip),%rcx
cmp    (%rcx),%eax
jne    1134 <sig_handler+0x24>
mov    $0x0,%al
call   1030 <daemonize@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jne    1122 <sig_handler+0x12>
xor    %eax,%eax
jmp    1030 <daemonize@plt>
ret

LLVM IR (-O0):
@SIGUSR1 = global i32 0
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGUSR1
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @daemonize()
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGUSR1
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @daemonize()
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ writen_file(char const *, char const *, int /*<<< orphan*/);
void write_file(const char *path, const char *value) {
  writen_file(path, value, strlen(value));
}


x86 assembly (clang, -O0):
<write_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <writen_file@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_file>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <writen_file@plt>

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

LLVM IR (-O2):
define void @write_file(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @writen_file(i8* %0, i8* %1, i32 %3)
ret void
}
rand() {
  static gorp;
  gorp = (gorp + 625) & 077777;
  return (gorp);
}


x86 assembly (clang, -O0):
<rand>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x271,%eax
and    $0x7fff,%eax
mov    %eax,0x2f0a(%rip)
mov    0x2f04(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand>:
mov    $0x271,%eax
add    0x2f19(%rip),%eax
and    $0x7fff,%eax
mov    %eax,0x2f0e(%rip)
ret

LLVM IR (-O0):
@rand.gorp = internal global i32 0
define i32 @rand() {
%1 = load i32, i32* @rand.gorp
%2 = add nsw i32 %1, 625
%3 = and i32 %2, 32767
store i32 %3, i32* @rand.gorp
%4 = load i32, i32* @rand.gorp
ret i32 %4
}

LLVM IR (-O2):
@rand.gorp = internal unnamed_addr global i32 0
define i32 @rand() {
%1 = load i32, i32* @rand.gorp
%2 = add nsw i32 %1, 625
%3 = and i32 %2, 32767
store i32 %3, i32* @rand.gorp
ret i32 %3
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int UP3D_GetParameter(int);
int32_t UP3D_GetSystemState() {
  int32_t state = UP3D_GetParameter(0x10);
  if ((state < 0) || (state > 22))
    state = 23;
  return state;
}


x86 assembly (clang, -O0):
<UP3D_GetSystemState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
call   1030 <UP3D_GetParameter@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1139 <UP3D_GetSystemState+0x29>
cmpl   $0x16,-0x4(%rbp)
jle    1140 <UP3D_GetSystemState+0x30>
movl   $0x17,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UP3D_GetSystemState>:
push   %rax
mov    $0x10,%edi
call   1030 <UP3D_GetParameter@plt>
cmp    $0x17,%eax
mov    $0x17,%ecx
cmovae %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @UP3D_GetSystemState() {
%1 = alloca i32
%2 = call i32 @UP3D_GetParameter(i32 16)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 22
br i1 %7, label %8, label %9
8: ; preds = %5, %0
store i32 23, i32* %1
br label %9
9: ; preds = %8, %5
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @UP3D_GetSystemState() {
%1 = tail call i32 @UP3D_GetParameter(i32 16)
%2 = icmp ult i32 %1, 23
%3 = select i1 %2, i32 %1, i32 23
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ arg_longlong3(long long, long long, long long);
void arg_longlong2(long long a, long long b) { arg_longlong3(a, b, b + 1); }


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

x86 assembly (clang, -O2):
<arg_longlong2>:
lea    0x1(%rsi),%rdx
jmp    1030 <arg_longlong3@plt>

LLVM IR (-O0):
define void @arg_longlong2(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 = load i64, i64* %4
%8 = add nsw i64 %7, 1
%9 = call i32 @arg_longlong3(i64 %5, i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @arg_longlong2(i64 %0, i64 %1) {
%3 = add nsw i64 %1, 1
%4 = tail call i32 @arg_longlong3(i64 %0, i64 %1, i64 %3)
ret void
}
int TestBit(int A[], int k) {
  int i = k / 32;
  int pos = k % 32;
  unsigned int flag = 1;
  flag = flag << pos;
  if (A[i] & flag)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<TestBit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     115c <TestBit+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1163 <TestBit+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestBit>:
mov    %esi,%ecx
lea    0x1f(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x5,%eax
cltq
mov    (%rdi,%rax,4),%eax
shr    %cl,%eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @TestBit(i32* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 32
%4 = and i32 %1, 31
%5 = sext i32 %3 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = lshr i32 %7, %4
%9 = and i32 %8, 1
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int random_integer(int min, int max) {
  assert(min < max);
  srand(time(NULL));
  return rand() % (max + 1 - min) + min;
}


x86 assembly (clang, -O0):
<random_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_integer>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
sub    %ebx,%ebp
setg   %dil
call   1040 <assert@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
add    $0x1,%ebp
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_integer(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 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @time(i32* null)
%11 = call i32 @srand(i32 %10)
%12 = call i32 (...) @rand()
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %3
%16 = sub nsw i32 %14, %15
%17 = srem i32 %12, %16
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @random_integer(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
%8 = tail call i32 (...) @rand()
%9 = sub i32 1, %0
%10 = add i32 %9, %1
%11 = srem i32 %8, %10
%12 = add nsw i32 %11, %0
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ Ttl_TPM_SelfTestFull();
uint32_t TtlSelfTestFull(void) {
  do {
  } while (0);
  return Ttl_TPM_SelfTestFull();
}


x86 assembly (clang, -O0):
<TtlSelfTestFull>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <TtlSelfTestFull+0x9>
jmp    111e <TtlSelfTestFull+0xe>
mov    $0x0,%al
call   1030 <Ttl_TPM_SelfTestFull@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @TtlSelfTestFull() {
br label %1
1: ; preds = %0
br label %2
2: ; preds = %1
%3 = call i32 (...) @Ttl_TPM_SelfTestFull()
ret i32 %3
}

LLVM IR (-O2):
define i32 @TtlSelfTestFull() {
%1 = tail call i32 (...) @Ttl_TPM_SelfTestFull()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_reset_solar_short() {
  mbus_remote_register_write(
      0x6, 0x0E, ((1 << 10) | (1 << 9) | (0 << 8) | (3 << 4) | (0)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x0E, ((1 << 10) | (0 << 9) | (0 << 8) | (3 << 4) | (0)));
  delay(100);
}


x86 assembly (clang, -O0):
<pmu_reset_solar_short>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x630,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x430,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_reset_solar_short>:
push   %rax
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x630,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x430,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_reset_solar_short() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1584)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1072)
%4 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @pmu_reset_solar_short() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1584)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1072)
%4 = tail call i32 @delay(i32 100)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memdump2(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void memdump(void *memory, int len) {
  printf("\n");
  memdump2((char *)memory, len, 0);
  printf("\n");
}


x86 assembly (clang, -O0):
<memdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1040 <memdump2@plt>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memdump>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1040 <memdump2@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @memdump(i8* %0, i32 %1) {
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @memdump2(i8* %0, i32 %1, i32 0)
%5 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AltitudeFilterSettingsHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void AltitudeFilterSettingsUpdated() {
  UAVObjUpdated(AltitudeFilterSettingsHandle());
}


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

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

LLVM IR (-O0):
define void @AltitudeFilterSettingsUpdated() {
%1 = call i32 (...) @AltitudeFilterSettingsHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @AltitudeFilterSettingsUpdated() {
%1 = tail call i32 (...) @AltitudeFilterSettingsHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __free_cf(void *);
void CGErrorRelease(void *item) { __free_cf(item); }


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

x86 assembly (clang, -O2):
<CGErrorRelease>:
jmp    1030 <__free_cf@plt>

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

LLVM IR (-O2):
define void @CGErrorRelease(i8* %0) {
%2 = tail call i32 @__free_cf(i8* %0)
ret void
}
double pathcon_nm10_sq(double x) { return x * x; }


x86 assembly (clang, -O0):
<pathcon_nm10_sq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathcon_nm10_sq>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @pathcon_nm10_sq(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @pathcon_nm10_sq(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ outl(unsigned long, unsigned int);
void nsp32_write4(unsigned int base, unsigned int index, unsigned long val) {
  outl(val, (base + index));
}


x86 assembly (clang, -O0):
<nsp32_write4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
add    -0x8(%rbp),%esi
call   1030 <outl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsp32_write4>:
add    %edi,%esi
mov    %rdx,%rdi
jmp    1030 <outl@plt>

LLVM IR (-O0):
define void @nsp32_write4(i32 %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = add i32 %8, %9
%11 = call i32 @outl(i64 %7, i32 %10)
ret void
}

LLVM IR (-O2):
define void @nsp32_write4(i32 %0, i32 %1, i64 %2) {
%4 = add i32 %1, %0
%5 = tail call i32 @outl(i64 %2, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gpio_output(int, int, int);
void pwr_on(void) { gpio_output(9, 10, 1); }


x86 assembly (clang, -O0):
<pwr_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
mov    $0xa,%esi
mov    $0x1,%edx
call   1030 <gpio_output@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwr_on>:
mov    $0x9,%edi
mov    $0xa,%esi
mov    $0x1,%edx
jmp    1030 <gpio_output@plt>

LLVM IR (-O0):
define void @pwr_on() {
%1 = call i32 @gpio_output(i32 9, i32 10, i32 1)
ret void
}

LLVM IR (-O2):
define void @pwr_on() {
%1 = tail call i32 @gpio_output(i32 9, i32 10, i32 1)
ret void
}
void CYCALLOCPROFILE_GC_add_to_heap(void *p, unsigned long bytes) {}


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

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

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

LLVM IR (-O2):
define void @CYCALLOCPROFILE_GC_add_to_heap(i8* nocapture %0, i64 %1) {
ret void
}
/* Variables and functions */
int bar(int);
int /*<<< orphan*/ baz(int);
int /*<<< orphan*/ bla(int);
void foo(int y) {
  int a;
  if (y == 6) {
    bla(5);
    a = bar(7);
  } else {
    bla(5);
    a = bar(7);
  }
  baz(a);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x6,-0x4(%rbp)
jne    1161 <foo+0x31>
mov    $0x5,%edi
call   1050 <bla@plt>
mov    $0x7,%edi
call   1040 <bar@plt>
mov    %eax,-0x8(%rbp)
jmp    1178 <foo+0x48>
mov    $0x5,%edi
call   1050 <bla@plt>
mov    $0x7,%edi
call   1040 <bar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <baz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    $0x5,%edi
call   1050 <bla@plt>
mov    $0x7,%edi
call   1040 <bar@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <baz@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i32 @bla(i32 5)
%3 = tail call i32 @bar(i32 7)
%4 = tail call i32 @baz(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
int whatIsThis(int *, int);
int main(int argc, char const *argv[]) {
  int x;
  int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  x = whatIsThis(a, 10);
  printf("%s%d\n", "result is ", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1050 <whatIsThis@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
lea    0xeb2(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <whatIsThis@plt>
lea    0xecd(%rip),%rdi
lea    0xecc(%rip),%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [6 x i8] c"%s%d\0A\00"
@.str.1 = [11 x i8] c"result is \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [10 x i32]* %7 to i8*
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%10 = call i32 @whatIsThis(i32* %9, i32 10)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [6 x i8] c"%s%d\0A\00"
@.str.1 = [11 x i8] c"result is \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @whatIsThis(i32* %5, i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
char *strrchr(char const *, char);
char *getFilenameExt(const char *fname) {
  char *dot = strrchr(fname, '.');
  if (!dot || dot == fname) {
    return "";
  }
  return dot;
}


x86 assembly (clang, -O0):
<getFilenameExt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1147 <getFilenameExt+0x37>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1157 <getFilenameExt+0x47>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115f <getFilenameExt+0x4f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFilenameExt>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1030 <strrchr@plt>
cmp    %rbx,%rax
lea    0xed8(%rip),%rdx
mov    %rax,%rcx
cmove  %rdx,%rcx
test   %rax,%rax
cmove  %rdx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @getFilenameExt(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 46)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load i8*, i8** %3
%12 = icmp eq i8* %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9, %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
14: ; preds = %9
%15 = load i8*, i8** %4
store i8* %15, i8** %2
br label %16
16: ; preds = %14, %13
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @getFilenameExt(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = icmp eq i8* %2, %0
%5 = or i1 %3, %4
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int read_int_from_file(char filename[]) {
  FILE *file;
  int res = 0;
  file = fopen(filename, "rt");
  fscanf(file, "%d", &res);
  fclose(file);
  return res;
}


x86 assembly (clang, -O0):
<read_int_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int_from_file>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xebc(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeb0(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @read_int_from_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = load i32*, i32** %3
%10 = call i32 @fclose(i32* %9)
%11 = load i32, i32* %4
ret i32 %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @read_int_from_file(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = call i32 @fclose(i32* %4)
%7 = load i32, i32* %2
ret i32 %7
}
/* Variables and functions */
int rand();
int rand_bytes(void *output, int len) {
  int i;
  int *array = (int *)output;
  for (i = 0; i < len / sizeof(int); i++)
    array[i] = rand();
  return 0;
}


x86 assembly (clang, -O0):
<rand_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
movslq -0xc(%rbp),%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jae    1165 <rand_bytes+0x55>
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <rand_bytes+0x1e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_bytes>:
push   %r15
push   %r14
push   %rbx
cmp    $0x4,%esi
jb     1154 <rand_bytes+0x44>
mov    %rdi,%r14
movslq %esi,%rax
shr    $0x2,%rax
cmp    $0x2,%rax
mov    $0x1,%r15d
cmovae %rax,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <rand_bytes+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @rand_bytes(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = icmp ult i32 %1, 4
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = sext i32 %1 to i64
%7 = lshr i64 %6, 2
%8 = call i64 @llvm.umax.i64(i64 %7, i64 1)
br label %9
9: ; preds = %5, %9
%10 = phi i64 [ 0, %5 ], [ %13, %9 ]
%11 = tail call i32 (...) @rand()
%12 = getelementptr inbounds i32, i32* %3, i64 %10
store i32 %11, i32* %12
%13 = add nuw nsw i64 %10, 1
%14 = icmp eq i64 %13, %8
br i1 %14, label %15, label %9
15: ; preds = %9, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cgi_http_header_end() { printf("\n"); }


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

x86 assembly (clang, -O2):
<cgi_http_header_end>:
mov    $0xa,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @cgi_http_header_end() {
%1 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ notimplemented(char *);
void __svgalib_driver24p_copybox(int x1, int y1, int w, int h, int x2, int y2) {
  {
    notimplemented("24-bit paged copybox");
    return;
  };
}


x86 assembly (clang, -O0):
<__svgalib_driver24p_copybox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <notimplemented@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"24-bit paged copybox\00"
define void @__svgalib_driver24p_copybox(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = call i32 @notimplemented(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"24-bit paged copybox\00"
define void @__svgalib_driver24p_copybox(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @notimplemented(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned int FILENAME_MAX;
unsigned int scalanative_libc_filename_max() { return FILENAME_MAX; }


x86 assembly (clang, -O0):
<scalanative_libc_filename_max>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalanative_libc_filename_max>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@FILENAME_MAX = global i32 0
define i32 @scalanative_libc_filename_max() {
%1 = load i32, i32* @FILENAME_MAX
ret i32 %1
}

LLVM IR (-O2):
@FILENAME_MAX = global i32 0
define i32 @scalanative_libc_filename_max() {
%1 = load i32, i32* @FILENAME_MAX
ret i32 %1
}
int myStrlen(char *s) {
  char *p = s;
  while (*p != '\0')
    p++;
  return p - s;
}


x86 assembly (clang, -O0):
<myStrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1131 <myStrlen+0x31>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <myStrlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myStrlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <myStrlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @myStrlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ nano_example();
int main() { nano_example(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @nano_example()
ret i32 0
}
int remove_char(char *str, char c) {
  char *_pr = str, *_pw = str;
  while (*_pr) {
    *_pw = *_pr++;
    _pw += (*_pw != c);
  }
  *_pw = '\0';
}


x86 assembly (clang, -O0):
<remove_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     116a <remove_char+0x6a>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    111e <remove_char+0x1e>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_char>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <remove_char+0x28>
lea    0x1(%rdi),%rax
nopw   0x0(%rax,%rax,1)
mov    %cl,(%rdi)
xor    %edx,%edx
cmp    %sil,%cl
setne  %dl
add    %rdx,%rdi
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <remove_char+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @remove_char(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %12, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %7
%10 = icmp ne i8 %6, %1
%11 = zext i1 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i8* [ %0, %2 ], [ %12, %5 ]
store i8 0, i8* %16
ret i32 undef
}
extern __attribute__((gnu_)) int abs(int __n) { return (__n < 0) ? -__n : __n; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ cpuid(int, int *, int *, int *, int *);
bool cpuid_timestamp_counter_avail(void) {
  uint64_t rax, rbx, rcx, rdx;
  int leaf = 1;
  cpuid(leaf, &rax, &rbx, &rcx, &rdx);
  if ((((uint64_t)(rdx) &
        ((((uint64_t)1 << (((4)) - ((4)) + 1)) - 1) << ((4)))) >>
       (4)) == 1) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<cpuid_timestamp_counter_avail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x14(%rbp),%eax
and    $0x10,%eax
sar    $0x4,%eax
cmp    $0x1,%eax
jne    1155 <cpuid_timestamp_counter_avail+0x45>
movl   $0x1,-0x4(%rbp)
jmp    115c <cpuid_timestamp_counter_avail+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_timestamp_counter_avail>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0x1,%edi
call   1030 <cpuid@plt>
mov    0x8(%rsp),%eax
shr    $0x4,%eax
and    $0x1,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @cpuid_timestamp_counter_avail() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %4
%11 = lshr i32 %10, 4
%12 = and i32 %11, 1
ret i32 %12
}