xunge/DecIR huggingface dataset:
void audio_detect(void) {}


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

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

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

LLVM IR (-O2):
define void @audio_detect() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int init() {
  printf("Hello, world!\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, world!\00"
define i32 @init() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_get64(void *dest, const void *src, size_t len, int pe) {
  printf("\nOpenSHMEM Analyzer\n");
}


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

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

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

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_get64(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int ffs(int);
int __ffs(int mask) { return (ffs(mask) - 1); }


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

x86 assembly (clang, -O2):
<__ffs>:
bsf    %edi,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @__ffs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ffs(i32 %3)
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @__ffs(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i32 -1, i32 %2
ret i32 %4
}
pr_array(cp, ap) char *cp, **ap;
{
  register int i;
  for (i = 0; *ap; ap++, i++)
    printf("%s[%d]=> %s\n", cp, i, *ap);
}


x86 assembly (clang, -O0):
<pr_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     116b <pr_array+0x5b>
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <pr_array+0x17>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    (%rsi),%rcx
test   %rcx,%rcx
je     114d <pr_array+0x3d>
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xed3(%rip),%r15
xor    %ebx,%ebx
nop
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%r12,%rbx,8),%rcx
add    $0x1,%rbx
test   %rcx,%rcx
jne    1130 <pr_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%s[%d]=> %s\0A\00"
define i32 @pr_array(i8* %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %12, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8** [ %10, %5 ], [ %1, %2 ]
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %7, i8* %6)
%10 = getelementptr inbounds i8*, i8** %8, i64 1
%11 = add nuw nsw i32 %7, 1
%12 = load i8*, i8** %10
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %5
14: ; preds = %5, %2
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ power_1(double *, double const *, double const *);
void power_decay_value(const double r, const double *p, double *f) {
  double power = 0;
  power_1(&power, &r, &p[1]);
  *f = p[0] / power;
}


x86 assembly (clang, -O0):
<power_decay_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
lea    -0x20(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <power_1@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power_decay_value>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rdi),%rdx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <power_1@plt>
movsd  (%rbx),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @power_decay_value(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
store double 0.000000e+00, double* %7
%8 = load double*, double** %5
%9 = getelementptr inbounds double, double* %8, i64 1
%10 = call i32 @power_1(double* %7, double* %4, double* %9)
%11 = load double*, double** %5
%12 = getelementptr inbounds double, double* %11, i64 0
%13 = load double, double* %12
%14 = load double, double* %7
%15 = fdiv double %13, %14
%16 = load double*, double** %6
store double %15, double* %16
ret void
}

LLVM IR (-O2):
define void @power_decay_value(double %0, double* %1, double* nocapture writeonly %2) {
%4 = alloca double
%5 = alloca double
store double %0, double* %4
%6 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = call i32 @power_1(double* %5, double* %4, double* %7)
%9 = load double, double* %1
%10 = load double, double* %5
%11 = fdiv double %9, %10
store double %11, double* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ streamtoforward(int, int, void *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
int32_t unixtoforward(int srcsock, int dstsock, void *buff, uint32_t leng,
                      uint32_t rcvd, uint32_t sent, uint32_t msecto) {
  return streamtoforward(srcsock, dstsock, buff, leng, rcvd, sent, msecto);
}


x86 assembly (clang, -O0):
<unixtoforward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <streamtoforward@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unixtoforward>:
jmp    1030 <streamtoforward@plt>

LLVM IR (-O0):
define i32 @unixtoforward(i32 %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = load i8*, i8** %10
%18 = load i32, i32* %11
%19 = load i32, i32* %12
%20 = load i32, i32* %13
%21 = load i32, i32* %14
%22 = call i32 @streamtoforward(i32 %15, i32 %16, i8* %17, i32 %18, i32 %19, i32 %20, i32 %21)
ret i32 %22
}

LLVM IR (-O2):
define i32 @unixtoforward(i32 %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i32 @streamtoforward(i32 %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6)
ret i32 %8
}
void TimerPrescaleMatchSet(unsigned long ulBase, unsigned long ulTimer,
                           unsigned long ulValue) {
  ;

  ;
  ;
  if (ulTimer & 0x000000ff) {
    (*((volatile unsigned long *)(ulBase + 0x00000040))) = ulValue;
  }
  if (ulTimer & 0x0000ff00) {
    (*((volatile unsigned long *)(ulBase + 0x00000044))) = ulValue;
  }
}


x86 assembly (clang, -O0):
<TimerPrescaleMatchSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
cmp    $0x0,%rax
je     1130 <TimerPrescaleMatchSet+0x30>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x40(%rax)
mov    -0x10(%rbp),%rax
and    $0xff00,%rax
cmp    $0x0,%rax
je     1150 <TimerPrescaleMatchSet+0x50>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x44(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerPrescaleMatchSet>:
test   %sil,%sil
je     1109 <TimerPrescaleMatchSet+0x9>
mov    %rdx,0x40(%rdi)
test   $0xff00,%esi
je     1115 <TimerPrescaleMatchSet+0x15>
mov    %rdx,0x44(%rdi)
ret

LLVM IR (-O0):
define void @TimerPrescaleMatchSet(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = and i64 %7, 255
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i64, i64* %6
%12 = load i64, i64* %4
%13 = add i64 %12, 64
%14 = inttoptr i64 %13 to i64*
store volatile i64 %11, i64* %14
br label %15
15: ; preds = %10, %3
%16 = load i64, i64* %5
%17 = and i64 %16, 65280
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i64, i64* %6
%21 = load i64, i64* %4
%22 = add i64 %21, 68
%23 = inttoptr i64 %22 to i64*
store volatile i64 %20, i64* %23
br label %24
24: ; preds = %19, %15
ret void
}

LLVM IR (-O2):
define void @TimerPrescaleMatchSet(i64 %0, i64 %1, i64 %2) {
%4 = and i64 %1, 255
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = add i64 %0, 64
%8 = inttoptr i64 %7 to i64*
store volatile i64 %2, i64* %8
br label %9
9: ; preds = %6, %3
%10 = and i64 %1, 65280
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = add i64 %0, 68
%14 = inttoptr i64 %13 to i64*
store volatile i64 %2, i64* %14
br label %15
15: ; preds = %12, %9
ret void
}
char *hello_world() { return "Hello World"; }


x86 assembly (clang, -O0):
<hello_world>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello_world>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
define i8* @hello_world() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
define i8* @hello_world() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
double pow(double, double);
double sRGBToLinear(double value) {
  return (value <= 0.04045) ? value / 12.92 : pow((value + 0.055) / 1.055, 2.4);
}


x86 assembly (clang, -O0):
<sRGBToLinear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     114b <sRGBToLinear+0x3b>
movsd  -0x8(%rbp),%xmm0
movsd  0xee3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1176 <sRGBToLinear+0x66>
movsd  0xec5(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xeb0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe9c(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sRGBToLinear>:
movsd  0xee8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    113b <sRGBToLinear+0x2b>
addsd  0xeea(%rip),%xmm0
divsd  0xeea(%rip),%xmm0
movsd  0xeea(%rip),%xmm1
jmp    1030 <pow@plt>
divsd  0xec5(%rip),%xmm0
ret

LLVM IR (-O0):
define double @sRGBToLinear(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ole double %3, 4.045000e-02
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fdiv double %6, 1.292000e+01
br label %13
8: ; preds = %1
%9 = load double, double* %2
%10 = fadd double %9, 5.500000e-02
%11 = fdiv double %10, 1.055000e+00
%12 = call double @pow(double %11, double 2.400000e+00)
br label %13
13: ; preds = %8, %5
%14 = phi double [ %7, %5 ], [ %12, %8 ]
ret double %14
}

LLVM IR (-O2):
define double @sRGBToLinear(double %0) {
%2 = fcmp ugt double %0, 4.045000e-02
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = fdiv double %0, 1.292000e+01
br label %9
5: ; preds = %1
%6 = fadd double %0, 5.500000e-02
%7 = fdiv double %6, 1.055000e+00
%8 = tail call double @pow(double %7, double 2.400000e+00)
br label %9
9: ; preds = %5, %3
%10 = phi double [ %4, %3 ], [ %8, %5 ]
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_pthread_cleanup_pop(int execute) {
  printf("UNIMPLEMENTED: pthread_cleanup_pop\n");
}


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

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

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

LLVM IR (-O2):
@str = [35 x i8] c"UNIMPLEMENTED: pthread_cleanup_pop\00"
define void @my_pthread_cleanup_pop(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double exp(double);
double cBtoG(double x) { return exp(0.01151292546498 * x); }


x86 assembly (clang, -O0):
<cBtoG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cBtoG>:
mulsd  0xee8(%rip),%xmm0
jmp    1030 <exp@plt>

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

LLVM IR (-O2):
define double @cBtoG(double %0) {
%2 = fmul double %0, 0x3F879416B2D3B61C
%3 = tail call double @exp(double %2)
ret double %3
}
main() {
  return ({
    extern timmay __asm("yo");
    timmay;
  });
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    0x2ece(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@yo = external global i32
define i32 @main() {
%1 = load i32, i32* @yo
ret i32 %1
}
unsigned int RasterIdGet(unsigned int baseAddr) {
  return ((*((volatile unsigned int *)(baseAddr + (0x0)))));
}


x86 assembly (clang, -O0):
<RasterIdGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x0,%eax
mov    %eax,%eax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RasterIdGet>:
mov    %edi,%eax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
define i32 @RasterIdGet(i32 %0) {
%2 = zext i32 %0 to i64
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
ret i32 %4
}
void SCB_DisableICache(void) {}


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

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

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

LLVM IR (-O2):
define void @SCB_DisableICache() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  union {
    int i;
    struct {
      char first;
      char second;
    } half;
  } number;
  number.i = 0x4241;
  printf("%c%c\n", number.half.first, number.half.second);
  number.half.first = 'a';
  number.half.second = 'b';
  printf("%x\n", number.i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4241,-0x8(%rbp)
movsbl -0x8(%rbp),%esi
movsbl -0x7(%rbp),%edx
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x61,-0x8(%rbp)
movb   $0x62,-0x7(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
%struct.anon = type { i8, i8 }
@.str = [6 x i8] c"%c%c\0A\00"
@.str.1 = [4 x i8] c"%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.anon
store i32 0, i32* %1
%3 = bitcast %union.anon* %2 to i32*
store i32 16961, i32* %3
%4 = bitcast %union.anon* %2 to %struct.anon*
%5 = getelementptr inbounds %struct.anon, %struct.anon* %4, i32 0, i32 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = bitcast %union.anon* %2 to %struct.anon*
%9 = getelementptr inbounds %struct.anon, %struct.anon* %8, i32 0, i32 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %11)
%13 = bitcast %union.anon* %2 to %struct.anon*
%14 = getelementptr inbounds %struct.anon, %struct.anon* %13, i32 0, i32 0
store i8 97, i8* %14
%15 = bitcast %union.anon* %2 to %struct.anon*
%16 = getelementptr inbounds %struct.anon, %struct.anon* %15, i32 0, i32 1
store i8 98, i8* %16
%17 = bitcast %union.anon* %2 to i32*
%18 = load i32, i32* %17
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%c%c\0A\00"
@.str.1 = [4 x i8] c"%x\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 65, i32 66)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 25185)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print(char what) { printf("%c\n", what); }


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define void @print(i8 signext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret void
}
/* Variables and functions */
int lib_qsort_randomized_partition(int *, int, int);
void lib_qsort(int *array, int start, int end) {
  int partition_index;
  if (start < end) {
    partition_index = lib_qsort_randomized_partition(array, start, end);
    lib_qsort(array, start, partition_index - 1);
    lib_qsort(array, partition_index + 1, end);
  }
}


x86 assembly (clang, -O0):
<lib_qsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <lib_qsort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <lib_qsort_randomized_partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1030 <lib_qsort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <lib_qsort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib_qsort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <lib_qsort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <lib_qsort_randomized_partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <lib_qsort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <lib_qsort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @lib_qsort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @lib_qsort_randomized_partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @lib_qsort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
unsigned int random();
unsigned roughly(unsigned value) {
  return value * 3 / 4 + random() % (value / 4);
}


x86 assembly (clang, -O0):
<roughly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3,-0x4(%rbp),%eax
shr    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    -0x4(%rbp),%ecx
shr    $0x2,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x8(%rbp),%eax
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roughly>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    (%rbx,%rbx,2),%ebp
shr    $0x2,%ebp
xor    %eax,%eax
call   1030 <random@plt>
shr    $0x2,%ebx
xor    %edx,%edx
div    %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @roughly(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 3
%5 = udiv i32 %4, 4
%6 = call i32 (...) @random()
%7 = load i32, i32* %2
%8 = udiv i32 %7, 4
%9 = urem i32 %6, %8
%10 = add i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @roughly(i32 %0) {
%2 = mul i32 %0, 3
%3 = lshr i32 %2, 2
%4 = tail call i32 (...) @random()
%5 = lshr i32 %0, 2
%6 = urem i32 %4, %5
%7 = add nuw nsw i32 %6, %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void _exit(int status) {
  write(1, "exit", 4);
  while (1) {
    ;
  }
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
lea    0xed9(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
jmp    1131 <_exit+0x21>

x86 assembly (clang, -O2):
<_exit>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
mov    $0x4,%edx
call   1030 <write@plt>
nopw   0x0(%rax,%rax,1)
jmp    1130 <_exit+0x20>

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
br label %4
4: ; preds = %1, %4
br label %4
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
define void @_exit(i32 %0) {
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
br label %3
3: ; preds = %1, %3
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const, int const, int const, int const);
void printAnsLine(const int index, const int dij, const int i, const int j) {
  printf("e[%d]=%d\td(%d,%d)\n", index, dij, i, j);
}


x86 assembly (clang, -O0):
<printAnsLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAnsLine>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"e[%d]=%d\09d(%d,%d)\0A\00"
define void @printAnsLine(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"e[%d]=%d\09d(%d,%d)\0A\00"
define void @printAnsLine(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
int next_calc_stamp() {
  static int gCalcStamp = 0;
  ++gCalcStamp;
  if (gCalcStamp < 0)
    gCalcStamp = 0;
  return gCalcStamp;
}


x86 assembly (clang, -O0):
<next_calc_stamp>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
cmpl   $0x0,0x2f0a(%rip)
jge    112a <next_calc_stamp+0x2a>
movl   $0x0,0x2efa(%rip)
mov    0x2ef4(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_calc_stamp>:
mov    0x2f1e(%rip),%ecx
test   %ecx,%ecx
mov    $0xffffffff,%eax
cmovns %ecx,%eax
add    $0x1,%eax
mov    %eax,0x2f0b(%rip)
ret

LLVM IR (-O0):
@next_calc_stamp.gCalcStamp = internal global i32 0
define i32 @next_calc_stamp() {
%1 = load i32, i32* @next_calc_stamp.gCalcStamp
%2 = add nsw i32 %1, 1
store i32 %2, i32* @next_calc_stamp.gCalcStamp
%3 = load i32, i32* @next_calc_stamp.gCalcStamp
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* @next_calc_stamp.gCalcStamp
br label %6
6: ; preds = %5, %0
%7 = load i32, i32* @next_calc_stamp.gCalcStamp
ret i32 %7
}

LLVM IR (-O2):
@next_calc_stamp.gCalcStamp = internal unnamed_addr global i32 0
define i32 @next_calc_stamp() {
%1 = load i32, i32* @next_calc_stamp.gCalcStamp
%2 = icmp sgt i32 %1, -1
%3 = select i1 %2, i32 %1, i32 -1
%4 = add nsw i32 %3, 1
store i32 %4, i32* @next_calc_stamp.gCalcStamp
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *argv0) {
  printf("Usage: %s <filename.spc> [<offset>]\n", argv0);
}


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

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

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

LLVM IR (-O2):
@.str = [37 x i8] c"Usage: %s <filename.spc> [<offset>]\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void practice2D10() {
  int x = 0b00101001;
  int y = 0b00101011;
  int z = 0b00101001;
  printf("0x%x\n", !(x ^ y));
  printf("0x%x\n", !(x ^ z));
}


x86 assembly (clang, -O0):
<practice2D10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x29,-0x4(%rbp)
movl   $0x2b,-0x8(%rbp)
movl   $0x29,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
xor    -0xc(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<practice2D10>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"0x%x\0A\00"
define void @practice2D10() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 41, i32* %1
store i32 43, i32* %2
store i32 41, i32* %3
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = xor i32 %4, %5
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = load i32, i32* %3
%13 = xor i32 %11, %12
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
%16 = zext i1 %15 to i32
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"0x%x\0A\00"
define void @practice2D10() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EX_OSERR;
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t nbytes) {
  void *p = realloc(ptr, nbytes);
  if (p == NULL)
    errx(EX_OSERR, "out of memory");
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1161 <xrealloc+0x41>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
call   1030 <errx@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <xrealloc+0x23>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1030 <errx@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@EX_OSERR = global i32 0
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @EX_OSERR
%7 = tail call i32 @errx(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
struct rGPIO {
  int dummy;
};

/* Variables and functions */
scalar_t__ GetMmap_(int);
struct rGPIO *GetGPIOD() {
  return (struct rGPIO *)GetMmap_(0xC0010000 + 0xD000);
}


x86 assembly (clang, -O0):
<GetGPIOD>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc001d000,%edi
call   1030 <GetMmap_@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetGPIOD>:
mov    $0xc001d000,%edi
jmp    1030 <GetMmap_@plt>

LLVM IR (-O0):
%struct.rGPIO = type { i32 }
define %struct.rGPIO* @GetGPIOD() {
%1 = call i64 @GetMmap_(i32 -1073623040)
%2 = inttoptr i64 %1 to %struct.rGPIO*
ret %struct.rGPIO* %2
}

LLVM IR (-O2):
%struct.rGPIO = type { i32 }
define %struct.rGPIO* @GetGPIOD() {
%1 = tail call i64 @GetMmap_(i32 -1073623040)
%2 = inttoptr i64 %1 to %struct.rGPIO*
ret %struct.rGPIO* %2
}
float celsius_to_fahrenheit(float temperature) {
  return temperature * 9 / 5 + 32;
}


x86 assembly (clang, -O0):
<celsius_to_fahrenheit>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xee6(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xed6(%rip),%xmm1
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<celsius_to_fahrenheit>:
mulss  0xef8(%rip),%xmm0
divss  0xef4(%rip),%xmm0
addss  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define float @celsius_to_fahrenheit(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 9.000000e+00
%5 = fdiv float %4, 5.000000e+00
%6 = fadd float %5, 3.200000e+01
ret float %6
}

LLVM IR (-O2):
define float @celsius_to_fahrenheit(float %0) {
%2 = fmul float %0, 9.000000e+00
%3 = fdiv float %2, 5.000000e+00
%4 = fadd float %3, 3.200000e+01
ret float %4
}
int main() {
  int y[5][2];
  int *p = y;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [5 x [2 x i32]]
%2 = alloca i32*
%3 = getelementptr inbounds [5 x [2 x i32]], [5 x [2 x i32]]* %1, i64 0, i64 0
%4 = bitcast [2 x i32]* %3 to i32*
store i32* %4, i32** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int mDB_log(fn, onoff) { return mDBi_msg('L', fn, 0, 0, onoff, 0, 0, 0); }


x86 assembly (clang, -O0):
<mDB_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%r8d
mov    $0x4c,%edi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x0,%al
call   1030 <mDBi_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mDB_log>:
push   %rax
mov    %esi,%r8d
mov    %edi,%esi
mov    $0x4c,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r9d,%r9d
xor    %eax,%eax
push   $0x0
push   $0x0
call   1030 <mDBi_msg@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mDB_log(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 = call i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @mDBi_msg to i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 76, i32 %5, i32 0, i32 0, i32 %6, i32 0, i32 0, i32 0)
ret i32 %7
}

LLVM IR (-O2):
define i32 @mDB_log(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @mDBi_msg to i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 76, i32 %0, i32 0, i32 0, i32 %1, i32 0, i32 0, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int leeNumero() {
  int control = -1;
  while (control < 0) {
    scanf("%d", &control);
    if (control < 0)
      printf("Numero negativo, vuelva a introducirlo:");
  }
  return (control);
}


x86 assembly (clang, -O0):
<leeNumero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1164 <leeNumero+0x44>
lea    0xec0(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jge    115f <leeNumero+0x3f>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <leeNumero+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leeNumero>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xec8(%rip),%r14
lea    0xc(%rsp),%rbx
lea    0xebf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jns    1173 <leeNumero+0x53>
mov    %r15,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     1150 <leeNumero+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [40 x i8] c"Numero negativo, vuelva a introducirlo:\00"
define i32 @leeNumero() {
%1 = alloca i32
store i32 -1, i32* %1
br label %2
2: ; preds = %11, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
br label %2
12: ; preds = %2
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [40 x i8] c"Numero negativo, vuelva a introducirlo:\00"
define i32 @leeNumero() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
br label %3
3: ; preds = %0, %7
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 0
br i1 %10, label %3, label %11
11: ; preds = %3, %7
%12 = phi i32 [ %9, %7 ], [ %5, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void defaultFree(void *vpt) { free(vpt); }


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

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

LLVM IR (-O2):
define void @defaultFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int hash(char *key, int size) {
  int h;
  for (h = 0; *key != '\0'; key++)
    h = (h * 256 + (*key)) % size;
  return h;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <hash+0x49>
mov    -0x10(%rbp),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1112 <hash+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     112b <hash+0x2b>
add    $0x1,%rdi
xor    %edx,%edx
nopl   0x0(%rax)
movsbl %al,%eax
shl    $0x8,%edx
add    %eax,%edx
mov    %edx,%eax
cltd
idiv   %esi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
mov    %edx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %13, %5 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = shl nsw i32 %7, 8
%11 = add nsw i32 %10, %9
%12 = srem i32 %11, %1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %17
}
unsigned long str$divide_not(const unsigned long *asign, const long *aexp,
                             const struct dsc$descriptor_s *a_digits,
                             const unsigned long *bsign, const long *bexp,
                             const struct dsc$descriptor_s *b_digits,
                             const long *total_digits,
                             const long *round_truncate_indicator,
                             unsigned long *csign, long *cexp,
                             struct dsc$descriptor_s *cdigits) {
  assert(0);
  return 2392148;
}


x86 assembly (clang, -O0):
<str$divide_not>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    $0x248054,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str$divide_not>:
push   %rax
xor    %edi,%edi
xor    %eax,%eax
call   1030 <assert@plt>
mov    $0x248054,%eax
pop    %rcx
ret

LLVM IR (-O0):
%"struct.dsc$descriptor_s" = type opaque
define i64 @"str$divide_not"(i64* %0, i64* %1, %"struct.dsc$descriptor_s"* %2, i64* %3, i64* %4, %"struct.dsc$descriptor_s"* %5, i64* %6, i64* %7, i64* %8, i64* %9, %"struct.dsc$descriptor_s"* %10) {
%12 = alloca i64*
%13 = alloca i64*
%14 = alloca %"struct.dsc$descriptor_s"*
%15 = alloca i64*
%16 = alloca i64*
%17 = alloca %"struct.dsc$descriptor_s"*
%18 = alloca i64*
%19 = alloca i64*
%20 = alloca i64*
%21 = alloca i64*
%22 = alloca %"struct.dsc$descriptor_s"*
store i64* %0, i64** %12
store i64* %1, i64** %13
store %"struct.dsc$descriptor_s"* %2, %"struct.dsc$descriptor_s"** %14
store i64* %3, i64** %15
store i64* %4, i64** %16
store %"struct.dsc$descriptor_s"* %5, %"struct.dsc$descriptor_s"** %17
store i64* %6, i64** %18
store i64* %7, i64** %19
store i64* %8, i64** %20
store i64* %9, i64** %21
store %"struct.dsc$descriptor_s"* %10, %"struct.dsc$descriptor_s"** %22
%23 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
ret i64 2392148
}

LLVM IR (-O2):
%"struct.dsc$descriptor_s" = type opaque
define i64 @"str$divide_not"(i64* nocapture readnone %0, i64* nocapture readnone %1, %"struct.dsc$descriptor_s"* nocapture readnone %2, i64* nocapture readnone %3, i64* nocapture readnone %4, %"struct.dsc$descriptor_s"* nocapture readnone %5, i64* nocapture readnone %6, i64* nocapture readnone %7, i64* nocapture readnone %8, i64* nocapture readnone %9, %"struct.dsc$descriptor_s"* nocapture readnone %10) {
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
ret i64 2392148
}
/* Variables and functions */
int /*<<< orphan*/ default_isr();
__attribute__((weak)) void SPI2_Handler() { default_isr(); }


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

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

LLVM IR (-O0):
define weak void @SPI2_Handler() {
%1 = call i32 (...) @default_isr()
ret void
}

LLVM IR (-O2):
define weak void @SPI2_Handler() {
%1 = tail call i32 (...) @default_isr()
ret void
}
/* Variables and functions */
int test_loopback(int);
int nominal_test(int fd) {
  int rc;
  rc = test_loopback(fd);
  return rc;
}


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

x86 assembly (clang, -O2):
<nominal_test>:
jmp    1030 <test_loopback@plt>

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

LLVM IR (-O2):
define i32 @nominal_test(i32 %0) {
%2 = tail call i32 @test_loopback(i32 %0)
ret i32 %2
}