xunge/DecIR huggingface dataset:
int tonum(char c) { return c - '0'; }


x86 assembly (clang, -O0):
<tonum>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tonum>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @tonum(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @tonum(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ send_event;
};
struct TYPE_4__ {
  TYPE_1__ xcolormap;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xcolormap_send_event(void *_p) {
  return (int)((XEvent *)_p)->xcolormap.send_event;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i32 @get_XEvent_xcolormap_send_event(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_XEvent_xcolormap_send_event(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ck_free(void *mem) {
  if (mem)
    free(mem);
}


x86 assembly (clang, -O0):
<ck_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <ck_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ck_free>:
test   %rdi,%rdi
je     111a <ck_free+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @ck_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @ck_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void GPMCPrefetchEngineStart(unsigned int baseAddr) {
  (*((volatile unsigned int *)(baseAddr + (0x1EC)))) = (0x1u);
}


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

x86 assembly (clang, -O2):
<GPMCPrefetchEngineStart>:
add    $0x1ec,%edi
movl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @GPMCPrefetchEngineStart(i32 %0) {
%2 = add i32 %0, 492
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
store volatile i32 1, i32* %4
ret void
}
char relationChar(double left, double right) {
  if (left > right)
    return ('>');
  else if (left == right)
    return ('=');
  else
    return ('<');
}


x86 assembly (clang, -O0):
<relationChar>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1127 <relationChar+0x27>
movb   $0x3e,-0x1(%rbp)
jmp    114a <relationChar+0x4a>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1146 <relationChar+0x46>
jp     1146 <relationChar+0x46>
movb   $0x3d,-0x1(%rbp)
jmp    114a <relationChar+0x4a>
movb   $0x3c,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<relationChar>:
ucomisd %xmm1,%xmm0
setnp  %al
sete   %cl
and    %al,%cl
or     $0x3c,%cl
ucomisd %xmm1,%xmm0
movzbl %cl,%ecx
mov    $0x3e,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @relationChar(double %0, double %1) {
%3 = alloca i8
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i8 62, i8* %3
br label %16
10: ; preds = %2
%11 = load double, double* %4
%12 = load double, double* %5
%13 = fcmp oeq double %11, %12
br i1 %13, label %14, label %15
14: ; preds = %10
store i8 61, i8* %3
br label %16
15: ; preds = %10
store i8 60, i8* %3
br label %16
16: ; preds = %15, %14, %9
%17 = load i8, i8* %3
ret i8 %17
}

LLVM IR (-O2):
define signext i8 @relationChar(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = fcmp oeq double %0, %1
%5 = select i1 %4, i8 61, i8 60
%6 = select i1 %3, i8 62, i8 %5
ret i8 %6
}
void timer_start(void) {
  if (0 == 1) {
    *(volatile unsigned *)0x0A800000 = 0x001ffff0;
    *(volatile unsigned *)0x0A800008 = (0x80 | 0x40 | 0x08);
    *(volatile unsigned *)0x0A000008 = 0x0010;
  } else {
    *(volatile unsigned *)0x03ff6004 = 0x001ffff0;
    *(volatile unsigned *)0x03ff6000 |= 0x1;
    *(volatile int *)(volatile unsigned *)0x03ff4008 &=
        ~((1 << 21) | (1 << 10) | (1 << 0));
  }
}


x86 assembly (clang, -O0):
<timer_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3ff6004,%eax
movl   $0x1ffff0,(%rax)
mov    $0x3ff6000,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x3ff6000,%eax
mov    %ecx,(%rax)
mov    $0x3ff4008,%eax
mov    (%rax),%ecx
and    $0xffdffbfe,%ecx
mov    $0x3ff4008,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_start>:
movl   $0x1ffff0,0x3ff6004
orl    $0x1,0x3ff6000
01
andl   $0xffdffbfe,0x3ff4008
fe fb df ff
ret

LLVM IR (-O0):
define void @timer_start() {
store volatile i32 2097136, i32* inttoptr (i64 67067908 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 67067904 to i32*)
%2 = or i32 %1, 1
store volatile i32 %2, i32* inttoptr (i64 67067904 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 67059720 to i32*)
%4 = and i32 %3, -2098178
store volatile i32 %4, i32* inttoptr (i64 67059720 to i32*)
ret void
}

LLVM IR (-O2):
define void @timer_start() {
store volatile i32 2097136, i32* inttoptr (i64 67067908 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 67067904 to i32*)
%2 = or i32 %1, 1
store volatile i32 %2, i32* inttoptr (i64 67067904 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 67059720 to i32*)
%4 = and i32 %3, -2098178
store volatile i32 %4, i32* inttoptr (i64 67059720 to i32*)
ret void
}
/* Variables and functions */
long factorial_iteration(int);
long factorial_recursion(int);
int /*<<< orphan*/ printf(char *, int, long);
int main() {
  int N = 10;
  long recursion_result = factorial_recursion(N);
  long iteration_result = factorial_iteration(N);
  printf("The factorial(recursion) of %ld is %ld!\n", N, recursion_result);
  printf("The factorial(iteration) of %ld is %ld!\n", N, iteration_result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <factorial_recursion@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <factorial_iteration@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xa,%edi
call   1040 <factorial_recursion@plt>
mov    %rax,%rbx
mov    $0xa,%edi
call   1050 <factorial_iteration@plt>
mov    %rax,%r14
lea    0xeab(%rip),%rdi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0xa,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"The factorial(recursion) of %ld is %ld!\0A\00"
@.str.1 = [41 x i8] c"The factorial(iteration) of %ld is %ld!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i32 10, i32* %2
%5 = load i32, i32* %2
%6 = call i64 @factorial_recursion(i32 %5)
store i64 %6, i64* %3
%7 = load i32, i32* %2
%8 = call i64 @factorial_iteration(i32 %7)
store i64 %8, i64* %4
%9 = load i32, i32* %2
%10 = load i64, i64* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %9, i64 %10)
%12 = load i32, i32* %2
%13 = load i64, i64* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %12, i64 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"The factorial(recursion) of %ld is %ld!\0A\00"
@.str.1 = [41 x i8] c"The factorial(iteration) of %ld is %ld!\0A\00"
define i32 @main() {
%1 = tail call i64 @factorial_recursion(i32 10)
%2 = tail call i64 @factorial_iteration(i32 10)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 10, i64 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 10, i64 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ putchar(char);
void parse_error(const char *message, char *a, char *b) {
  printf("%s: ", message);
  while (a != b)
    putchar(*a++);
  putchar('\n');
}


x86 assembly (clang, -O0):
<parse_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     116e <parse_error+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    1144 <parse_error+0x24>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_error>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
cmp    %r14,%rbx
je     1151 <parse_error+0x31>
xchg   %ax,%ax
movsbl (%rbx),%edi
add    $0x1,%rbx
call   1030 <putchar@plt>
cmp    %r14,%rbx
jne    1140 <parse_error+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
define void @parse_error(i8* %0, i8* %1, i8* readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i8* %1, %2
br i1 %5, label %12, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %8, %6 ], [ %1, %3 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %7
%10 = tail call i32 @putchar(i8 signext %9)
%11 = icmp eq i8* %8, %2
br i1 %11, label %12, label %6
12: ; preds = %6, %3
%13 = tail call i32 @putchar(i8 signext 10)
ret void
}
/* Variables and functions */
int atoi(char *);
int stringToInt(char *s) { return atoi(s); }


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

x86 assembly (clang, -O2):
<stringToInt>:
jmp    1030 <atoi@plt>

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

LLVM IR (-O2):
define i32 @stringToInt(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
ret i32 %2
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ gc;
};
typedef TYPE_1__ XEDataObject;

/* Variables and functions */
void *get_XEDataObject_gc(void *_p) { return (void *)((XEDataObject *)_p)->gc; }


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

x86 assembly (clang, -O2):
<get_XEDataObject_gc>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i8* @get_XEDataObject_gc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @get_XEDataObject_gc(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_mempool_new() {
  printf("NOT IMPLEMENTED:"
         "pa_mempool_new"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [31 x i8] c"NOT IMPLEMENTED:pa_mempool_new\00"
define i32 @pa_mempool_new() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int UP3D_GetParameter(int);
int32_t UP3D_GetAxisState(int axis) {
  if ((axis < 1) || (axis > 4))
    return -1;
  int32_t state = UP3D_GetParameter(0x1E + axis - 1);
  if (state > 2)
    state = 3;
  return state;
}


x86 assembly (clang, -O0):
<UP3D_GetAxisState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     112f <UP3D_GetAxisState+0x1f>
cmpl   $0x4,-0x8(%rbp)
jle    113b <UP3D_GetAxisState+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <UP3D_GetAxisState+0x53>
mov    -0x8(%rbp),%edi
add    $0x1e,%edi
sub    $0x1,%edi
call   1030 <UP3D_GetParameter@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jle    115d <UP3D_GetAxisState+0x4d>
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UP3D_GetAxisState>:
lea    -0x5(%rdi),%ecx
mov    $0xffffffff,%eax
cmp    $0xfffffffc,%ecx
jb     1137 <UP3D_GetAxisState+0x27>
push   %rax
add    $0x1d,%edi
call   1030 <UP3D_GetParameter@plt>
mov    %eax,%ecx
cmp    $0x3,%eax
mov    $0x3,%eax
cmovl  %ecx,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @UP3D_GetAxisState(i32 %0) {
%2 = add i32 %0, -5
%3 = icmp ult i32 %2, -4
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = add nuw nsw i32 %0, 29
%6 = tail call i32 @UP3D_GetParameter(i32 %5)
%7 = icmp slt i32 %6, 3
%8 = select i1 %7, i32 %6, i32 3
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ -1, %1 ]
ret i32 %10
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateTamperEventsConfig(uint32_t ui32Config) {
  uint32_t ui32Temp;
  ui32Temp = ((*((volatile uint32_t *)(0x400FC400))) & ~0x00000300);
  (*((volatile uint32_t *)(0x400FC360))) = 0xA3359554;
  _HibernateWriteComplete();
  (*((volatile uint32_t *)(0x400FC400))) = (ui32Temp | ui32Config);
  _HibernateWriteComplete();
  (*((volatile uint32_t *)(0x400FC360))) = 0;
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateTamperEventsConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x400fc400,%eax
mov    (%rax),%eax
and    $0xfffffcff,%eax
mov    %eax,-0x8(%rbp)
mov    $0x400fc360,%eax
movl   $0xa3359554,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    -0x8(%rbp),%ecx
or     -0x4(%rbp),%ecx
mov    $0x400fc400,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    $0x400fc360,%eax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateTamperEventsConfig>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xfffffcff,%ebp
and    0x400fc400,%ebp
movl   $0xa3359554,0x400fc360
54 95 35 a3
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
or     %ebx,%ebp
mov    %ebp,0x400fc400
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
movl   $0x0,0x400fc360
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateTamperEventsConfig(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load volatile i32, i32* inttoptr (i64 1074775040 to i32*)
%5 = and i32 %4, -769
store i32 %5, i32* %3
store volatile i32 -1556769452, i32* inttoptr (i64 1074774880 to i32*)
%6 = call i32 (...) @_HibernateWriteComplete()
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = or i32 %7, %8
store volatile i32 %9, i32* inttoptr (i64 1074775040 to i32*)
%10 = call i32 (...) @_HibernateWriteComplete()
store volatile i32 0, i32* inttoptr (i64 1074774880 to i32*)
%11 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateTamperEventsConfig(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 1074775040 to i32*)
%3 = and i32 %2, -769
store volatile i32 -1556769452, i32* inttoptr (i64 1074774880 to i32*)
%4 = tail call i32 (...) @_HibernateWriteComplete()
%5 = or i32 %3, %0
store volatile i32 %5, i32* inttoptr (i64 1074775040 to i32*)
%6 = tail call i32 (...) @_HibernateWriteComplete()
store volatile i32 0, i32* inttoptr (i64 1074774880 to i32*)
%7 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}
/* Variables and functions */
float sqrt(float);
float hypot(float a, float b) { return sqrt(a * a + b * b); }


x86 assembly (clang, -O0):
<hypot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypot>:
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1129 <hypot+0x19>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @hypot(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %3
%7 = load float, float* %4
%8 = load float, float* %4
%9 = fmul float %7, %8
%10 = call float @llvm.fmuladd.f32(float %5, float %6, float %9)
%11 = call float @sqrt(float %10)
ret float %11
}

LLVM IR (-O2):
define float @hypot(float %0, float %1) {
%3 = fmul float %1, %1
%4 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %3)
%5 = tail call float @sqrt(float %4)
ret float %5
}
int my_isalpha(char c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}


x86 assembly (clang, -O0):
<my_isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <my_isalpha+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    114e <my_isalpha+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <my_isalpha+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_isalpha>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @my_isalpha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @my_isalpha(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
int cmd_linkset_status(int fd, int argc, char *argv[]) { return 0; }


x86 assembly (clang, -O0):
<cmd_linkset_status>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cmd_linkset_status(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @cmd_linkset_status(i32 %0, i32 %1, i8** nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
double JetPaletteBase(double);
double JetPaletteGreen(double gray) { return JetPaletteBase(gray); }


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

x86 assembly (clang, -O2):
<JetPaletteGreen>:
jmp    1030 <JetPaletteBase@plt>

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

LLVM IR (-O2):
define double @JetPaletteGreen(double %0) {
%2 = tail call double @JetPaletteBase(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ complententodoselectionsort(int *, int, int);
void selectionsort(int *vetor, int tamanho) {
  int i, j, min, aux;
  for (i = 0; i < (tamanho - 1); i++) {
    complententodoselectionsort(vetor, tamanho, i);
  }
}


x86 assembly (clang, -O0):
<selectionsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1154 <selectionsort+0x44>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <complententodoselectionsort@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <selectionsort+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<selectionsort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%esi
jl     1144 <selectionsort+0x34>
mov    %esi,%r15d
mov    %rdi,%r14
lea    -0x1(%r15),%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1030 <complententodoselectionsort@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <selectionsort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @selectionsort(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** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i32*, i32** %3
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i32 @complententodoselectionsort(i32* %15, i32 %16, i32 %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %9
22: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @selectionsort(i32* %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %10
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 0, %2 ]
%7 = tail call i32 @complententodoselectionsort(i32* %0, i32 %1, i32 %6)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, %3
br i1 %9, label %10, label %5
10: ; preds = %5, %2
ret void
}
int kinit() { return 0; }


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

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

LLVM IR (-O0):
define i32 @kinit() {
ret i32 0
}

LLVM IR (-O2):
define i32 @kinit() {
ret i32 0
}
/* Type definitions */
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
double timeval2double(const struct timeval pair) {
  return pair.tv_sec + pair.tv_usec / (1000 * 1000.0);
}


x86 assembly (clang, -O0):
<timeval2double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xee2(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval2double>:
cvtsi2sd %edi,%xmm1
divsd  0xef4(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
define double @timeval2double(double %0, i32 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to { double, i32 }*
%5 = getelementptr inbounds { double, i32 }, { double, i32 }* %4, i32 0, i32 0
store double %0, double* %5
%6 = getelementptr inbounds { double, i32 }, { double, i32 }* %4, i32 0, i32 1
store i32 %1, i32* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%10 = load i32, i32* %9
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, 1.000000e+06
%13 = fadd double %8, %12
ret double %13
}

LLVM IR (-O2):
define double @timeval2double(double %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fdiv double %3, 1.000000e+06
%5 = fadd double %4, %0
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ mainer(int /*<<< orphan*/, char **);
void cmb_main() {
  char *parameter[] = {"", ""};
  mainer(0, parameter);
}


x86 assembly (clang, -O0):
<cmb_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2cf1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cee(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rsi
xor    %edi,%edi
call   1030 <mainer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmb_main>:
sub    $0x18,%rsp
movaps 0x2cf5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
xor    %edi,%edi
call   1030 <mainer@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@__const.cmb_main.parameter = [2 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0)]
define void @cmb_main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = call i32 @mainer(i32 0, i8** %3)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@__const.cmb_main.parameter = [2 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0)]
define void @cmb_main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = call i32 @mainer(i32 0, i8** %3)
ret void
}
int sys$deq(unsigned int lkid, void *valblk, unsigned int acmode,
            unsigned int flags) {
  return ({
    unsigned long resultvar;
    register long int _a4 asm("r10") = (long)(flags);
    register long int _a3 asm("rdx") = (long)(acmode);
    register long int _a2 asm("rsi") = (long)(valblk);
    register long int _a1 asm("rdi") = (long)(lkid);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x81\n\t"
                 : "=a"(resultvar)
                 : "i"(29), "r"(_a1), "r"(_a2), "r"(_a3), "r"(_a4)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$deq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%r10
mov    $0x1d,%rax
int    $0x81
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys$deq>:
mov    %ecx,%r10d
mov    %edx,%edx
mov    %edi,%edi
mov    $0x1d,%rax
int    $0x81
ret

LLVM IR (-O0):
define i32 @"sys$deq"(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%15 = load i32, i32* %8
%16 = zext i32 %15 to i64
store i64 %16, i64* %10
%17 = load i32, i32* %7
%18 = zext i32 %17 to i64
store i64 %18, i64* %11
%19 = load i8*, i8** %6
%20 = ptrtoint i8* %19 to i64
store i64 %20, i64* %12
%21 = load i32, i32* %5
%22 = zext i32 %21 to i64
store i64 %22, i64* %13
%23 = load i64, i64* %13
%24 = load i64, i64* %12
%25 = load i64, i64* %11
%26 = load i64, i64* %10
%27 = call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},{rsi},{rdx},{r10},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 29, i64 %23, i64 %24, i64 %25, i64 %26)
store i64 %27, i64* %9
%28 = load i64, i64* %9
store i64 %28, i64* %14
%29 = load i64, i64* %14
%30 = trunc i64 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @"sys$deq"(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = zext i32 %3 to i64
%6 = zext i32 %2 to i64
%7 = ptrtoint i8* %1 to i64
%8 = zext i32 %0 to i64
%9 = tail call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},{rsi},{rdx},{r10},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 29, i64 %8, i64 %7, i64 %6, i64 %5)
%10 = trunc i64 %9 to i32
ret i32 %10
}
/* Variables and functions */
void *malloc(int);
void *alloc_noswap(int size) {
  void *ptr;
  ptr = malloc(size);
  if (ptr == NULL)
    return NULL;
  return ptr;
}


x86 assembly (clang, -O0):
<alloc_noswap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    113f <alloc_noswap+0x2f>
movq   $0x0,-0x8(%rbp)
jmp    1147 <alloc_noswap+0x37>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_noswap>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @alloc_noswap(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Type definitions */
struct value_nd {
  int dummy;
};
struct instr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assembler_err(struct instr *, char *);
int expect(struct instr *instr, struct value_nd *nd) {
  if (!nd) {
    assembler_err(instr, "expected operand");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<expect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1147 <expect+0x37>
mov    -0x10(%rbp),%rdi
lea    0xeca(%rip),%rsi
call   1030 <assembler_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <expect+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect>:
xor    %eax,%eax
test   %rsi,%rsi
je     1118 <expect+0x8>
ret
push   %rax
lea    0xee0(%rip),%rsi
call   1030 <assembler_err@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
%struct.instr = type { i32 }
%struct.value_nd = type { i32 }
@.str = [17 x i8] c"expected operand\00"
define i32 @expect(%struct.instr* %0, %struct.value_nd* %1) {
%3 = alloca i32
%4 = alloca %struct.instr*
%5 = alloca %struct.value_nd*
store %struct.instr* %0, %struct.instr** %4
store %struct.value_nd* %1, %struct.value_nd** %5
%6 = load %struct.value_nd*, %struct.value_nd** %5
%7 = icmp ne %struct.value_nd* %6, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load %struct.instr*, %struct.instr** %4
%10 = call i32 @assembler_err(%struct.instr* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %12
11: ; preds = %2
store i32 0, i32* %3
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
%struct.instr = type { i32 }
%struct.value_nd = type { i32 }
@.str = [17 x i8] c"expected operand\00"
define i32 @expect(%struct.instr* %0, %struct.value_nd* readnone %1) {
%3 = icmp eq %struct.value_nd* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @assembler_err(%struct.instr* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ -1, %4 ], [ 0, %2 ]
ret i32 %7
}
unsigned long swap_32(unsigned long n) {
  return (n >> 24) | ((n >> 8) & 0x0000FF00) | ((n << 8) & 0x00FF0000) |
         (n << 24);
}


x86 assembly (clang, -O0):
<swap_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x18,%rax
mov    -0x8(%rbp),%rcx
shr    $0x8,%rcx
and    $0xff00,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
shl    $0x8,%rcx
and    $0xff0000,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
shl    $0x18,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_32>:
mov    %rdi,%rax
shr    $0x18,%rax
mov    %rdi,%rcx
shr    $0x8,%rcx
and    $0xff00,%ecx
mov    %edi,%edx
shl    $0x8,%edx
and    $0xff0000,%edx
shl    $0x18,%rdi
or     %rdi,%rax
or     %rcx,%rax
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @swap_32(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 24
%5 = load i64, i64* %2
%6 = lshr i64 %5, 8
%7 = and i64 %6, 65280
%8 = or i64 %4, %7
%9 = load i64, i64* %2
%10 = shl i64 %9, 8
%11 = and i64 %10, 16711680
%12 = or i64 %8, %11
%13 = load i64, i64* %2
%14 = shl i64 %13, 24
%15 = or i64 %12, %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @swap_32(i64 %0) {
%2 = lshr i64 %0, 24
%3 = lshr i64 %0, 8
%4 = and i64 %3, 65280
%5 = shl i64 %0, 8
%6 = and i64 %5, 16711680
%7 = shl i64 %0, 24
%8 = or i64 %7, %2
%9 = or i64 %8, %4
%10 = or i64 %9, %6
ret i64 %10
}
/* Type definitions */
struct box_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ box_print_impl(struct box_t *, int /*<<< orphan*/);
void box_print(struct box_t *box) { box_print_impl(box, 0); }


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

x86 assembly (clang, -O2):
<box_print>:
xor    %esi,%esi
jmp    1030 <box_print_impl@plt>

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

LLVM IR (-O2):
%struct.box_t = type { i32 }
define void @box_print(%struct.box_t* %0) {
%2 = tail call i32 @box_print_impl(%struct.box_t* %0, i32 0)
ret void
}
void SysCtlResetFlagClear(void) {
  (*((volatile unsigned long *)(0x40021024))) |= 0x01000000;
}


x86 assembly (clang, -O0):
<SysCtlResetFlagClear>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40021024,%eax
mov    (%rax),%rcx
or     $0x1000000,%rcx
mov    $0x40021024,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlResetFlagClear>:
orq    $0x1000000,0x40021024
ret

LLVM IR (-O0):
define void @SysCtlResetFlagClear() {
%1 = load volatile i64, i64* inttoptr (i64 1073877028 to i64*)
%2 = or i64 %1, 16777216
store volatile i64 %2, i64* inttoptr (i64 1073877028 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlResetFlagClear() {
%1 = load volatile i64, i64* inttoptr (i64 1073877028 to i64*)
%2 = or i64 %1, 16777216
store volatile i64 %2, i64* inttoptr (i64 1073877028 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void fchs() {
  db(0xD9);
  db(0xE0);
}


x86 assembly (clang, -O0):
<fchs>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xe0,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fchs>:
push   %rax
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xe0,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @fchs() {
%1 = call i32 @db(i32 217)
%2 = call i32 @db(i32 224)
ret void
}

LLVM IR (-O2):
define void @fchs() {
%1 = tail call i32 @db(i32 217)
%2 = tail call i32 @db(i32 224)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void cttestexit() {
  return;
  exit(2);
}


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

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

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

LLVM IR (-O2):
define void @cttestexit() {
ret void
}
void swap(char *a, char *b) {
  char t;
  t = *a;
  *a = *b;
  *b = t;
}


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

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%al
mov    (%rsi),%cl
mov    %cl,(%rdi)
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @swap(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = load i8, i8* %5
%12 = load i8*, i8** %4
store i8 %11, i8* %12
ret void
}

LLVM IR (-O2):
define void @swap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void errorMsg(char *str) { printf("ERROR: %s\n", str); }


x86 assembly (clang, -O0):
<errorMsg>:
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):
<errorMsg>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @errorMsg(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t FromLE32(uint32_t value) { return value; }


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

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

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

LLVM IR (-O2):
define i32 @FromLE32(i32 returned %0) {
ret i32 %0
}
int test_39_4(int *mem) { return __atomic_fetch_add(mem + 0, 1, 4); }


x86 assembly (clang, -O0):
<test_39_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
lock xadd %eax,(%rcx)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_39_4>:
mov    $0x1,%eax
lock xadd %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @test_39_4(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 0
store i32 1, i32* %3
%7 = load i32, i32* %3
%8 = atomicrmw add i32* %6, i32 %7 acq_rel
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_39_4(i32* nocapture %0) {
%2 = atomicrmw add i32* %0, i32 1 acq_rel
ret i32 %2
}
/* Variables and functions */
char *ExpandPathName(char *);
int /*<<< orphan*/ safeStrCpy(char *, char *, int);
int MyGetFullPathName(char *name, char *fullname) {
  name = ExpandPathName(name);
  safeStrCpy(fullname, name, 512);
  return 1;
}


x86 assembly (clang, -O0):
<MyGetFullPathName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ExpandPathName@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x200,%edx
call   1040 <safeStrCpy@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MyGetFullPathName>:
push   %rbx
mov    %rsi,%rbx
call   1030 <ExpandPathName@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x200,%edx
call   1040 <safeStrCpy@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @MyGetFullPathName(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 = call i8* @ExpandPathName(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 @safeStrCpy(i8* %7, i8* %8, i32 512)
ret i32 1
}

LLVM IR (-O2):
define i32 @MyGetFullPathName(i8* %0, i8* %1) {
%3 = tail call i8* @ExpandPathName(i8* %0)
%4 = tail call i32 @safeStrCpy(i8* %1, i8* %3, i32 512)
ret i32 1
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ _time_counter();
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int32_t random_num(int val) {
  srand(_time_counter());
  if (val < 0)
    return -1;
  return rand() & val;
}


x86 assembly (clang, -O0):
<random_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <_time_counter@plt>
mov    %eax,%edi
call   1040 <srand@plt>
cmpl   $0x0,-0x8(%rbp)
jge    115f <random_num+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    116c <random_num+0x3c>
mov    $0x0,%al
call   1050 <rand@plt>
and    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_num>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <_time_counter@plt>
mov    %eax,%edi
call   1040 <srand@plt>
test   %ebx,%ebx
js     1150 <random_num+0x20>
xor    %eax,%eax
call   1050 <rand@plt>
and    %ebx,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @random_num(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (...) @_time_counter()
%5 = call i32 @srand(i32 %4)
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %13
9: ; preds = %1
%10 = call i32 (...) @rand()
%11 = load i32, i32* %3
%12 = and i32 %10, %11
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @random_num(i32 %0) {
%2 = tail call i32 (...) @_time_counter()
%3 = tail call i32 @srand(i32 %2)
%4 = icmp slt i32 %0, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 (...) @rand()
%7 = and i32 %6, %0
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ %7, %5 ], [ -1, %1 ]
ret i32 %9
}
/* Variables and functions */
float pow(float, float);
float puissance(float a, float b) { return pow(a, b); }


x86 assembly (clang, -O0):
<puissance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puissance>:
jmp    1030 <pow@plt>

LLVM IR (-O0):
define float @puissance(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call float @pow(float %5, float %6)
ret float %7
}

LLVM IR (-O2):
define float @puissance(float %0, float %1) {
%3 = tail call float @pow(float %0, float %1)
ret float %3
}
double geom_J_sph_rtp_B(double x[]) { return 1.0; }


x86 assembly (clang, -O0):
<geom_J_sph_rtp_B>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  0xef0(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_J_sph_rtp_B>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @geom_J_sph_rtp_B(double* %0) {
%2 = alloca double*
store double* %0, double** %2
ret double 1.000000e+00
}

LLVM IR (-O2):
define double @geom_J_sph_rtp_B(double* nocapture readnone %0) {
ret double 1.000000e+00
}