xunge/DecIR huggingface dataset:
double d_sign(double *a, double *b) {
  register double x = *a;
  if (x <= 0.0)
    x = -x;
  if (*b < 0.0)
    x = -x;
  return (x);
}


x86 assembly (clang, -O0):
<d_sign>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1148 <d_sign+0x48>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    117a <d_sign+0x7a>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_sign>:
movsd  (%rdi),%xmm0
movapd 0xef4(%rip),%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm3
cmpnlesd %xmm2,%xmm3
movapd %xmm3,%xmm4
andpd  %xmm0,%xmm3
xorpd  %xmm1,%xmm0
andnpd %xmm0,%xmm4
orpd   %xmm4,%xmm3
movsd  (%rsi),%xmm0
xorpd  %xmm3,%xmm1
cmpltsd %xmm2,%xmm0
movapd %xmm0,%xmm2
andnpd %xmm3,%xmm2
andpd  %xmm1,%xmm0
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @d_sign(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = load double, double* %6
store double %7, double* %5
%8 = load double, double* %5
%9 = fcmp ole double %8, 0.000000e+00
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load double, double* %5
%12 = fneg double %11
store double %12, double* %5
br label %13
13: ; preds = %10, %2
%14 = load double*, double** %4
%15 = load double, double* %14
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load double, double* %5
%19 = fneg double %18
store double %19, double* %5
br label %20
20: ; preds = %17, %13
%21 = load double, double* %5
ret double %21
}

LLVM IR (-O2):
define double @d_sign(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = fcmp ugt double %3, 0.000000e+00
%5 = fneg double %3
%6 = select i1 %4, double %3, double %5
%7 = load double, double* %1
%8 = fcmp olt double %7, 0.000000e+00
%9 = fneg double %6
%10 = select i1 %8, double %9, double %6
ret double %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ putc(char);
int /*<<< orphan*/ puthex(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char const *);
void putreg(const char *name, uint64_t val) {
  puts(name);
  puts(": ");
  puthex(val);
  putc('\n');
}


x86 assembly (clang, -O0):
<putreg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
mov    -0xc(%rbp),%edi
call   1050 <puthex@plt>
mov    $0xa,%edi
call   1040 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putreg>:
push   %rbx
mov    %esi,%ebx
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1050 <puthex@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1040 <putc@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c": \00"
define void @putreg(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @puthex(i32 %1)
%6 = tail call i32 @putc(i8 signext 10)
ret void
}
/* Variables and functions */
int GetPrivateProfileString(char *, char *, char *, char *);
int GetEnv(char *appNam, char *keyNam, char *keyVal) {
  char *fileNam = "./etc/sys_set.ini";
  return GetPrivateProfileString(appNam, keyNam, keyVal, fileNam);
}


x86 assembly (clang, -O0):
<GetEnv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <GetPrivateProfileString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetEnv>:
lea    0xee9(%rip),%rcx
jmp    1030 <GetPrivateProfileString@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"./etc/sys_set.ini\00"
define i32 @GetEnv(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = call i32 @GetPrivateProfileString(i8* %8, i8* %9, i8* %10, i8* %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [18 x i8] c"./etc/sys_set.ini\00"
define i32 @GetEnv(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @GetPrivateProfileString(i8* %0, i8* %1, i8* %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}
void am_fault_isr(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<am_fault_isr>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <am_fault_isr+0x9>
jmp    1109 <am_fault_isr+0x9>

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

LLVM IR (-O0):
define void @am_fault_isr() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @am_fault_isr() {
br label %1
1: ; preds = %0, %1
br label %1
}
void wait_until_left(void) { int i = 0; }


x86 assembly (clang, -O0):
<wait_until_left>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @wait_until_left() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read(int, char *, int);
void *reader(void *args) {
  char buf[1024];
  int sfd = *(int *)args;
  while (1) {
    read(sfd, buf, 1024);
    printf("%s", buf);
  }
}


x86 assembly (clang, -O0):
<reader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x414(%rbp)
mov    -0x414(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1040 <read@plt>
lea    -0x410(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    113b <reader+0x1b>

x86 assembly (clang, -O2):
<reader>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    (%rdi),%ebp
mov    %rsp,%rbx
lea    0xec9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    1140 <reader+0x20>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i8* @reader(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
store i32 %7, i32* %4
br label %8
8: ; preds = %1, %8
%9 = load i32, i32* %4
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32 @read(i32 %9, i8* %10, i32 1024)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define noalias i8* @reader(i8* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %4
br label %6
6: ; preds = %6, %1
%7 = call i32 @read(i32 %5, i8* %3, i32 1024)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %6
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ radix_tree_is_indirect_ptr(void *);
void radix_tree_replace_slot(void **pslot, void *item) {
  assert(!(radix_tree_is_indirect_ptr(item)));
  *pslot = item;
}


x86 assembly (clang, -O0):
<radix_tree_replace_slot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <radix_tree_is_indirect_ptr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radix_tree_replace_slot>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <radix_tree_is_indirect_ptr@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @radix_tree_replace_slot(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @radix_tree_is_indirect_ptr(i8* %5)
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8*, i8** %4
%12 = load i8**, i8*** %3
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
define void @radix_tree_replace_slot(i8** nocapture writeonly %0, i8* %1) {
%3 = tail call i32 @radix_tree_is_indirect_ptr(i8* %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
store i8* %1, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, long const, char const *);
void bugout(const long lineno, const char *fname) {
  printf("Error in line %ld in file %s!\n", lineno, fname);
  exit(7);
}


x86 assembly (clang, -O0):
<bugout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x7,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bugout>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x7,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Error in line %ld in file %s!\0A\00"
define void @bugout(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = load i64, i64* %3
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %5, i8* %6)
%8 = call i32 @exit(i32 7)
unreachable
}

LLVM IR (-O2):
@.str = [31 x i8] c"Error in line %ld in file %s!\0A\00"
define void @bugout(i64 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %0, i8* %1)
%4 = tail call i32 @exit(i32 7)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ tst_exit();
int /*<<< orphan*/ tst_rmdir();
void cleanup(void) {
  tst_rmdir();
  tst_exit();
}


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

x86 assembly (clang, -O2):
<cleanup>:
push   %rax
xor    %eax,%eax
call   1040 <tst_rmdir@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <tst_exit@plt>

LLVM IR (-O0):
define void @cleanup() {
%1 = call i32 (...) @tst_rmdir()
%2 = call i32 (...) @tst_exit()
ret void
}

LLVM IR (-O2):
define void @cleanup() {
%1 = tail call i32 (...) @tst_rmdir()
%2 = tail call i32 (...) @tst_exit()
ret void
}
void sk_delete(void) {}


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

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

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

LLVM IR (-O2):
define void @sk_delete() {
ret void
}
/* Variables and functions */
int syscall(int, int, char const *);
int fremovexattr(int filedes, const char *name) {
  return syscall(199, filedes, name);
}


x86 assembly (clang, -O0):
<fremovexattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0xc7,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fremovexattr>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0xc7,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @fremovexattr(i32 %0, i8* %1) {
%3 = tail call i32 @syscall(i32 199, i32 %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ GPSVelocitySensorHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void GPSVelocitySensorLogging() { UAVObjLogging(GPSVelocitySensorHandle()); }


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

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

LLVM IR (-O0):
define void @GPSVelocitySensorLogging() {
%1 = call i32 (...) @GPSVelocitySensorHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @GPSVelocitySensorLogging() {
%1 = tail call i32 (...) @GPSVelocitySensorHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
/* Variables and functions */
int rand();
char rc(void) {
  int k;
  k = rand() % 4;
  if (k == 0) {
    return 'a';
  } else if (k == 1) {
    return 'c';
  } else if (k == 2) {
    return 'g';
  } else if (k == 3) {
    return 't';
  }
  return '\0';
}


x86 assembly (clang, -O0):
<rc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113d <rc+0x2d>
movb   $0x61,-0x1(%rbp)
jmp    1189 <rc+0x79>
cmpl   $0x1,-0x8(%rbp)
jne    1150 <rc+0x40>
movb   $0x63,-0x1(%rbp)
jmp    1189 <rc+0x79>
cmpl   $0x2,-0x8(%rbp)
jne    1163 <rc+0x53>
movb   $0x67,-0x1(%rbp)
jmp    1189 <rc+0x79>
cmpl   $0x3,-0x8(%rbp)
jne    1176 <rc+0x66>
movb   $0x74,-0x1(%rbp)
jmp    1189 <rc+0x79>
jmp    117b <rc+0x6b>
jmp    1180 <rc+0x70>
jmp    1185 <rc+0x75>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
lea    0x0(,%rax,8),%ecx
mov    $0x74676361,%edx
shr    %cl,%edx
cmp    $0x4,%eax
cmovae %ebx,%edx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @rc() {
%1 = alloca i8
%2 = alloca i32
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 4
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i8 97, i8* %1
br label %24
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %12
11: ; preds = %8
store i8 99, i8* %1
br label %24
12: ; preds = %8
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %16
15: ; preds = %12
store i8 103, i8* %1
br label %24
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %20
19: ; preds = %16
store i8 116, i8* %1
br label %24
20: ; preds = %16
br label %21
21: ; preds = %20
br label %22
22: ; preds = %21
br label %23
23: ; preds = %22
store i8 0, i8* %1
br label %24
24: ; preds = %23, %19, %15, %11, %7
%25 = load i8, i8* %1
ret i8 %25
}

LLVM IR (-O2):
define signext i8 @rc() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 4
%3 = icmp ult i32 %2, 4
%4 = shl nsw i32 %2, 3
%5 = lshr i32 1952932705, %4
%6 = trunc i32 %5 to i8
%7 = select i1 %3, i8 %6, i8 0
ret i8 %7
}
double fabs(double x) { return x < 0 ? -x : x; }


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    113d <fabs+0x3d>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1147 <fabs+0x47>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
movapd 0xef8(%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
ret

LLVM IR (-O0):
define double @fabs(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
br label %10
8: ; preds = %1
%9 = load double, double* %2
br label %10
10: ; preds = %8, %5
%11 = phi double [ %7, %5 ], [ %9, %8 ]
ret double %11
}

LLVM IR (-O2):
define double @fabs(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x10() {
  Assert_real((isspace(16) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              85, ("isspace should be 0 for 0x10"));
}


x86 assembly (clang, -O0):
<t_isspace_0x10>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x55,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x10>:
push   %rax
mov    $0x10,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x55,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x10\00"
define void @t_isspace_0x10() {
%1 = call i64 @isspace(i32 16)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 85, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x10\00"
define void @t_isspace_0x10() {
%1 = tail call i64 @isspace(i32 16)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 85, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stm32fxx_get_ascii_devid(char *);
void debug_show_device_id(void) {
  char ascii_device_id[32];
  stm32fxx_get_ascii_devid(ascii_device_id);
  printf("STM32 Device ID: %s\n", ascii_device_id);
}


x86 assembly (clang, -O0):
<debug_show_device_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
call   1040 <stm32fxx_get_ascii_devid@plt>
lea    -0x20(%rbp),%rsi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"STM32 Device ID: %s\0A\00"
define void @debug_show_device_id() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = call i32 @stm32fxx_get_ascii_devid(i8* %2)
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"STM32 Device ID: %s\0A\00"
define void @debug_show_device_id() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = call i32 @stm32fxx_get_ascii_devid(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sqrt(double);
int main(int argc, char *argv[]) {
  sqrt(2.0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xed2(%rip),%xmm0
call   1030 <sqrt@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm0
call   1030 <sqrt@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @sqrt(double 2.000000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sqrt(double 2.000000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _merge_sort(int *, int *, int /*<<< orphan*/, int);
void merge_sort(int *array, int length) {
  int aux[length];
  _merge_sort(array, aux, 0, length - 1);
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
call   1030 <_merge_sort@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%ecx
mov    %rsp,%rax
lea    0xf(,%rcx,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rax
mov    %rax,%rsp
lea    -0x1(%rsi),%ecx
mov    %rax,%rsi
xor    %edx,%edx
call   1030 <_merge_sort@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @merge_sort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %5
%10 = alloca i32, i64 %8
store i64 %8, i64* %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = call i32 @_merge_sort(i32* %11, i32* %10, i32 0, i32 %13)
%15 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = alloca i32, i64 %3
%5 = add nsw i32 %1, -1
%6 = call i32 @_merge_sort(i32* %0, i32* %4, i32 0, i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void DispVector(double *ptr, int n) {
  int i;
  for (i = 0; i < n; i++) {
    printf(" %e\n", *(ptr + i));
  }
  return;
}


x86 assembly (clang, -O0):
<DispVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <DispVector+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <DispVector+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DispVector>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1147 <DispVector+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <DispVector+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" %e\0A\00"
define void @DispVector(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ help();
void key(unsigned char key, int x, int y) {
  switch (key) {
  case 'h':
    help();
    break;
  case '\033':
    exit(1);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1b,%eax
je     1166 <key+0x46>
jmp    1149 <key+0x29>
mov    -0x10(%rbp),%eax
sub    $0x68,%eax
jne    1170 <key+0x50>
jmp    115a <key+0x3a>
mov    $0x0,%al
call   1030 <help@plt>
jmp    1175 <key+0x55>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    1175 <key+0x55>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key>:
cmp    $0x68,%dil
je     112d <key+0xd>
cmp    $0x1b,%dil
je     1134 <key+0x14>
ret
xor    %eax,%eax
jmp    1030 <help@plt>
push   %rax
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %13 [
i32 104, label %9
i32 27, label %11
]
9: ; preds = %3
%10 = call i32 (...) @help()
br label %14
11: ; preds = %3
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %3
br label %14
14: ; preds = %13, %9
ret void
}

LLVM IR (-O2):
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %8 [
i8 104, label %4
i8 27, label %6
]
4: ; preds = %3
%5 = tail call i32 (...) @help()
br label %8
6: ; preds = %3
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %3, %4
ret void
}
int NextPowerOfTwo(int v) {
  v--;
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  v++;
  return v;
}


x86 assembly (clang, -O0):
<NextPowerOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NextPowerOfTwo>:
lea    -0x1(%rdi),%eax
mov    %eax,%ecx
sar    %ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x2,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,%edx
sar    $0x8,%edx
or     %ecx,%edx
mov    %edx,%eax
sar    $0x10,%eax
or     %edx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @NextPowerOfTwo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = ashr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @NextPowerOfTwo(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = ashr i32 %2, 1
%4 = or i32 %3, %2
%5 = ashr i32 %4, 2
%6 = or i32 %5, %4
%7 = ashr i32 %6, 4
%8 = or i32 %7, %6
%9 = ashr i32 %8, 8
%10 = or i32 %9, %8
%11 = ashr i32 %10, 16
%12 = or i32 %11, %10
%13 = add nsw i32 %12, 1
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
__attribute__((__noreturn__)) void exitfunc22(void) {
  printf("Executing exitfunc"
         "22"
         ".\n");
  exit(0);
}


x86 assembly (clang, -O0):
<exitfunc22>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc22>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@str = [22 x i8] c"Executing exitfunc22.\00"
define void @exitfunc22() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void nop_pre_include(char *fname) { (void)fname; }


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

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

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

LLVM IR (-O2):
define void @nop_pre_include(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void signal_handler(int sig) {
  printf("signal handler for %d\n", sig);
  exit(1);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"signal handler for %d\0A\00"
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"signal handler for %d\0A\00"
define void @signal_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ qsort_r(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int main(int argc, char **argv) {
  qsort_r(0, 0, 0, 0, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %r8d,%r8d
mov    %r8d,%edi
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <qsort_r@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <qsort_r@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @qsort_r(i32 0, i32 0, i32 0, i32 0, i32 0)
ret i32 0
}
void create() {
  asm volatile("movq (%%r15), %%rax\n\t"
               "subq %%r14, %%rax\n\t"
               "pushq %%rax\n\t"
               "movq $0x32, %%rdi\n\t"
               "movq %%rsp, %%r13\n\t"
               "movq %%r15, %%rsp\n\t"
               "callq *%%r12\n\t"
               "movq %%rsp, %%r15\n\t"
               "movq %%r13, %%rsp\n\t"
               "movq (%%r15), %%r14\n\t" ::
                   :);
}


x86 assembly (clang, -O0):
<create>:
push   %rbp
mov    %rsp,%rbp
mov    (%r15),%rax
sub    %r14,%rax
push   %rax
mov    $0x32,%rdi
mov    %rsp,%r13
mov    %r15,%rsp
call   *%r12
mov    %rsp,%r15
mov    %r13,%rsp
mov    (%r15),%r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<create>:
mov    (%r15),%rax
sub    %r14,%rax
push   %rax
mov    $0x32,%rdi
mov    %rsp,%r13
mov    %r15,%rsp
call   *%r12
mov    %rsp,%r15
mov    %r13,%rsp
mov    (%r15),%r14
ret

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

LLVM IR (-O2):
define void @create() {
tail call void asm sideeffect "movq (%r15), %rax\0A\09subq %r14, %rax\0A\09pushq %rax\0A\09movq $$0x32, %rdi\0A\09movq %rsp, %r13\0A\09movq %r15, %rsp\0A\09callq *%r12\0A\09movq %rsp, %r15\0A\09movq %r13, %rsp\0A\09movq (%r15), %r14\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
const char *version() { return "cpomf, version 1.0.2"; }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"cpomf, version 1.0.2\00"
define i8* @version() {
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [21 x i8] c"cpomf, version 1.0.2\00"
define i8* @version() {
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void SHAMD5IntUnregister(uint32_t ui32Base) {
  ;
  IntDisable(110);
  IntUnregister(110);
}


x86 assembly (clang, -O0):
<SHAMD5IntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x6e,%edi
call   1030 <IntDisable@plt>
mov    $0x6e,%edi
call   1040 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAMD5IntUnregister>:
push   %rax
mov    $0x6e,%edi
call   1030 <IntDisable@plt>
mov    $0x6e,%edi
pop    %rax
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @SHAMD5IntUnregister(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @IntDisable(i32 110)
%4 = call i32 @IntUnregister(i32 110)
ret void
}

LLVM IR (-O2):
define void @SHAMD5IntUnregister(i32 %0) {
%2 = tail call i32 @IntDisable(i32 110)
%3 = tail call i32 @IntUnregister(i32 110)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _rpmalloc_deallocate(void *);
extern void rpfree(void *ptr) { _rpmalloc_deallocate(ptr); }


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

x86 assembly (clang, -O2):
<rpfree>:
jmp    1030 <_rpmalloc_deallocate@plt>

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

LLVM IR (-O2):
define void @rpfree(i8* %0) {
%2 = tail call i32 @_rpmalloc_deallocate(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getch();
int /*<<< orphan*/ primetester(int);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int num, i, j, prime;
  j = 2;
  prime = 1;
  scanf("%d", &num);
  for (i = 2; i <= num; ++i) {
    primetester(i);
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1186 <main+0x56>
mov    -0xc(%rbp),%edi
call   1050 <primetester@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <main+0x34>
mov    $0x0,%al
call   1040 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <scanf@plt>
cmpl   $0x2,0xc(%rsp)
jl     1170 <main+0x40>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
mov    %ebx,%edi
call   1050 <primetester@plt>
cmp    0xc(%rsp),%ebx
jl     1160 <main+0x30>
xor    %eax,%eax
call   1040 <getch@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 2
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %9, %6 ], [ 2, %0 ]
%8 = call i32 @primetester(i32 %7)
%9 = add nuw nsw i32 %7, 1
%10 = load i32, i32* %1
%11 = icmp slt i32 %7, %10
br i1 %11, label %6, label %12
12: ; preds = %6, %0
%13 = call i32 (...) @getch()
ret i32 0
}
/* Variables and functions */
char *strcpy(char *, char *);
int strlen(char *);
scalar_t__ xxalloc(int);
char *xxstrdup(char str[]) {
  int len = strlen(str);
  char *p = (char *)xxalloc(len + 1);
  return strcpy(p, str);
}


x86 assembly (clang, -O0):
<xxstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <xxalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xxstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <xxalloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @xxstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i64 @xxalloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = call i8* @strcpy(i8* %11, i8* %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @xxstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @xxalloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i8* @strcpy(i8* dereferenceable(1) %5, i8* dereferenceable(1) %0)
ret i8* %5
}
void zcb_onArrayStart(char *name) {}


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

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

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

LLVM IR (-O2):
define void @zcb_onArrayStart(i8* nocapture %0) {
ret void
}
int skl_offcore_num(void) { return (2); }


x86 assembly (clang, -O0):
<skl_offcore_num>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skl_offcore_num>:
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @skl_offcore_num() {
ret i32 2
}

LLVM IR (-O2):
define i32 @skl_offcore_num() {
ret i32 2
}
int __block_index2(int i, int n, int sz) {
  if (i == n) {
    return sz;
  }
  return i * sz / n - ((i * sz / n) & 0x1);
}


x86 assembly (clang, -O0):
<__block_index2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1124 <__block_index2+0x24>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <__block_index2+0x4a>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
and    $0x1,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__block_index2>:
mov    %edx,%eax
cmp    %esi,%edi
je     110f <__block_index2+0xf>
imul   %edi,%eax
cltd
idiv   %esi
and    $0xfffffffe,%eax
ret

LLVM IR (-O0):
define i32 @__block_index2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load i32, i32* %7
store i32 %12, i32* %4
br label %26
13: ; preds = %3
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = mul nsw i32 %14, %15
%17 = load i32, i32* %6
%18 = sdiv i32 %16, %17
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %6
%23 = sdiv i32 %21, %22
%24 = and i32 %23, 1
%25 = sub nsw i32 %18, %24
store i32 %25, i32* %4
br label %26
26: ; preds = %13, %11
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @__block_index2(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, %1
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = mul nsw i32 %2, %0
%7 = sdiv i32 %6, %1
%8 = and i32 %7, -2
br label %9
9: ; preds = %3, %5
%10 = phi i32 [ %8, %5 ], [ %2, %3 ]
ret i32 %10
}
/* Variables and functions */
char getch();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ ungets(char *);
main(void) {
  char c;
  char ms[] = "Hello this is the test input.\n";
  ungets(ms);
  while ((c = getch()) != '\n') {
    putchar(c);
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xeac(%rip),%ax
mov    %ax,-0x14(%rbp)
mov    0xea4(%rip),%al
mov    %al,-0x12(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <ungets@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11aa <main+0x7a>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1186 <main+0x56>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xed4(%rip),%xmm0
movups %xmm0,0xf(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <ungets@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0xa,%al
je     1175 <main+0x45>
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.ms = [31 x i8] c"Hello this is the test input.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [31 x i8]
store i32 0, i32* %1
%4 = bitcast [31 x i8]* %3 to i8*
%5 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 0
%6 = call i32 @ungets(i8* %5)
br label %7
7: ; preds = %11, %0
%8 = call signext i8 (...) @getch()
store i8 %8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8, i8* %2
%13 = call i32 @putchar(i8 signext %12)
br label %7
14: ; preds = %7
%15 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.ms = [31 x i8] c"Hello this is the test input.\0A\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%3 = call i32 @ungets(i8* %2)
%4 = call signext i8 (...) @getch()
%5 = icmp eq i8 %4, 10
br i1 %5, label %11, label %6
6: ; preds = %0, %6
%7 = phi i8 [ %9, %6 ], [ %4, %0 ]
%8 = call i32 @putchar(i8 signext %7)
%9 = call signext i8 (...) @getch()
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %6
11: ; preds = %6, %0
%12 = call i32 @putchar(i8 signext 10)
ret i32 0
}