xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ int_list;

/* Variables and functions */
int /*<<< orphan*/ inc_print(int, int *);
int main() {
  int int_list[6] = {1, 1, 3, 5, 5, 7};
  int len = sizeof(int_list) / sizeof(int_list[0]);
  inc_print(len, int_list);
  int int_list2[6] = {7, 8, 8, 9, 10};
  inc_print(len, int_list2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <inc_print@plt>
mov    0xec6(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1030 <inc_print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    $0x6,%edi
call   1030 <inc_print@plt>
mov    0xeee(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x6,%edi
call   1030 <inc_print@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.int_list = [6 x i32] [i32 1, i32 1, i32 3, i32 5, i32 5, i32 7]
@__const.main.int_list2 = [6 x i32] [i32 7, i32 8, i32 8, i32 9, i32 10, i32 0]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = alloca [6 x i32]
store i32 0, i32* %1
%5 = bitcast [6 x i32]* %2 to i8*
store i32 6, i32* %3
%6 = load i32, i32* %3
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%8 = call i32 @inc_print(i32 %6, i32* %7)
%9 = bitcast [6 x i32]* %4 to i8*
%10 = load i32, i32* %3
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%12 = call i32 @inc_print(i32 %10, i32* %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.int_list = [6 x i32] [i32 1, i32 1, i32 3, i32 5, i32 5, i32 7]
@__const.main.int_list2 = [6 x i32] [i32 7, i32 8, i32 8, i32 9, i32 10, i32 0]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = bitcast [6 x i32]* %1 to i8*
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%5 = call i32 @inc_print(i32 6, i32* %4)
%6 = bitcast [6 x i32]* %2 to i8*
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%8 = call i32 @inc_print(i32 6, i32* %7)
ret i32 0
}
int read_dword2long(const char *ptr, unsigned long *value) {
  ;
  *value = *(const int *)ptr;
  return sizeof(int);
}


x86 assembly (clang, -O0):
<read_dword2long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_dword2long>:
movslq (%rdi),%rax
mov    %rax,(%rsi)
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @read_dword2long(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
store i8* %0, i8** %3
store i64* %1, i64** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = sext i32 %7 to i64
%9 = load i64*, i64** %4
store i64 %8, i64* %9
ret i32 4
}

LLVM IR (-O2):
define i32 @read_dword2long(i8* nocapture %0, i64* nocapture writeonly %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
store i64 %5, i64* %1
ret i32 4
}
int signal_check_intr(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @signal_check_intr() {
ret i32 0
}
void f146(void) {
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
a:
  ({
    ({ 0; });
    ({
      goto a;
      0;
    });
    0;
  });
  0;
}


x86 assembly (clang, -O0):
<f146>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    1119 <f146+0x19>

x86 assembly (clang, -O2):
<f146>:
jmp    1100 <f146>

LLVM IR (-O0):
define void @f146() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = load i32, i32* %1
store i32 0, i32* %2
%8 = load i32, i32* %2
store i32 0, i32* %3
%9 = load i32, i32* %3
br label %10
10: ; preds = %10, %0
store i32 0, i32* %4
%11 = load i32, i32* %4
br label %10
}

LLVM IR (-O2):
define void @f146() {
br label %1
1: ; preds = %1, %0
br label %1
}
unsigned char limit(double a) {
  if (a > 255)
    return 255;
  else if (a < 0)
    return 0;
  return (unsigned char)a;
}


x86 assembly (clang, -O0):
<limit>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1129 <limit+0x29>
movb   $0xff,-0x1(%rbp)
jmp    114d <limit+0x4d>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1140 <limit+0x40>
movb   $0x0,-0x1(%rbp)
jmp    114d <limit+0x4d>
jmp    1145 <limit+0x45>
cvttsd2si -0x10(%rbp),%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<limit>:
mov    $0xff,%al
ucomisd 0xef6(%rip),%xmm0
ja     111d <limit+0x1d>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1119 <limit+0x19>
xor    %eax,%eax
ret
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define zeroext i8 @limit(double %0) {
%2 = alloca i8
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 2.550000e+02
br i1 %5, label %6, label %7
6: ; preds = %1
store i8 -1, i8* %2
br label %15
7: ; preds = %1
%8 = load double, double* %3
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store i8 0, i8* %2
br label %15
11: ; preds = %7
br label %12
12: ; preds = %11
%13 = load double, double* %3
%14 = fptoui double %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %12, %10, %6
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @limit(double %0) {
%2 = fcmp ogt double %0, 2.550000e+02
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = fcmp olt double %0, 0.000000e+00
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = fptoui double %0 to i8
br label %7
7: ; preds = %3, %1, %5
%8 = phi i8 [ %6, %5 ], [ -1, %1 ], [ 0, %3 ]
ret i8 %8
}
int talloc_version_minor(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @talloc_version_minor() {
ret i32 0
}
int main(void) {
  int a = 0;
  switch (a) {
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    1110 <main+0x10>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* %1
switch i32 %2, label %3 [
]
3: ; preds = %0
br label %4
4: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int cmp(const void *pa, const void *pb) {
  char a = *(const char *)pa;
  char b = *(const char *)pb;
  return a < b ? -1 : a == b ? 0 : 1;
}


x86 assembly (clang, -O0):
<cmp>:
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),%al
mov    %al,-0x12(%rbp)
movsbl -0x11(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    113b <cmp+0x3b>
mov    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1152 <cmp+0x52>
movsbl -0x11(%rbp),%edx
movsbl -0x12(%rbp),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%al
xor    %ecx,%ecx
cmp    (%rsi),%al
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
store i8 %8, i8* %5
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
store i8 %10, i8* %6
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %17
16: ; preds = %2
br label %25
17: ; preds = %2
%18 = load i8, i8* %5
%19 = sext i8 %18 to i32
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %19, %21
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 0, i32 1
br label %25
25: ; preds = %17, %16
%26 = phi i32 [ -1, %16 ], [ %24, %17 ]
ret i32 %26
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp slt i8 %3, %4
%6 = icmp ne i8 %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
bool timespec_valid(const struct timespec *ts) {
  if (ts->tv_sec < 0)
    return false;
  if ((unsigned long)ts->tv_nsec >= 1000000000L)
    return false;
  return true;
}


x86 assembly (clang, -O0):
<timespec_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jge    1122 <timespec_valid+0x22>
movl   $0x0,-0x4(%rbp)
jmp    1147 <timespec_valid+0x47>
mov    -0x10(%rbp),%rax
cmpq   $0x3b9aca00,0x8(%rax)
3b
jb     1140 <timespec_valid+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1147 <timespec_valid+0x47>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_valid>:
cmpq   $0x0,(%rdi)
js     1114 <timespec_valid+0x14>
xor    %eax,%eax
cmpq   $0x3b9aca00,0x8(%rdi)
3b
setb   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i32 @timespec_valid(%struct.timespec* %0) {
%2 = alloca i32
%3 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %3
%4 = load %struct.timespec*, %struct.timespec** %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %16
9: ; preds = %1
%10 = load %struct.timespec*, %struct.timespec** %3
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%12 = load i64, i64* %11
%13 = icmp uge i64 %12, 1000000000
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 0, i32* %2
br label %16
15: ; preds = %9
store i32 1, i32* %2
br label %16
16: ; preds = %15, %14, %8
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define i32 @timespec_valid(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%7 = load i64, i64* %6
%8 = icmp ult i64 %7, 1000000000
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ islower(int);
char toupper(int);
void strupper(char *s) {
  while (*s) {
    {
      if (islower((int)(unsigned char)*s))
        *s = toupper((int)(unsigned char)*s);
      s++;
    }
  }
}


x86 assembly (clang, -O0):
<strupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1174 <strupper+0x54>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     1163 <strupper+0x43>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1040 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <strupper+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strupper>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1155 <strupper+0x35>
mov    %rdi,%rbx
jmp    113c <strupper+0x1c>
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1155 <strupper+0x35>
movzbl %al,%edi
call   1030 <islower@plt>
test   %rax,%rax
je     1130 <strupper+0x10>
movzbl (%rbx),%edi
call   1040 <toupper@plt>
mov    %al,(%rbx)
jmp    1130 <strupper+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @strupper(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %19, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %22
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = call i64 @islower(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %7
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = call signext i8 @toupper(i32 %16)
%18 = load i8*, i8** %2
store i8 %17, i8* %18
br label %19
19: ; preds = %13, %7
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %2
br label %3
22: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @strupper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %14
%5 = phi i8 [ %16, %14 ], [ %2, %1 ]
%6 = phi i8* [ %15, %14 ], [ %0, %1 ]
%7 = zext i8 %5 to i32
%8 = tail call i64 @islower(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = tail call signext i8 @toupper(i32 %12)
store i8 %13, i8* %6
br label %14
14: ; preds = %10, %4
%15 = getelementptr inbounds i8, i8* %6, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %14, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ vfscanf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
void uninitvar_vfscanf(void) {
  FILE *stream;
  char *format;
  va_list arg;
  (void)vfscanf(stream, format, arg);
}


x86 assembly (clang, -O0):
<uninitvar_vfscanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <vfscanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_vfscanf>:
jmp    1030 <vfscanf@plt>

LLVM IR (-O0):
define void @uninitvar_vfscanf() {
%1 = alloca i32*
%2 = alloca i8*
%3 = alloca i32
%4 = load i32*, i32** %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = call i32 @vfscanf(i32* %4, i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @uninitvar_vfscanf() {
%1 = tail call i32 @vfscanf(i32* undef, i8* undef, i32 undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void octiag_mm_free(void *p) { free(p); }


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

LLVM IR (-O0):
define void @octiag_mm_free(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 @octiag_mm_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void finalize_cache_mp_write_session_response(
    struct cache_mp_write_session_response *mp_ws_response) {
  (void)0;
  (void)0;
}


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

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

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

LLVM IR (-O2):
%struct.cache_mp_write_session_response = type opaque
define void @finalize_cache_mp_write_session_response(%struct.cache_mp_write_session_response* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void jcv_free_fn(void *memctx, void *p) {
  (void)memctx;
  free(p);
}


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

x86 assembly (clang, -O2):
<jcv_free_fn>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @jcv_free_fn(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ display();
int insert_mode();
int /*<<< orphan*/ right();
int append_mode(void) {
  if (!right()) {
    display();
    return insert_mode();
  }
  return 0;
}


x86 assembly (clang, -O0):
<append_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <right@plt>
cmp    $0x0,%eax
jne    115e <append_mode+0x2e>
mov    $0x0,%al
call   1040 <display@plt>
mov    $0x0,%al
call   1050 <insert_mode@plt>
mov    %eax,-0x4(%rbp)
jmp    1165 <append_mode+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_mode>:
push   %rax
xor    %eax,%eax
call   1030 <right@plt>
test   %eax,%eax
je     1140 <append_mode+0x10>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1040 <display@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <insert_mode@plt>

LLVM IR (-O0):
define i32 @append_mode() {
%1 = alloca i32
%2 = call i32 (...) @right()
%3 = icmp ne i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = call i32 (...) @display()
%6 = call i32 (...) @insert_mode()
store i32 %6, i32* %1
br label %8
7: ; preds = %0
store i32 0, i32* %1
br label %8
8: ; preds = %7, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @append_mode() {
%1 = tail call i32 (...) @right()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 (...) @display()
%5 = tail call i32 (...) @insert_mode()
br label %6
6: ; preds = %0, %3
%7 = phi i32 [ %5, %3 ], [ 0, %0 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, long);
int /*<<< orphan*/ stderr;
void malloc_error(size_t n) {
  fprintf(stderr, "Error allocating %ld bytes\n", (long)n);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<malloc_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<malloc_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Error allocating %ld bytes\0A\00"
@EXIT_FAILURE = global i32 0
define void @malloc_error(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i32, i32* @stderr
%4 = load i64, i64* %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Error allocating %ld bytes\0A\00"
@EXIT_FAILURE = global i32 0
define void @malloc_error(i64 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
unsigned xrop3_5_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  stk1 = D | T;
  stk1 = ~stk1;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_5_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_5_0_0>:
mov    %esi,%eax
not    %eax
shl    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_5_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 8
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = or i32 %10, %12
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = or i32 %14, %15
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = xor i32 %17, -1
store i32 %18, i32* %7
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @xrop3_5_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = xor i32 %3, -1
%5 = shl nsw i32 %4, 8
ret i32 %5
}
int AlphaNumeric(char ch) {
  return ((ch >= 'a') && (ch <= 'z') || (ch >= 'A') && (ch <= 'Z') ||
          (ch >= '0') && (ch <= '9'));
}


x86 assembly (clang, -O0):
<AlphaNumeric>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <AlphaNumeric+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    116d <AlphaNumeric+0x6d>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1148 <AlphaNumeric+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jle    116d <AlphaNumeric+0x6d>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x3(%rbp)
jl     1167 <AlphaNumeric+0x67>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%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):
<AlphaNumeric>:
mov    %edi,%eax
and    $0xdf,%al
add    $0xbf,%al
cmp    $0x1a,%al
setb   %al
add    $0xd0,%dil
cmp    $0xa,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @AlphaNumeric(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 %28, 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 i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 48
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 57
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @AlphaNumeric(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = add i8 %0, -48
%6 = icmp ult i8 %5, 10
%7 = or i1 %6, %4
%8 = zext i1 %7 to i32
ret i32 %8
}
int sum() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sum() {
ret i32 0
}
/* Variables and functions */
char tolower(int);
int _hexval(int c) {
  return ((c >= '0' && c <= '9') ? (c - '0') : (tolower(c) - 'a' + 10));
}


x86 assembly (clang, -O0):
<_hexval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x30,-0x4(%rbp)
jl     113d <_hexval+0x2d>
cmpl   $0x39,-0x4(%rbp)
jg     113d <_hexval+0x2d>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    1151 <_hexval+0x41>
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
movsbl %al,%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hexval>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
jb     1128 <_hexval+0x18>
push   %rax
call   1030 <tolower@plt>
movsbl %al,%eax
add    $0xffffffa9,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @_hexval(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 48
br label %17
11: ; preds = %5, %1
%12 = load i32, i32* %2
%13 = call signext i8 @tolower(i32 %12)
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 97
%16 = add nsw i32 %15, 10
br label %17
17: ; preds = %11, %8
%18 = phi i32 [ %10, %8 ], [ %16, %11 ]
ret i32 %18
}

LLVM IR (-O2):
define i32 @_hexval(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call signext i8 @tolower(i32 %0)
%6 = sext i8 %5 to i32
%7 = add nsw i32 %6, -87
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ %2, %1 ]
ret i32 %9
}
int cmp(const long *a, const long *b) {
  if (a < b) {
    return -1;
  } else if (a > b) {
    return +1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1126 <cmp+0x26>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <cmp+0x4c>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1140 <cmp+0x40>
movl   $0x1,-0x4(%rbp)
jmp    114c <cmp+0x4c>
jmp    1145 <cmp+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
xor    %ecx,%ecx
cmp    %rsi,%rdi
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i64* readnone %0, i64* readnone %1) {
%3 = icmp ult i64* %0, %1
%4 = icmp ugt i64* %0, %1
%5 = zext i1 %4 to i32
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, float *);
float input() {
  float vlr;
  printf("Informe o valor: ");
  scanf("%f", &vlr);
  return vlr;
}


x86 assembly (clang, -O0):
<input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Informe o valor: \00"
@.str.1 = [3 x i8] c"%f\00"
define float @input() {
%1 = alloca float
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%4 = load float, float* %1
ret float %4
}

LLVM IR (-O2):
@.str = [18 x i8] c"Informe o valor: \00"
@.str.1 = [3 x i8] c"%f\00"
define float @input() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
ret float %5
}
/* Variables and functions */
int N_receive_int();
float N_receive_float(void) {
  union {
    int n;
    float f;
  } value;
  value.n = N_receive_int();
  return value.f;
}


x86 assembly (clang, -O0):
<N_receive_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <N_receive_int@plt>
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<N_receive_float>:
push   %rax
xor    %eax,%eax
call   1030 <N_receive_int@plt>
movd   %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define float @N_receive_float() {
%1 = alloca %union.anon
%2 = call i32 (...) @N_receive_int()
%3 = bitcast %union.anon* %1 to i32*
store i32 %2, i32* %3
%4 = bitcast %union.anon* %1 to float*
%5 = load float, float* %4
ret float %5
}

LLVM IR (-O2):
define float @N_receive_float() {
%1 = tail call i32 (...) @N_receive_int()
%2 = bitcast i32 %1 to float
ret float %2
}
char intbase(int base) {
  char value = '?';
  switch (base) {
  case 0:
    value = 'A';
    break;
  case 1:
    value = 'C';
    break;
  case 2:
    value = 'G';
    break;
  case 3:
    value = 'T';
    break;
  }
  return (value);
}


x86 assembly (clang, -O0):
<intbase>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movb   $0x3f,-0x5(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     114f <intbase+0x4f>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x41,-0x5(%rbp)
jmp    114f <intbase+0x4f>
movb   $0x43,-0x5(%rbp)
jmp    114f <intbase+0x4f>
movb   $0x47,-0x5(%rbp)
jmp    114f <intbase+0x4f>
movb   $0x54,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intbase>:
lea    0x0(,%rdi,8),%ecx
mov    $0x54474341,%edx
shr    %cl,%edx
cmp    $0x4,%edi
mov    $0x3f,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @intbase(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
store i8 63, i8* %3
%4 = load i32, i32* %2
switch i32 %4, label %9 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
]
5: ; preds = %1
store i8 65, i8* %3
br label %9
6: ; preds = %1
store i8 67, i8* %3
br label %9
7: ; preds = %1
store i8 71, i8* %3
br label %9
8: ; preds = %1
store i8 84, i8* %3
br label %9
9: ; preds = %1, %8, %7, %6, %5
%10 = load i8, i8* %3
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @intbase(i32 %0) {
%2 = icmp ult i32 %0, 4
%3 = shl i32 %0, 3
%4 = lshr i32 1413956417, %3
%5 = trunc i32 %4 to i8
%6 = select i1 %2, i8 %5, i8 63
ret i8 %6
}
void kcs_cleanup(struct si_sm_data *kcs) {}


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

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

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

LLVM IR (-O2):
%struct.si_sm_data = type opaque
define void @kcs_cleanup(%struct.si_sm_data* nocapture %0) {
ret void
}
int ValArrayDefaultCompareFn(const void *pleft, const void *pright) {
  const double *left = pleft, *right = pright;
  return *left < *right ? -1 : (*left > *right ? 1 : 0);
}


x86 assembly (clang, -O0):
<ValArrayDefaultCompareFn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1143 <ValArrayDefaultCompareFn+0x43>
mov    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1164 <ValArrayDefaultCompareFn+0x64>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
xor    %eax,%eax
mov    $0x1,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ValArrayDefaultCompareFn>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ValArrayDefaultCompareFn(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to double*
store double* %8, double** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to double*
store double* %10, double** %6
%11 = load double*, double** %5
%12 = load double, double* %11
%13 = load double*, double** %6
%14 = load double, double* %13
%15 = fcmp olt double %12, %14
br i1 %15, label %16, label %17
16: ; preds = %2
br label %25
17: ; preds = %2
%18 = load double*, double** %5
%19 = load double, double* %18
%20 = load double*, double** %6
%21 = load double, double* %20
%22 = fcmp ogt double %19, %21
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
br label %25
25: ; preds = %17, %16
%26 = phi i32 [ -1, %16 ], [ %24, %17 ]
ret i32 %26
}

LLVM IR (-O2):
define i32 @ValArrayDefaultCompareFn(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = fcmp ogt double %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
char *getenv(char *);
int strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int get_iters(int default_iters) {
  char *env = getenv("SECP256K1_BENCH_ITERS");
  if (env) {
    return strtol(env, NULL, 0);
  } else {
    return default_iters;
  }
}


x86 assembly (clang, -O0):
<get_iters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xece(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115d <get_iters+0x3d>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,-0x4(%rbp)
jmp    1163 <get_iters+0x43>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_iters>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1141 <get_iters+0x21>
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
pop    %rbx
jmp    1040 <strtol@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"SECP256K1_BENCH_ITERS\00"
define i32 @get_iters(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = call i8* @getenv(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %4
%10 = call i32 @strtol(i8* %9, i32* null, i32 0)
store i32 %10, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* %3
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [22 x i8] c"SECP256K1_BENCH_ITERS\00"
define i32 @get_iters(i32 %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @strtol(i8* nocapture %2, i32* null, i32 0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ gui_quit();
void sig_handler(int signo) {
  if (signo == SIGINT) {
    ;
    gui_quit();
  }
}


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

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

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

LLVM IR (-O2):
@SIGINT = global i32 0
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @gui_quit()
br label %6
6: ; preds = %4, %1
ret void
}
double _cos(x)
double x;
{
  if (x < 0)
    x = -x;
  return sinus(x, 1);
}


x86 assembly (clang, -O0):
<_cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    114c <_cos+0x3c>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%edi
mov    $0x1,%al
call   1030 <sinus@plt>
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cos>:
push   %rax
movapd 0xee7(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
mov    $0x1,%edi
mov    $0x1,%al
call   1030 <sinus@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @_cos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fneg double %6
store double %7, double* %2
br label %8
8: ; preds = %5, %1
%9 = load double, double* %2
%10 = call i32 (double, i32, ...) bitcast (i32 (...)* @sinus to i32 (double, i32, ...)*)(double %9, i32 1)
%11 = sitofp i32 %10 to double
ret double %11
}

LLVM IR (-O2):
define double @_cos(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
%5 = tail call i32 (double, i32, ...) bitcast (i32 (...)* @sinus to i32 (double, i32, ...)*)(double %4, i32 1)
%6 = sitofp i32 %5 to double
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int returnRandCharAlphaNum(char);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  char tmp = '\0';
  for (;;)
    printf("%c", returnRandCharAlphaNum(tmp));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <returnRandCharAlphaNum@plt>
mov    %eax,%esi
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
jmp    1163 <main+0x23>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xeaa(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
call   1030 <returnRandCharAlphaNum@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
jmp    1160 <main+0x20>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
store i8 0, i8* %2
br label %5
5: ; preds = %5, %0
%6 = load i8, i8* %2
%7 = call i32 @returnRandCharAlphaNum(i8 signext %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %5
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @returnRandCharAlphaNum(i8 signext 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ Cuadrado_magico(int);
int /*<<< orphan*/ Es_impar(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int n = 3;
  printf(
      "\nCUADRADOS MÁGICOS\n=================\n\nIntroduzca el número n impar"
      " de filas y columnas,\nsiendo n mayor o igual a 3 y menor o igual a "
      "15:\n");
  scanf("%d", &n);
  Es_impar(n);
  Cuadrado_magico(n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xf2a(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1060 <Es_impar@plt>
mov    -0x4(%rbp),%edi
call   1030 <Cuadrado_magico@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3,0x4(%rsp)
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1060 <Es_impar@plt>
mov    0x4(%rsp),%edi
call   1040 <Cuadrado_magico@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [140 x i8] c"\0ACUADRADOS M\C3\81GICOS\0A=================\0A\0AIntroduzca el n\C3\BAmero n impar de filas y columnas,\0Asiendo n mayor o igual a 3 y menor o igual a 15:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
store i32 3, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @Es_impar(i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @Cuadrado_magico(i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [139 x i8] c"\0ACUADRADOS M\C3\81GICOS\0A=================\0A\0AIntroduzca el n\C3\BAmero n impar de filas y columnas,\0Asiendo n mayor o igual a 3 y menor o igual a 15:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 3, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([139 x i8], [139 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @Es_impar(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 @Cuadrado_magico(i32 %7)
ret i32 0
}
int y_to_line(int y, int starty, int h) { return (y - starty) / h; }


x86 assembly (clang, -O0):
<y_to_line>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<y_to_line>:
mov    %edx,%ecx
mov    %edi,%eax
sub    %esi,%eax
cltd
idiv   %ecx
ret

LLVM IR (-O0):
define i32 @y_to_line(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = sub nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = sdiv i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @y_to_line(i32 %0, i32 %1, i32 %2) {
%4 = sub nsw i32 %0, %1
%5 = sdiv i32 %4, %2
ret i32 %5
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _list_del(struct list *);
int /*<<< orphan*/ list_init(struct list *);
void list_del(struct list *entry) {
  _list_del(entry);
  list_init(entry);
}


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

x86 assembly (clang, -O2):
<list_del>:
push   %rbx
mov    %rdi,%rbx
call   1040 <_list_del@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <list_init@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
define void @list_del(%struct.list* %0) {
%2 = alloca %struct.list*
store %struct.list* %0, %struct.list** %2
%3 = load %struct.list*, %struct.list** %2
%4 = call i32 @_list_del(%struct.list* %3)
%5 = load %struct.list*, %struct.list** %2
%6 = call i32 @list_init(%struct.list* %5)
ret void
}

LLVM IR (-O2):
%struct.list = type { i32 }
define void @list_del(%struct.list* %0) {
%2 = tail call i32 @_list_del(%struct.list* %0)
%3 = tail call i32 @list_init(%struct.list* %0)
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
float rand();
float SCE_Math_RandRangef(float a, float b) {
  float r = rand() / (float)RAND_MAX;
  r *= (b - a);
  r += a;
  return r;
}


x86 assembly (clang, -O0):
<SCE_Math_RandRangef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    0x2eb8(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Math_RandRangef>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ebe(%rip),%rax
xorps  %xmm1,%xmm1
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
subss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define float @SCE_Math_RandRangef(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = call float (...) @rand()
%7 = load i64, i64* @RAND_MAX
%8 = sitofp i64 %7 to float
%9 = fdiv float %6, %8
store float %9, float* %5
%10 = load float, float* %4
%11 = load float, float* %3
%12 = fsub float %10, %11
%13 = load float, float* %5
%14 = fmul float %13, %12
store float %14, float* %5
%15 = load float, float* %3
%16 = load float, float* %5
%17 = fadd float %16, %15
store float %17, float* %5
%18 = load float, float* %5
ret float %18
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define float @SCE_Math_RandRangef(float %0, float %1) {
%3 = tail call float (...) @rand()
%4 = load i64, i64* @RAND_MAX
%5 = sitofp i64 %4 to float
%6 = fdiv float %3, %5
%7 = fsub float %1, %0
%8 = fmul float %7, %6
%9 = fadd float %8, %0
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ int80(int, int, int, int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
void kill(int pid, int msg) { int80(29, pid, msg, 0, 0, 0); }


x86 assembly (clang, -O0):
<kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x1d,%edi
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <int80@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x1d,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <int80@plt>

LLVM IR (-O0):
define void @kill(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 @int80(i32 29, i32 %5, i32 %6, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @kill(i32 %0, i32 %1) {
%3 = tail call i32 @int80(i32 29, i32 %0, i32 %1, i32 0, i32 0, i32 0)
ret void
}