xunge/DecIR huggingface dataset:
int qsort_int_cmp_(const void *x, const void *y) {
  if (*((int *)x) > *((int *)y))
    return (-1);
  else
    return (*((int *)x) < *((int *)y));
}


x86 assembly (clang, -O0):
<qsort_int_cmp_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    112a <qsort_int_cmp_+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1141 <qsort_int_cmp_+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @qsort_int_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 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int tegra_bbc_power_init(struct platform_device *pdev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.platform_device = type opaque
define i32 @tegra_bbc_power_init(%struct.platform_device* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ XEDataObject;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XEDataObject(void) {
  XEDataObject *_p = (XEDataObject *)malloc(sizeof(XEDataObject));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XEDataObject>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XEDataObject+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XEDataObject>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XEDataObject+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XEDataObject() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XEDataObject() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printscreen(char *);
long add1(int n) {
  printscreen("Helloworld");
  return n + 1;
}


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

x86 assembly (clang, -O2):
<add1>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
call   1030 <printscreen@plt>
add    $0x1,%ebx
movslq %ebx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Helloworld\00"
define i64 @add1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printscreen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
@.str = [11 x i8] c"Helloworld\00"
define i64 @add1(i32 %0) {
%2 = tail call i32 @printscreen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = add nsw i32 %0, 1
%4 = sext i32 %3 to i64
ret i64 %4
}
const char *category_to_name(category)
int category;
{
  const char *retval;
  switch (category) {
  case (-1):
    retval = "LC_MESSAGES";
    break;
  default:
    retval = "LC_XXX";
  }
  return retval;
}


x86 assembly (clang, -O0):
<category_to_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0xffffffff,%eax
jne    1128 <category_to_name+0x28>
jmp    1118 <category_to_name+0x18>
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1133 <category_to_name+0x33>
lea    0xedd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<category_to_name>:
cmp    $0xffffffff,%edi
lea    0xef6(%rip),%rcx
lea    0xefb(%rip),%rax
cmove  %rcx,%rax
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"LC_MESSAGES\00"
@.str.1 = [7 x i8] c"LC_XXX\00"
define i8* @category_to_name(i32 %0) {
%2 = icmp eq i32 %0, -1
%3 = select i1 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
ret i8* %3
}
void uDMAChannelDisable(unsigned long ulChannelNum) {
  ;
  (*((volatile unsigned long *)(0x400FF000 + 0x0000002C))) =
      1 << (ulChannelNum & 0x1f);
}


x86 assembly (clang, -O0):
<uDMAChannelDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1f,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    $0x400ff02c,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAChannelDisable>:
mov    %rdi,%rcx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,0x400ff02c
40
ret

LLVM IR (-O0):
define void @uDMAChannelDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 31
%5 = trunc i64 %4 to i32
%6 = shl i32 1, %5
%7 = sext i32 %6 to i64
store volatile i64 %7, i64* inttoptr (i64 1074786348 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAChannelDisable(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = and i32 %2, 31
%4 = shl nuw i32 1, %3
%5 = sext i32 %4 to i64
store volatile i64 %5, i64* inttoptr (i64 1074786348 to i64*)
ret void
}
/* Variables and functions */
int factorial_iteration(int);
int factorial_recursion(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf(" %d \n", factorial_recursion(10));
  printf(" %d \n", factorial_iteration(10));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1040 <factorial_recursion@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1050 <factorial_iteration@plt>
mov    %eax,%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c" %d \0A\00"
define i32 @main() {
%1 = call i32 @factorial_recursion(i32 10)
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @factorial_iteration(i32 10)
%4 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c" %d \0A\00"
define i32 @main() {
%1 = tail call i32 @factorial_recursion(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @factorial_iteration(i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_160() {
  Assert_real((isqrt(160) == 12),
              "/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",
              805, ("Integer square root of 160 should be 12"));
}


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

x86 assembly (clang, -O2):
<t_sqrt_160>:
push   %rax
mov    $0xa0,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xc,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x325,%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 160 should be 12\00"
define void @t_sqrt_160() {
%1 = call i32 @isqrt(i32 160)
%2 = icmp eq i32 %1, 12
%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 805, 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 160 should be 12\00"
define void @t_sqrt_160() {
%1 = tail call i32 @isqrt(i32 160)
%2 = icmp eq i32 %1, 12
%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 805, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pr_devel(char *);
void xio_read_logging_level(void) { pr_devel("xio_read_logging_level\n"); }


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

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

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

LLVM IR (-O2):
@.str = [24 x i8] c"xio_read_logging_level\0A\00"
define void @xio_read_logging_level() {
%1 = tail call i32 @pr_devel(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}
double fmatest(double a, double b, double c) { return __builtin_fma(a, b, c); }


x86 assembly (clang, -O0):
<fmatest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1030 <fma@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmatest>:
jmp    1030 <fma@plt>

LLVM IR (-O0):
define double @fmatest(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 double @llvm.fma.f64(double %7, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @fmatest(double %0, double %1, double %2) {
%4 = tail call double @llvm.fma.f64(double %0, double %1, double %2)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
char *gl_getline(char *);
int /*<<< orphan*/ gl_histadd(char *);
int /*<<< orphan*/ stdout;
main() {
  char *p;
  do {
    p = gl_getline("PROMPT>>>> ");
    gl_histadd(p);
    fputs(p, stdout);
  } while (*p != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1050 <gl_getline@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <gl_histadd@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xec4(%rip),%r14
mov    0x2e9d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1050 <gl_getline@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <gl_histadd@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1030 <fputs@plt>
cmpb   $0x0,(%rbx)
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"PROMPT>>>> \00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
br label %3
3: ; preds = %10, %0
%4 = call i8* @gl_getline(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @gl_histadd(i8* %5)
%7 = load i8*, i8** %2
%8 = load i32, i32* @stdout
%9 = call i32 @fputs(i8* %7, i32 %8)
br label %10
10: ; preds = %3
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %3, label %15
15: ; preds = %10
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [12 x i8] c"PROMPT>>>> \00"
@stdout = global i32 0
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i8* @gl_getline(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @gl_histadd(i8* %2)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fputs(i8* %2, i32 %4)
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %1
8: ; preds = %1
ret i32 0
}
int bitops_ffs(int i) {
  int bit;
  if (i == 0)
    return 0;
  for (bit = 1; (i & 0x01) == 0; bit++)
    i >>= 1;
  return bit;
}


x86 assembly (clang, -O0):
<bitops_ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <bitops_ffs+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1150 <bitops_ffs+0x50>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    114a <bitops_ffs+0x4a>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <bitops_ffs+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitops_ffs>:
test   %edi,%edi
je     112e <bitops_ffs+0x2e>
mov    $0x1,%eax
test   $0x1,%dil
jne    112d <bitops_ffs+0x2d>
mov    $0x1,%eax
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
sar    %ecx
add    $0x1,%eax
test   $0x2,%dil
mov    %ecx,%edi
je     1120 <bitops_ffs+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @bitops_ffs(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %3, %6
%7 = phi i32 [ %10, %6 ], [ 1, %3 ]
%8 = phi i32 [ %9, %6 ], [ %0, %3 ]
%9 = ashr i32 %8, 1
%10 = add nuw nsw i32 %7, 1
%11 = and i32 %8, 2
%12 = icmp eq i32 %11, 0
br i1 %12, label %6, label %13
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 1, %3 ], [ %10, %6 ]
ret i32 %14
}
void setup_break(void) {}


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

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

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

LLVM IR (-O2):
define void @setup_break() {
ret void
}
/* Variables and functions */
size_t readNothing(void *buff, size_t elsize, size_t nelem, void *parm) {
  buff = buff;
  elsize = elsize;
  nelem = nelem;
  parm = parm;
  return 0;
}


x86 assembly (clang, -O0):
<readNothing>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @readNothing(i8* nocapture readnone %0, i64 %1, i64 %2, i8* nocapture readnone %3) {
ret i64 0
}
void HandleSIGPIPE(__attribute__((unused)) int sig) { return; }


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

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

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

LLVM IR (-O2):
define void @HandleSIGPIPE(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int log_level();
int /*<<< orphan*/ log_msg(int, char const *, char *, int);
int /*<<< orphan*/ perror(char const *);
void sys_err(const char *msg) {
  do {
    if (log_level() <= 50)
      log_msg(
          50, msg,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/mmmmhack/gstep/refs/heads/master/util.c",
          33);
  } while (0);
  ;
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<sys_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <log_level@plt>
cmp    $0x32,%eax
jg     1176 <sys_err+0x36>
mov    -0x8(%rbp),%rsi
mov    $0x32,%edi
lea    0xe94(%rip),%rdx
mov    $0x21,%ecx
call   1040 <log_msg@plt>
jmp    117b <sys_err+0x3b>
mov    -0x8(%rbp),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<sys_err>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <log_level@plt>
cmp    $0x32,%eax
jg     1169 <sys_err+0x29>
lea    0xea9(%rip),%rdx
mov    $0x32,%edi
mov    %rbx,%rsi
mov    $0x21,%ecx
call   1040 <log_msg@plt>
mov    %rbx,%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mmmmhack/gstep/refs/heads/master/util.c\00"
define void @sys_err(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1
%4 = call i32 (...) @log_level()
%5 = icmp sle i32 %4, 50
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i8*, i8** %2
%8 = call i32 @log_msg(i32 50, i8* %7, i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str, i64 0, i64 0), i32 33)
br label %9
9: ; preds = %6, %3
br label %10
10: ; preds = %9
%11 = load i8*, i8** %2
%12 = call i32 @perror(i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mmmmhack/gstep/refs/heads/master/util.c\00"
define void @sys_err(i8* %0) {
%2 = tail call i32 (...) @log_level()
%3 = icmp slt i32 %2, 51
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @log_msg(i32 50, i8* %0, i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str, i64 0, i64 0), i32 33)
br label %6
6: ; preds = %1, %4
%7 = tail call i32 @perror(i8* %0)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *,
                           char const *);
void iptables_addpost(char *cmd, const char *Fip, const char *Sip,
                      const char *Sport) {
  sprintf(cmd,
          "/sbin/iptables"
          " -t nat -A POSTROUTING -p tcp -d %s --dport %s -j SNAT --to %s",
          Sip, Sport, Fip);
}


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

x86 assembly (clang, -O2):
<iptables_addpost>:
mov    %rsi,%r8
lea    0xee6(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [77 x i8] c"/sbin/iptables -t nat -A POSTROUTING -p tcp -d %s --dport %s -j SNAT --to %s\00"
define void @iptables_addpost(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %7
%11 = load i8*, i8** %8
%12 = load i8*, i8** %6
%13 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [77 x i8] c"/sbin/iptables -t nat -A POSTROUTING -p tcp -d %s --dport %s -j SNAT --to %s\00"
define void @iptables_addpost(i8* nocapture writeonly %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i8* %1)
ret void
}
int toma(char c) {
  if (c >= 'A' && c <= 'Z')
    return 'a' + c - 'A';
  return c;
}


x86 assembly (clang, -O0):
<toma>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1136 <toma+0x36>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1136 <toma+0x36>
movsbl -0x5(%rbp),%eax
add    $0x61,%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <toma+0x3d>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toma>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%cl
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @toma(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -65
%4 = icmp ult i8 %3, 26
%5 = add nsw i32 %2, 32
%6 = select i1 %4, i32 %5, i32 %2
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void das() { db(0x2F); }


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

x86 assembly (clang, -O2):
<das>:
mov    $0x2f,%edi
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @das() {
%1 = call i32 @db(i32 47)
ret void
}

LLVM IR (-O2):
define void @das() {
%1 = tail call i32 @db(i32 47)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t htol_32(int32_t hostval) { return hostval; }


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

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

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

LLVM IR (-O2):
define i32 @htol_32(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0x43() {
  Assert_real((ispunct(67) == 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_ispunct.c",
              340, ("ispunct should be 0 for C"));
}


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

x86 assembly (clang, -O2):
<t_ispunct_0x43>:
push   %rax
mov    $0x43,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x154,%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_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 0 for C\00"
define void @t_ispunct_0x43() {
%1 = call i64 @ispunct(i32 67)
%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 340, i8* getelementptr inbounds ([26 x i8], [26 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_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 0 for C\00"
define void @t_ispunct_0x43() {
%1 = tail call i64 @ispunct(i32 67)
%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 340, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
aaa() {
  int i = -99;
  char buf[12];
  snprintf(buf, 12, "%d", i);
  puts(buf);
}


x86 assembly (clang, -O0):
<aaa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xffffff9d,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0xc,%esi
lea    0xebe(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x14(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aaa>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdx
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0xffffff9d,%ecx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @aaa() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [12 x i8]
store i32 -99, i32* %2
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @snprintf(i8* %4, i32 12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%8 = call i32 @puts(i8* %7)
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @aaa() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @snprintf(i8* %2, i32 12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 -99)
%4 = call i32 @puts(i8* %2)
ret i32 undef
}
unsigned long ADCReferenceGet(unsigned long ulBase) {
  ;
  return ((*((volatile unsigned long *)(ulBase + 0x00000038))) & 0x00000001);
}


x86 assembly (clang, -O0):
<ADCReferenceGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%rax
and    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCReferenceGet>:
mov    0x38(%rdi),%rax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i64 @ADCReferenceGet(i64 %0) {
%2 = add i64 %0, 56
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, 1
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printUsage(char *programName) {
  printf("Usage:\n");
  printf("%s <dldi> <app>\n", programName);
  printf("   <dldi>        the dldi patch file to apply\n");
  printf("   <app>         the application binary to apply the patch to\n");
  return;
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printUsage>:
push   %rbx
mov    %rdi,%rbx
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [17 x i8] c"%s <dldi> <app>\0A\00"
@.str.2 = [47 x i8] c" <dldi> the dldi patch file to apply\0A\00"
@.str.3 = [63 x i8] c" <app> the application binary to apply the patch to\0A\00"
define void @printUsage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"%s <dldi> <app>\0A\00"
@str = [7 x i8] c"Usage:\00"
@str.4 = [46 x i8] c" <dldi> the dldi patch file to apply\00"
@str.5 = [62 x i8] c" <app> the application binary to apply the patch to\00"
define void @printUsage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.5, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
__attribute__((__weak__, __always___)) void softboundcets_exit(int status) {
  exit(status);
}


x86 assembly (clang, -O0):
<softboundcets_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<softboundcets_exit>:
push   %rax
call   1030 <exit@plt>

LLVM IR (-O0):
define weak void @softboundcets_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
define weak void @softboundcets_exit(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int *calculate_primes(int);
int /*<<< orphan*/ free(int *);
int main() {
  int n = 1000000;
  int *p = calculate_primes(n);
  if (p != NULL)
    free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf4240,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <calculate_primes@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1156 <main+0x36>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xf4240,%edi
call   1040 <calculate_primes@plt>
test   %rax,%rax
je     1138 <main+0x18>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @calculate_primes(i32 1000000)
%2 = icmp eq i32* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @free(i32* %1)
br label %5
5: ; preds = %3, %0
ret i32 0
}
float lerp(float p1, float p2, float amount) {
  return (p2 * amount) + (p1 * (1 - amount));
}


x86 assembly (clang, -O0):
<lerp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
movss  0xed6(%rip),%xmm3
subss  -0xc(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerp>:
movss  0xef8(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm3,%xmm0
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @lerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = load float, float* %6
%9 = load float, float* %4
%10 = load float, float* %6
%11 = fsub float 1.000000e+00, %10
%12 = fmul float %9, %11
%13 = call float @llvm.fmuladd.f32(float %7, float %8, float %12)
ret float %13
}

LLVM IR (-O2):
define float @lerp(float %0, float %1, float %2) {
%4 = fsub float 1.000000e+00, %2
%5 = fmul float %4, %0
%6 = tail call float @llvm.fmuladd.f32(float %1, float %2, float %5)
ret float %6
}
int cairo_code_draw_white_get_width() { return 99; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_white_get_width() {
ret i32 99
}

LLVM IR (-O2):
define i32 @cairo_code_draw_white_get_width() {
ret i32 99
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ pic_end();
void exitcc(int sig) {
  pic_end();
  exit(-1);
}


x86 assembly (clang, -O0):
<exitcc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <pic_end@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitcc>:
push   %rax
xor    %eax,%eax
call   1030 <pic_end@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @exitcc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @pic_end()
%4 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @exitcc(i32 %0) {
%2 = tail call i32 (...) @pic_end()
%3 = tail call i32 @exit(i32 -1)
unreachable
}
void FlxProc1() { return; }


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

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

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

LLVM IR (-O2):
define void @FlxProc1() {
ret void
}
/* Variables and functions */
char *identifier(char *str) {
  str = NULL;
  return NULL;
}


x86 assembly (clang, -O0):
<identifier>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i8* @identifier(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ cpy_int_buff(int *, int *, int const);
int /*<<< orphan*/ gen_sort(int *, int const, int *);
int /*<<< orphan*/ init_int_buff(int *, int const);
int *sort(int *, int const);
void test_sort() {
  const int len = 4;
  int arr[len], origin[len], *res;
  init_int_buff(arr, len);
  cpy_int_buff(origin, arr, len);
  res = sort(arr, len);
  gen_sort(origin, len, res);
}


x86 assembly (clang, -O0):
<test_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x4,-0x4(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1060 <init_int_buff@plt>
lea    -0x40(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1030 <cpy_int_buff@plt>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1050 <sort@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
call   1040 <gen_sort@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sort>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <init_int_buff@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <cpy_int_buff@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <sort@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    %rax,%rdx
call   1040 <gen_sort@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @test_sort() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32*
store i32 4, i32* %1
%4 = call i8* @llvm.stacksave()
store i8* %4, i8** %2
%5 = alloca i32, i64 4
%6 = alloca i32, i64 4
%7 = call i32 @init_int_buff(i32* %5, i32 4)
%8 = call i32 @cpy_int_buff(i32* %6, i32* %5, i32 4)
%9 = call i32* @sort(i32* %5, i32 4)
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = call i32 @gen_sort(i32* %6, i32 4, i32* %10)
%12 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @test_sort() {
%1 = alloca [4 x i32]
%2 = alloca [4 x i32]
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = call i32 @init_int_buff(i32* %4, i32 4)
%6 = call i32 @cpy_int_buff(i32* %3, i32* %4, i32 4)
%7 = call i32* @sort(i32* %4, i32 4)
%8 = call i32 @gen_sort(i32* %3, i32 4, i32* %7)
ret void
}
long SPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData) {

  ;
  if ((*((volatile unsigned long *)(ulBase + 0x00000008))) & 0x00000001) {
    *pulData = (*((volatile unsigned long *)(ulBase + 0x0000000C)));
    return (1);
  } else {
    return (0);
  }
}


x86 assembly (clang, -O0):
<SPIDataGetNonBlocking>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     113e <SPIDataGetNonBlocking+0x3e>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x1,-0x8(%rbp)
jmp    1146 <SPIDataGetNonBlocking+0x46>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPIDataGetNonBlocking>:
testq  $0x1,0x8(%rdi)
jne    110d <SPIDataGetNonBlocking+0xd>
xor    %eax,%eax
ret
mov    0xc(%rdi),%rax
mov    %rax,(%rsi)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i64 @SPIDataGetNonBlocking(i64 %0, i64* nocapture writeonly %1) {
%3 = add i64 %0, 8
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, 1
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = add i64 %0, 12
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
store i64 %11, i64* %1
br label %12
12: ; preds = %2, %8
%13 = phi i64 [ 1, %8 ], [ 0, %2 ]
ret i64 %13
}
/* Variables and functions */
int /*<<< orphan*/ TestInts();
int /*<<< orphan*/ TestTrim();
int main(int argc, char *argv[]) {
  TestTrim();
  TestInts();
  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)
mov    $0x0,%al
call   1030 <TestTrim@plt>
mov    $0x0,%al
call   1040 <TestInts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <TestTrim@plt>
xor    %eax,%eax
call   1040 <TestInts@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 (...) @TestTrim()
%7 = call i32 (...) @TestInts()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @TestTrim()
%4 = tail call i32 (...) @TestInts()
ret i32 0
}
/* Type definitions */
struct rd_list {
  int dummy;
};

/* Variables and functions */
struct rd_list *rd_list_index(struct rd_list *, int);
int /*<<< orphan*/ rd_list_remove(struct rd_list *);
void rd_list_remove_index(struct rd_list *list, int idx) {
  struct rd_list *cur = rd_list_index(list, idx);
  if (cur) {
    rd_list_remove(list);
  }
}


x86 assembly (clang, -O0):
<rd_list_remove_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <rd_list_index@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1153 <rd_list_remove_index+0x33>
mov    -0x8(%rbp),%rdi
call   1030 <rd_list_remove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd_list_remove_index>:
push   %rbx
mov    %rdi,%rbx
call   1040 <rd_list_index@plt>
test   %rax,%rax
je     1137 <rd_list_remove_index+0x17>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <rd_list_remove@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.rd_list = type { i32 }
define void @rd_list_remove_index(%struct.rd_list* %0, i32 %1) {
%3 = alloca %struct.rd_list*
%4 = alloca i32
%5 = alloca %struct.rd_list*
store %struct.rd_list* %0, %struct.rd_list** %3
store i32 %1, i32* %4
%6 = load %struct.rd_list*, %struct.rd_list** %3
%7 = load i32, i32* %4
%8 = call %struct.rd_list* @rd_list_index(%struct.rd_list* %6, i32 %7)
store %struct.rd_list* %8, %struct.rd_list** %5
%9 = load %struct.rd_list*, %struct.rd_list** %5
%10 = icmp ne %struct.rd_list* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load %struct.rd_list*, %struct.rd_list** %3
%13 = call i32 @rd_list_remove(%struct.rd_list* %12)
br label %14
14: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
%struct.rd_list = type { i32 }
define void @rd_list_remove_index(%struct.rd_list* %0, i32 %1) {
%3 = tail call %struct.rd_list* @rd_list_index(%struct.rd_list* %0, i32 %1)
%4 = icmp eq %struct.rd_list* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @rd_list_remove(%struct.rd_list* %0)
br label %7
7: ; preds = %5, %2
ret void
}
int main(void) {
#pragma acc kernels
  ;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int XSharpGetRegionSize(void *region) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @XSharpGetRegionSize(i8* nocapture readnone %0) {
ret i32 0
}