xunge/DecIR huggingface dataset:
int cmp(const void *a, const void *b) {
  int aa = *(int *)a;
  int bb = *(int *)b;
  return aa > bb ? 1 : aa < bb ? -1 : 0;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1137 <cmp+0x37>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <cmp+0x4c>
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%esi
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Type definitions */
struct xfs_trans {
  int dummy;
};
struct xfs_scrub_metadata {
  int dummy;
};
struct xfs_mount {
  int dummy;
};

/* Variables and functions */
int xfs_trans_alloc_empty(struct xfs_mount *, struct xfs_trans **);
int xfs_scrub_trans_alloc(struct xfs_scrub_metadata *sm, struct xfs_mount *mp,
                          struct xfs_trans **tpp) {
  return xfs_trans_alloc_empty(mp, tpp);
}


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

x86 assembly (clang, -O2):
<xfs_scrub_trans_alloc>:
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <xfs_trans_alloc_empty@plt>

LLVM IR (-O0):
%struct.xfs_scrub_metadata = type { i32 }
%struct.xfs_mount = type { i32 }
%struct.xfs_trans = type { i32 }
define i32 @xfs_scrub_trans_alloc(%struct.xfs_scrub_metadata* %0, %struct.xfs_mount* %1, %struct.xfs_trans** %2) {
%4 = alloca %struct.xfs_scrub_metadata*
%5 = alloca %struct.xfs_mount*
%6 = alloca %struct.xfs_trans**
store %struct.xfs_scrub_metadata* %0, %struct.xfs_scrub_metadata** %4
store %struct.xfs_mount* %1, %struct.xfs_mount** %5
store %struct.xfs_trans** %2, %struct.xfs_trans*** %6
%7 = load %struct.xfs_mount*, %struct.xfs_mount** %5
%8 = load %struct.xfs_trans**, %struct.xfs_trans*** %6
%9 = call i32 @xfs_trans_alloc_empty(%struct.xfs_mount* %7, %struct.xfs_trans** %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.xfs_scrub_metadata = type { i32 }
%struct.xfs_mount = type { i32 }
%struct.xfs_trans = type { i32 }
define i32 @xfs_scrub_trans_alloc(%struct.xfs_scrub_metadata* nocapture readnone %0, %struct.xfs_mount* %1, %struct.xfs_trans** %2) {
%4 = tail call i32 @xfs_trans_alloc_empty(%struct.xfs_mount* %1, %struct.xfs_trans** %2)
ret i32 %4
}
/* Variables and functions */
char *sm_alloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *sm_strdup(const char *s) {
  char *buf;
  buf = sm_alloc(strlen(s) + 1);
  strcpy(buf, s);
  return buf;
}


x86 assembly (clang, -O0):
<sm_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <sm_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sm_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <sm_alloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @sm_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @sm_alloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void query() { printf("Quering ...."); }


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"Quering ....\00"
define void @query() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned int const jiffies_to_msecs(unsigned long);
__attribute__((always_)) unsigned long msecs_to_jiffies(const unsigned int m) {
  if (m > jiffies_to_msecs(((~0UL >> 1) - 1)))
    return ((~0UL >> 1) - 1);
  return (m + ((1000L) / 250) - 1) / ((1000L) / 250);
}


x86 assembly (clang, -O0):
<msecs_to_jiffies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movabs $0x7ffffffffffffffe,%rdi
ff ff 7f
call   1030 <jiffies_to_msecs@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jbe    1150 <msecs_to_jiffies+0x40>
movabs $0x7ffffffffffffffe,%rax
ff ff 7f
mov    %rax,-0x8(%rbp)
jmp    1169 <msecs_to_jiffies+0x59>
mov    -0xc(%rbp),%eax
add    $0x4,%rax
sub    $0x1,%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msecs_to_jiffies>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movabs $0x7ffffffffffffffe,%r14
ff ff 7f
mov    %r14,%rdi
call   1030 <jiffies_to_msecs@plt>
mov    %ebx,%ecx
add    $0x3,%rcx
shr    $0x2,%rcx
cmp    %ebx,%eax
cmovb  %r14,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @msecs_to_jiffies(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @jiffies_to_msecs(i64 9223372036854775806)
%6 = icmp ugt i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i64 9223372036854775806, i64* %2
br label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = add nsw i64 %10, 4
%12 = sub nsw i64 %11, 1
%13 = sdiv i64 %12, 4
store i64 %13, i64* %2
br label %14
14: ; preds = %8, %7
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @msecs_to_jiffies(i32 %0) {
%2 = tail call i32 @jiffies_to_msecs(i64 9223372036854775806)
%3 = icmp ult i32 %2, %0
%4 = zext i32 %0 to i64
%5 = add nuw nsw i64 %4, 3
%6 = lshr i64 %5, 2
%7 = select i1 %3, i64 9223372036854775806, i64 %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ picol_oom();
char *strdup(char const *);
char *picol_strdup(const char *p) {
  char *r = strdup(p);
  if (r == NULL)
    picol_oom();
  return r;
}


x86 assembly (clang, -O0):
<picol_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <picol_strdup+0x2b>
mov    $0x0,%al
call   1030 <picol_oom@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<picol_strdup>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <picol_strdup+0x15>
xor    %eax,%eax
call   1030 <picol_oom@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @picol_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @picol_oom()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double, double);
int main() {
  double a = 80.5, b = 22.34;
  printf("%10.2lf%10.2lf%10.2lf", a, b, a + b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
addsd  -0x18(%rbp),%xmm2
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf00(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
movsd  0xee0(%rip),%xmm2
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%10.2lf%10.2lf%10.2lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 8.050000e+01, double* %2
store double 2.234000e+01, double* %3
%4 = load double, double* %2
%5 = load double, double* %3
%6 = load double, double* %2
%7 = load double, double* %3
%8 = fadd double %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %4, double %5, double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"%10.2lf%10.2lf%10.2lf\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 8.050000e+01, double 2.234000e+01, double 1.028400e+02)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void llint_put(signed long long int number, FILE *stream) {
  if (number > (signed long long int)9) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
    llint_put(number / (signed long long int)10, stream);
#pragma GCC diagnostic pop
  }
  fputc('0' + (char)(number % (signed long long int)10), stream);
}


x86 assembly (clang, -O0):
<llint_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x9,-0x8(%rbp)
jle    1155 <llint_put+0x35>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <llint_put@plt>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %dl,%al
movsbl %al,%eax
add    $0x30,%eax
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llint_put>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
cmp    $0xa,%rdi
jl     114f <llint_put+0x2f>
movabs $0xcccccccccccccccd,%rcx
cc cc cc
mov    %rbx,%rax
mul    %rcx
mov    %rdx,%rdi
shr    $0x3,%rdi
mov    %r14,%rsi
call   1040 <llint_put@plt>
movabs $0x6666666666666667,%rcx
66 66 66
mov    %rbx,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x2,%edx
add    %eax,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%eax
sub    %eax,%ebx
add    $0x30,%bl
movsbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @llint_put(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
store i64 %0, i64* %3
store i32* %1, i32** %4
%5 = load i64, i64* %3
%6 = icmp sgt i64 %5, 9
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i64, i64* %3
%9 = sdiv i64 %8, 10
%10 = load i32*, i32** %4
br label %11
11: ; preds = %7, %2
%12 = load i64, i64* %3
%13 = srem i64 %12, 10
%14 = trunc i64 %13 to i8
%15 = sext i8 %14 to i32
%16 = add nsw i32 48, %15
%17 = trunc i32 %16 to i8
%18 = load i32*, i32** %4
%19 = call i32 @fputc(i8 signext %17, i32* %18)
ret void
}

LLVM IR (-O2):
define void @llint_put(i64 %0, i32* nocapture %1) {
%3 = icmp sgt i64 %0, 9
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = udiv i64 %0, 10
tail call void @llint_put(i64 %5, i32* %1)
br label %6
6: ; preds = %4, %2
%7 = srem i64 %0, 10
%8 = trunc i64 %7 to i8
%9 = add nsw i8 %8, 48
%10 = tail call i32 @fputc(i8 signext %9, i32* %1)
ret void
}
int msm_chg_rpc_close(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @msm_chg_rpc_close() {
ret i32 0
}
void TimerIC3PrescalerSet(unsigned long ulBase, unsigned long ulPrescaler) {

  ;

  ;
  (*((volatile unsigned long *)(ulBase + 0x0000001C))) &= ~0x0000000C;
  (*((volatile unsigned long *)(ulBase + 0x0000001C))) |= ulPrescaler;
}


x86 assembly (clang, -O0):
<TimerIC3PrescalerSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%rcx
and    $0xfffffffffffffff3,%rcx
mov    %rcx,0x1c(%rax)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerIC3PrescalerSet>:
andq   $0xfffffffffffffff3,0x1c(%rdi)
or     %rsi,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @TimerIC3PrescalerSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 28
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -13
store volatile i64 %9, i64* %7
%10 = load i64, i64* %4
%11 = load i64, i64* %3
%12 = add i64 %11, 28
%13 = inttoptr i64 %12 to i64*
%14 = load volatile i64, i64* %13
%15 = or i64 %14, %10
store volatile i64 %15, i64* %13
ret void
}

LLVM IR (-O2):
define void @TimerIC3PrescalerSet(i64 %0, i64 %1) {
%3 = add i64 %0, 28
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, -13
store volatile i64 %6, i64* %4
%7 = load volatile i64, i64* %4
%8 = or i64 %7, %1
store volatile i64 %8, i64* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_255() {
  Assert_real((isqrt(255) == 15),
              "/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/stdlib/isqrt.c",
              1280, ("Integer square root of 255 should be 15"));
}


x86 assembly (clang, -O0):
<t_sqrt_255>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff,%edi
call   1030 <isqrt@plt>
cmp    $0xf,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x500,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_255>:
push   %rax
mov    $0xff,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xf,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x500,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 255 should be 15\00"
define void @t_sqrt_255() {
%1 = call i32 @isqrt(i32 255)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1280, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 255 should be 15\00"
define void @t_sqrt_255() {
%1 = tail call i32 @isqrt(i32 255)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1280, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void kb_noCallback(int k, int u, int s) {}


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

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

LLVM IR (-O0):
define void @kb_noCallback(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
ret void
}

LLVM IR (-O2):
define void @kb_noCallback(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int get_readonly_descriptor(char *file_addr) {
  int d = open(file_addr, O_RDONLY);
  if (d < 0) {
    perror(file_addr);
    exit(EXIT_FAILURE);
  }
  return d;
}


x86 assembly (clang, -O0):
<get_readonly_descriptor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1172 <get_readonly_descriptor+0x42>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_readonly_descriptor>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
test   %eax,%eax
js     1148 <get_readonly_descriptor+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @get_readonly_descriptor(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @perror(i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @get_readonly_descriptor(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = tail call i32 @perror(i8* %0)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i32 %3
}
void mdp4_mddi_wait4vsync(int cndx) {}


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

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

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

LLVM IR (-O2):
define void @mdp4_mddi_wait4vsync(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fk425e(double *, double *, double);
int /*<<< orphan*/ fk52ecl(double *, double *, double);
void fk42ecl(double *dtheta, double *dphi, double epoch) {
  fk425e(dtheta, dphi, epoch);
  fk52ecl(dtheta, dphi, epoch);
  return;
}


x86 assembly (clang, -O0):
<fk42ecl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
call   1040 <fk425e@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
call   1030 <fk52ecl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fk42ecl>:
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <fk425e@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fk52ecl@plt>

LLVM IR (-O0):
define void @fk42ecl(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%7 = load double*, double** %4
%8 = load double*, double** %5
%9 = load double, double* %6
%10 = call i32 @fk425e(double* %7, double* %8, double %9)
%11 = load double*, double** %4
%12 = load double*, double** %5
%13 = load double, double* %6
%14 = call i32 @fk52ecl(double* %11, double* %12, double %13)
ret void
}

LLVM IR (-O2):
define void @fk42ecl(double* %0, double* %1, double %2) {
%4 = tail call i32 @fk425e(double* %0, double* %1, double %2)
%5 = tail call i32 @fk52ecl(double* %0, double* %1, double %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kiir(char *);
int /*<<< orphan*/ saveSettings();
int settingsend() {
  saveSettings();
  kiir("A beallitasok mentve\n");
  return 0;
}


x86 assembly (clang, -O0):
<settingsend>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <saveSettings@plt>
lea    0xece(%rip),%rdi
call   1030 <kiir@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<settingsend>:
push   %rax
xor    %eax,%eax
call   1040 <saveSettings@plt>
lea    0xed1(%rip),%rdi
call   1030 <kiir@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"A beallitasok mentve\0A\00"
define i32 @settingsend() {
%1 = call i32 (...) @saveSettings()
%2 = call i32 @kiir(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"A beallitasok mentve\0A\00"
define i32 @settingsend() {
%1 = tail call i32 (...) @saveSettings()
%2 = tail call i32 @kiir(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void RTVfsIoStrmFromStdHandle(void) {}


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

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

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

LLVM IR (-O2):
define void @RTVfsIoStrmFromStdHandle() {
ret void
}
int Serve2(int para) { return para; }


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

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

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

LLVM IR (-O2):
define i32 @Serve2(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int tasksignal(int);
int cornet_signal(int id) { return tasksignal(id); }


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

x86 assembly (clang, -O2):
<cornet_signal>:
jmp    1030 <tasksignal@plt>

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

LLVM IR (-O2):
define i32 @cornet_signal(i32 %0) {
%2 = tail call i32 @tasksignal(i32 %0)
ret i32 %2
}
int get_abs(int a) {
  if (a < 0) {
    return -a;
  }
  return a;
}


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

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

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

LLVM IR (-O2):
define i32 @get_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ nanotest_putchar(int /*<<< orphan*/);
void nanotest_putstr(char const *str) {
  while (*str)
    nanotest_putchar(*(str++));
}


x86 assembly (clang, -O0):
<nanotest_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <nanotest_putstr+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <nanotest_putchar@plt>
jmp    111c <nanotest_putstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nanotest_putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <nanotest_putstr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <nanotest_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <nanotest_putstr+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @nanotest_putstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @nanotest_putchar(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @nanotest_putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @nanotest_putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uartPutc(char);
void uartPuts(char *str) {
  for (int i = 0; str[i] != '\0'; ++i) {
    uartPutc(str[i]);
  }
  return;
}


x86 assembly (clang, -O0):
<uartPuts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1157 <uartPuts+0x47>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <uartPutc@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <uartPuts+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uartPuts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <uartPuts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <uartPutc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <uartPuts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @uartPuts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret void
5: ; preds = %1, %5
%6 = phi i64 [ %9, %5 ], [ 0, %1 ]
%7 = phi i8 [ %11, %5 ], [ %2, %1 ]
%8 = tail call i32 @uartPutc(i8 signext %7)
%9 = add nuw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %4, label %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void print_three_int(int n, int m, int l) { printf("%d%d%d", n, m, l); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"%d%d%d\00"
define void @print_three_int(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 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d%d%d\00"
define void @print_three_int(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
const char *module_type_name(uint32_t module_type) {
  switch (module_type) {
  case 0x9:
    return "DMC";
  default:
    return "Unknown";
  }
}


x86 assembly (clang, -O0):
<module_type_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
jne    1128 <module_type_name+0x28>
jmp    1118 <module_type_name+0x18>
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1133 <module_type_name+0x33>
lea    0xed5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_type_name>:
cmp    $0x9,%edi
lea    0xef6(%rip),%rcx
lea    0xef3(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"DMC\00"
@.str.1 = [8 x i8] c"Unknown\00"
define i8* @module_type_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 9, label %5
]
5: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %7
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %7
7: ; preds = %6, %5
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@.str = [4 x i8] c"DMC\00"
@.str.1 = [8 x i8] c"Unknown\00"
define i8* @module_type_name(i32 %0) {
%2 = icmp eq i32 %0, 9
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
size_t const divdown(size_t const, size_t const);
size_t rounddown(size_t const a, size_t const b) { return divdown(a, b) * b; }


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

x86 assembly (clang, -O2):
<rounddown>:
push   %rbx
mov    %rsi,%rbx
call   1030 <divdown@plt>
imul   %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @rounddown(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i64 @divdown(i64 %5, i64 %6)
%8 = load i64, i64* %4
%9 = mul i64 %7, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @rounddown(i64 %0, i64 %1) {
%3 = tail call i64 @divdown(i64 %0, i64 %1)
%4 = mul i64 %3, %1
ret i64 %4
}
int hash(char *elt) {
  return ((unsigned char)elt[0]) * 256 + ((unsigned char)elt[1]);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = mul nsw i32 %6, 256
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
int execute_vfork() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_vfork() {
ret i32 0
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strncat(char *d, const char *s, size_t n) {
  strncpy(d + strlen(d), s, n);
  return d;
}


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

x86 assembly (clang, -O2):
<strncat>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strncat(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = call i32 @strncpy(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @strncat(i8* returned %0, i8* %1, i64 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i32 @strncpy(i8* %6, i8* %1, i64 %2)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ seq_utils_clamp(scalar_t__, int /*<<< orphan*/, int);
scalar_t__ song_get_cvgate_pairs();
int /*<<< orphan*/ song_set_cvgate_pairs(int /*<<< orphan*/);
void seq_ctrl_adjust_cvgate_pairs(int change) {
  song_set_cvgate_pairs(
      seq_utils_clamp(song_get_cvgate_pairs() + change, 0, ((4) - 1)));
}


x86 assembly (clang, -O0):
<seq_ctrl_adjust_cvgate_pairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <song_get_cvgate_pairs@plt>
mov    %rax,%rdi
movslq -0x4(%rbp),%rax
add    %rax,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1040 <seq_utils_clamp@plt>
mov    %eax,%edi
call   1050 <song_set_cvgate_pairs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_ctrl_adjust_cvgate_pairs>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <song_get_cvgate_pairs@plt>
movslq %ebx,%rdi
add    %rax,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1040 <seq_utils_clamp@plt>
mov    %eax,%edi
pop    %rbx
jmp    1050 <song_set_cvgate_pairs@plt>

LLVM IR (-O0):
define void @seq_ctrl_adjust_cvgate_pairs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @song_get_cvgate_pairs()
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = add nsw i64 %3, %5
%7 = call i32 @seq_utils_clamp(i64 %6, i32 0, i32 3)
%8 = call i32 @song_set_cvgate_pairs(i32 %7)
ret void
}

LLVM IR (-O2):
define void @seq_ctrl_adjust_cvgate_pairs(i32 %0) {
%2 = tail call i64 (...) @song_get_cvgate_pairs()
%3 = sext i32 %0 to i64
%4 = add nsw i64 %2, %3
%5 = tail call i32 @seq_utils_clamp(i64 %4, i32 0, i32 3)
%6 = tail call i32 @song_set_cvgate_pairs(i32 %5)
ret void
}
/* Variables and functions */
extern size_t ftg_u8_strlen(const char *s) {
  const char *p = s;
  size_t j = 0;
  while (*p) {
    if ((*p & 0xc0) != 0x80)
      j++;
    p++;
  }
  return j;
}


x86 assembly (clang, -O0):
<ftg_u8_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1159 <ftg_u8_strlen+0x59>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
je     1148 <ftg_u8_strlen+0x48>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <ftg_u8_strlen+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftg_u8_strlen>:
mov    (%rdi),%cl
test   %cl,%cl
je     112a <ftg_u8_strlen+0x2a>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
and    $0xc0,%cl
xor    %edx,%edx
cmp    $0x80,%cl
setne  %dl
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ftg_u8_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @ftg_u8_strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %12, %4 ], [ %0, %1 ]
%8 = and i8 %5, -64
%9 = icmp ne i8 %8, -128
%10 = zext i1 %9 to i64
%11 = add i64 %6, %10
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i64 [ 0, %1 ], [ %11, %4 ]
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ eztrace_code0(int);
void eztrace_generic(int code, int nb_args, ...) { eztrace_code0(code); }


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

x86 assembly (clang, -O2):
<eztrace_generic>:
jmp    1030 <eztrace_code0@plt>

LLVM IR (-O0):
define void @eztrace_generic(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 = call i32 @eztrace_code0(i32 %5)
ret void
}

LLVM IR (-O2):
define void @eztrace_generic(i32 %0, i32 %1, ...) {
%3 = tail call i32 @eztrace_code0(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int open_file(char *filename) {
  int fd;
  fd = open(filename, O_RDWR);
  if (fd == -1) {
    perror("Error opening the device");
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<open_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1163 <open_file+0x43>
lea    0xeae(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <open_file+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_file>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     113a <open_file+0x1a>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xebf(%rip),%rdi
call   1040 <perror@plt>
jmp    1136 <open_file+0x16>

LLVM IR (-O0):
@O_RDWR = global i32 0
@.str = [25 x i8] c"Error opening the device\00"
define i32 @open_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_RDWR
%7 = call i32 @open(i8* %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %14
12: ; preds = %1
%13 = load i32, i32* %4
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@.str = [25 x i8] c"Error opening the device\00"
define i32 @open_file(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
ret i32 %3
}
int __attribute__((target("arch=sandybridge"))) redef(void) { return 2; }


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

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

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

LLVM IR (-O2):
define i32 @redef() {
ret i32 2
}
unsigned char UART_get_unsigned(void) {
  if ((*((volatile unsigned char *)0xE000C014)) & 0x01)
    return (*((volatile unsigned char *)0xE000C000));
  return -1;
}


x86 assembly (clang, -O0):
<UART_get_unsigned>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe000c014,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1129 <UART_get_unsigned+0x29>
mov    $0xe000c000,%eax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
jmp    112d <UART_get_unsigned+0x2d>
movb   $0xff,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UART_get_unsigned>:
mov    $0xe000c000,%ecx
mov    $0xff,%al
testb  $0x1,0x14(%rcx)
je     110f <UART_get_unsigned+0xf>
mov    (%rcx),%al
ret

LLVM IR (-O0):
define zeroext i8 @UART_get_unsigned() {
%1 = alloca i8
%2 = load volatile i8, i8* inttoptr (i64 3758145556 to i8*)
%3 = zext i8 %2 to i32
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = load volatile i8, i8* inttoptr (i64 3758145536 to i8*)
store i8 %7, i8* %1
br label %9
8: ; preds = %0
store i8 -1, i8* %1
br label %9
9: ; preds = %8, %6
%10 = load i8, i8* %1
ret i8 %10
}

LLVM IR (-O2):
define zeroext i8 @UART_get_unsigned() {
%1 = load volatile i8, i8* inttoptr (i64 3758145556 to i8*)
%2 = and i8 %1, 1
%3 = icmp eq i8 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = load volatile i8, i8* inttoptr (i64 3758145536 to i8*)
br label %6
6: ; preds = %0, %4
%7 = phi i8 [ %5, %4 ], [ -1, %0 ]
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ savefile(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
void tapCreate(char *path) { savefile(path, NULL, 0); }


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

x86 assembly (clang, -O2):
<tapCreate>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <savefile@plt>

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

LLVM IR (-O2):
define void @tapCreate(i8* %0) {
%2 = tail call i32 @savefile(i8* %0, i32* null, i32 0)
ret void
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double getwholetime(void) {
  double s, u;
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  s = tv.tv_sec * 1.0;
  u = tv.tv_usec * 1.0;
  u /= 1000000.0;
  s += u;
  return (s);
}


x86 assembly (clang, -O0):
<getwholetime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <gettimeofday@plt>
movsd  0xedb(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xec9(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeaa(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getwholetime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xed1(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
%struct.timezone = type { i32 }
define double @getwholetime() {
%1 = alloca double
%2 = alloca double
%3 = alloca %struct.timeval
%4 = alloca %struct.timezone
%5 = call i32 @gettimeofday(%struct.timeval* %3, %struct.timezone* %4)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%7 = load double, double* %6
%8 = fmul double %7, 1.000000e+00
store double %8, double* %1
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%10 = load double, double* %9
%11 = fmul double %10, 1.000000e+00
store double %11, double* %2
%12 = load double, double* %2
%13 = fdiv double %12, 1.000000e+06
store double %13, double* %2
%14 = load double, double* %2
%15 = load double, double* %1
%16 = fadd double %15, %14
store double %16, double* %1
%17 = load double, double* %1
ret double %17
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
%struct.timezone = type { i32 }
define double @getwholetime() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load double, double* %6
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load double, double* %8
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %7, %10
ret double %11
}