xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ getpass(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char *pass;
  pass = (char *)getpass("Enter test message: ");
  printf("You entered: %s\n", pass);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <getpass@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <getpass@plt>
lea    0xee1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter test message: \00"
@.str.1 = [17 x i8] c"You entered: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i64 @getpass(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter test message: \00"
@.str.1 = [17 x i8] c"You entered: %s\0A\00"
define i32 @main() {
%1 = tail call i64 @getpass(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int errno;
int rename(char *, char *);
int rename_file(char *from, char *to) {
  int err;
  err = rename(from, to);
  if (err < 0)
    return -errno;
  return 0;
}


x86 assembly (clang, -O0):
<rename_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <rename@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    114d <rename_file+0x3d>
xor    %eax,%eax
mov    0x2e9d(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <rename_file+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rename_file>:
push   %rax
call   1030 <rename@plt>
mov    0x2ec3(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
sar    $0x1f,%eax
and    %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @rename_file(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @rename(i8* %7, i8* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @errno
%14 = sub nsw i32 0, %13
store i32 %14, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @rename_file(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
%4 = icmp slt i32 %3, 0
%5 = load i32, i32* @errno
%6 = sub nsw i32 0, %5
%7 = select i1 %4, i32 %6, i32 0
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ hl_fatal_error(char *, char *, int);
void fun_var_args() {
  hl_fatal_error("assert",
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/KTXSoftware/"
                 "KodeStudio-linux32/refs/heads/master/resources/app/"
                 "extensions/kha/Kha/Backends/KoreHL/hl/src/std/fun.c",
                 158);
}


x86 assembly (clang, -O0):
<fun_var_args>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee5(%rip),%rsi
mov    $0x9e,%edx
call   1030 <hl_fatal_error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_var_args>:
lea    0xee9(%rip),%rdi
lea    0xee9(%rip),%rsi
mov    $0x9e,%edx
jmp    1030 <hl_fatal_error@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"assert\00"
@.str.1 = [205 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/KTXSoftware/KodeStudio-linux32/refs/heads/master/resources/app/extensions/kha/Kha/Backends/KoreHL/hl/src/std/fun.c\00"
define void @fun_var_args() {
%1 = call i32 @hl_fatal_error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str.1, i64 0, i64 0), i32 158)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"assert\00"
@.str.1 = [205 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/KTXSoftware/KodeStudio-linux32/refs/heads/master/resources/app/extensions/kha/Kha/Backends/KoreHL/hl/src/std/fun.c\00"
define void @fun_var_args() {
%1 = tail call i32 @hl_fatal_error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str.1, i64 0, i64 0), i32 158)
ret void
}
void f1(void *ass_t, int *a, int b) {
  int tmp = *a;
  *a = b;
  b = tmp;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    %edx,(%rsi)
ret

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

LLVM IR (-O2):
define void @f1(i8* nocapture readnone %0, i32* nocapture writeonly %1, i32 %2) {
store i32 %2, i32* %1
ret void
}
int icbrt(a)
int a;
{
  register int bits = 0;
  register unsigned n = a;
  while (n) {
    bits++;
    n >>= 1;
  }
  return icbrt_with_bits(a, bits);
}


x86 assembly (clang, -O0):
<icbrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1149 <icbrt+0x39>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <icbrt+0x18>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1030 <icbrt_with_bits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icbrt>:
xor    %esi,%esi
test   %edi,%edi
je     112c <icbrt+0x1c>
mov    %edi,%eax
mov    %edi,%ecx
nopw   0x0(%rax,%rax,1)
add    $0x1,%esi
shr    %ecx
cmp    $0x1,%eax
mov    %ecx,%eax
ja     1120 <icbrt+0x10>
xor    %eax,%eax
jmp    1030 <icbrt_with_bits@plt>

LLVM IR (-O0):
define i32 @icbrt(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
store i32 %5, i32* %4
br label %6
6: ; preds = %9, %1
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
%12 = load i32, i32* %4
%13 = lshr i32 %12, 1
store i32 %13, i32* %4
br label %6
14: ; preds = %6
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 (i32, i32, ...) bitcast (i32 (...)* @icbrt_with_bits to i32 (i32, i32, ...)*)(i32 %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @icbrt(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i32 [ %6, %3 ], [ 0, %1 ]
%6 = add nuw nsw i32 %5, 1
%7 = lshr i32 %4, 1
%8 = icmp ult i32 %4, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
%11 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @icbrt_with_bits to i32 (i32, i32, ...)*)(i32 %0, i32 %10)
ret i32 %11
}
/* Variables and functions */
double RAND_MAX;
scalar_t__ random();
int /*<<< orphan*/ usleep(unsigned int);
void randomSleep(unsigned low, unsigned high) {
  double rv;
  unsigned us;
  high = high - low;
  rv = ((double)random()) / RAND_MAX;
  us = low + (unsigned)(rv * high);
  usleep(us * 1000);
}


x86 assembly (clang, -O0):
<randomSleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e9c(%rip),%rax
movsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%ecx
cvtsi2sd %rcx,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
imul   $0x3e8,-0x14(%rbp),%edi
call   1040 <usleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomSleep>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
sub    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
mov    0x2eac(%rip),%rax
divsd  (%rax),%xmm0
cvtsi2sd %rbx,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rax
add    %ebp,%eax
imul   $0x3e8,%eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <usleep@plt>

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define void @randomSleep(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub i32 %7, %8
store i32 %9, i32* %4
%10 = call i64 (...) @random()
%11 = sitofp i64 %10 to double
%12 = load double, double* @RAND_MAX
%13 = fdiv double %11, %12
store double %13, double* %5
%14 = load i32, i32* %3
%15 = load double, double* %5
%16 = load i32, i32* %4
%17 = uitofp i32 %16 to double
%18 = fmul double %15, %17
%19 = fptoui double %18 to i32
%20 = add i32 %14, %19
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = mul i32 %21, 1000
%23 = call i32 @usleep(i32 %22)
ret void
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define void @randomSleep(i32 %0, i32 %1) {
%3 = sub i32 %1, %0
%4 = tail call i64 (...) @random()
%5 = sitofp i64 %4 to double
%6 = load double, double* @RAND_MAX
%7 = fdiv double %5, %6
%8 = uitofp i32 %3 to double
%9 = fmul double %7, %8
%10 = fptoui double %9 to i32
%11 = add i32 %10, %0
%12 = mul i32 %11, 1000
%13 = tail call i32 @usleep(i32 %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void Error(char *s) {
  fprintf(stderr, "*** %s\n", s);
  exit(20);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"*** %s\0A\00"
define void @Error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 20)
unreachable
}
/* Variables and functions */
int rand();
int Random(int Max) { return (rand() % Max) + 1; }


x86 assembly (clang, -O0):
<Random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Random>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @Random(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @Random(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *s) {
  fprintf(stderr, "Usage: %s [-p period (ns)]\n", s);
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s [-p period (ns)]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s [-p period (ns)]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int umoven(tcp, addr, len, laddr)
struct tcb *tcp;
long addr;
int len;
char *laddr;
{ return 0; }


x86 assembly (clang, -O0):
<umoven>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tcb = type opaque
define i32 @umoven(%struct.tcb* %0, i64 %1, i32 %2, i8* %3) {
%5 = alloca %struct.tcb*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
store %struct.tcb* %0, %struct.tcb** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
ret i32 0
}

LLVM IR (-O2):
%struct.tcb = type opaque
define i32 @umoven(%struct.tcb* nocapture readnone %0, i64 %1, i32 %2, i8* nocapture readnone %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DrawBMP222(unsigned long, unsigned long, unsigned long,
                              unsigned long, unsigned long, unsigned long);
void drawbmp(unsigned long xs, unsigned long ys, unsigned long xd,
             unsigned long yd, unsigned long w, unsigned long h) {
  DrawBMP222(xs, ys, xd, yd, w, h);
}


x86 assembly (clang, -O0):
<drawbmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <DrawBMP222@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawbmp>:
jmp    1030 <DrawBMP222@plt>

LLVM IR (-O0):
define void @drawbmp(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%13 = load i64, i64* %7
%14 = load i64, i64* %8
%15 = load i64, i64* %9
%16 = load i64, i64* %10
%17 = load i64, i64* %11
%18 = load i64, i64* %12
%19 = call i32 @DrawBMP222(i64 %13, i64 %14, i64 %15, i64 %16, i64 %17, i64 %18)
ret void
}

LLVM IR (-O2):
define void @drawbmp(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = tail call i32 @DrawBMP222(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5)
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, char, size_t);
int /*<<< orphan*/ printf(char *);
void *_dictAlloc(size_t size) {
  void *p = malloc(size);
  if (p == NULL)
    printf("dict malloc error!\n");
  memset(p, '\0', size);
  return p;
}


x86 assembly (clang, -O0):
<_dictAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1160 <_dictAlloc+0x30>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dictAlloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1150 <_dictAlloc+0x20>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"dict malloc error!\0A\00"
define i8* @_dictAlloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %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 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
%12 = load i64, i64* %2
%13 = call i32 @memset(i8* %11, i8 signext 0, i64 %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@str = [19 x i8] c"dict malloc error!\00"
define i8* @_dictAlloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @memset(i8* %2, i8 signext 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ sqlite3_shutdown();
void db_sqlite3_shutdown(void) { sqlite3_shutdown(); }


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

x86 assembly (clang, -O2):
<db_sqlite3_shutdown>:
xor    %eax,%eax
jmp    1030 <sqlite3_shutdown@plt>

LLVM IR (-O0):
define void @db_sqlite3_shutdown() {
%1 = call i32 (...) @sqlite3_shutdown()
ret void
}

LLVM IR (-O2):
define void @db_sqlite3_shutdown() {
%1 = tail call i32 (...) @sqlite3_shutdown()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_pipe2;
int syscall(int /*<<< orphan*/, int *, int);
__attribute__((always_)) int _syscall_pipe2(int pipefd[2], int flags) {
  return syscall(__NR_pipe2, pipefd, flags);
}


x86 assembly (clang, -O0):
<_syscall_pipe2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_syscall_pipe2>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@__NR_pipe2 = global i32 0
define i32 @_syscall_pipe2(i32* %0, i32 %1) {
%3 = load i32, i32* @__NR_pipe2
%4 = tail call i32 @syscall(i32 %3, i32* %0, i32 %1)
ret i32 %4
}
void docall2(void (*pf)()) {
  unsigned char i;
  for (i = 0; i < 2; i++) {
    pf();
  }
}


x86 assembly (clang, -O0):
<docall2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x2,%eax
jge    112f <docall2+0x2f>
mov    $0x0,%al
call   *-0x8(%rbp)
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    1110 <docall2+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<docall2>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   *%rdi
xor    %eax,%eax
mov    %rbx,%rcx
pop    %rbx
jmp    *%rcx

LLVM IR (-O0):
define void @docall2(void (...)* %0) {
%2 = alloca void (...)*
%3 = alloca i8
store void (...)* %0, void (...)** %2
store i8 0, i8* %3
br label %4
4: ; preds = %10, %1
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load void (...)*, void (...)** %2
br label %10
10: ; preds = %8
%11 = load i8, i8* %3
%12 = add i8 %11, 1
store i8 %12, i8* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @docall2(void (...)* nocapture %0) {
tail call void (...) %0()
tail call void (...) %0()
ret void
}
int variable(int argc, char **argv) {
  int val;
  val = 13;
  val += 37;
  return val;
}


x86 assembly (clang, -O0):
<variable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xd,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x25,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @variable(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 13, i32* %5
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 37
store i32 %7, i32* %5
%8 = load i32, i32* %5
ret i32 %8
}

LLVM IR (-O2):
define i32 @variable(i32 %0, i8** nocapture readnone %1) {
ret i32 50
}
/* Variables and functions */
int /*<<< orphan*/ MDFile(char *);
int main(int argc, char **argv) {
  MDFile("./md5c.c");
  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)
lea    0xed3(%rip),%rdi
call   1030 <MDFile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <MDFile@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"./md5c.c\00"
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 @MDFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"./md5c.c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @MDFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
norettype_old(x) int x;
{ return x; }


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

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

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

LLVM IR (-O2):
define i32 @norettype_old(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
struct iovec {
  int dummy;
};
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<readv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readv>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.iovec = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @readv(i32 %0, %struct.iovec* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.iovec*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.iovec* %1, %struct.iovec** %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @readv(i32 %0, %struct.iovec* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ dev_t;

/* Variables and functions */
dev_t find_rootfs(void) {
  dev_t dev = 0;
  return dev;
}


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

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

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

LLVM IR (-O2):
define i32 @find_rootfs() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Fortran2cstring(char *, char *, int, int);
int PAPI_remove_named_event(int, char *);
void PAPIF_REMOVE_NAMED_EVENT(int *EventSet, char *EventName, int *check,
                              int Event_len) {
  char tmp[128];
  Fortran2cstring(tmp, EventName, 128, Event_len);
  *check = PAPI_remove_named_event(*EventSet, tmp);
}


x86 assembly (clang, -O0):
<PAPIF_REMOVE_NAMED_EVENT>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%ecx
mov    $0x80,%edx
call   1040 <Fortran2cstring@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
lea    -0xa0(%rbp),%rsi
call   1030 <PAPI_remove_named_event@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAPIF_REMOVE_NAMED_EVENT>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x80,%edx
call   1040 <Fortran2cstring@plt>
mov    (%rbx),%edi
mov    %r15,%rsi
call   1030 <PAPI_remove_named_event@plt>
mov    %eax,(%r14)
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @PAPIF_REMOVE_NAMED_EVENT(i32* %0, i8* %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca [128 x i8]
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %6
%12 = load i32, i32* %8
%13 = call i32 @Fortran2cstring(i8* %10, i8* %11, i32 128, i32 %12)
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%17 = call i32 @PAPI_remove_named_event(i32 %15, i8* %16)
%18 = load i32*, i32** %7
store i32 %17, i32* %18
ret void
}

LLVM IR (-O2):
define void @PAPIF_REMOVE_NAMED_EVENT(i32* nocapture %0, i8* %1, i32* nocapture writeonly %2, i32 %3) {
%5 = alloca [128 x i8]
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%7 = call i32 @Fortran2cstring(i8* %6, i8* %1, i32 128, i32 %3)
%8 = load i32, i32* %0
%9 = call i32 @PAPI_remove_named_event(i32 %8, i8* %6)
store i32 %9, i32* %2
ret void
}
/* Type definitions */
typedef enum Season2 { ____Placeholder_Season2 } Season2;
typedef enum Season { ____Placeholder_Season } Season;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  enum Season { spring, summer, autumn, winter };
  enum Season s;
  enum Season2 { spring1, summer1 = 3, autumn1, winter1 };
  enum Season2 s2 = winter1;
  for (s = spring; s <= winter; s++) {
    printf("%d", s);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
ja     115b <main+0x4b>
mov    -0x14(%rbp),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
int /*<<< orphan*/ stdout;
void signal_end(int nosig) {
  fprintf(stdout, "\n");
  signal(SIGINT, signal_end);
  return;
}


x86 assembly (clang, -O0):
<signal_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    0x2e80(%rip),%rsi
call   1030 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_end>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    0x2e8a(%rip),%rsi
pop    %rax
jmp    1030 <signal@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c"\0A\00"
@SIGINT = global i32 0
define void @signal_end(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @SIGINT
%6 = call i32 @signal(i32 %5, void (i32)* @signal_end)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c"\0A\00"
@SIGINT = global i32 0
define void @signal_end(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @SIGINT
%5 = tail call i32 @signal(i32 %4, void (i32)* @signal_end)
ret void
}
/* Variables and functions */
char *GetMemory(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *copystring(char *s) {
  char *b;
  b = GetMemory(strlen(s) + 1);
  strcpy(b, s);
  return b;
}


x86 assembly (clang, -O0):
<copystring>:
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 <GetMemory@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):
<copystring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <GetMemory@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* @copystring(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* @GetMemory(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* @copystring(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @GetMemory(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *queryFileByLoc(int, int, int);
void printQuery(FILE *fLogFile, int fdSrc, char *queryField, int row, int col) {
  char *retQuery = queryFileByLoc(fdSrc, row, col);
  fprintf(fLogFile, "%s %s", queryField, retQuery);
  free(retQuery);
  return;
}


x86 assembly (clang, -O0):
<printQuery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1050 <queryFileByLoc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe91(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printQuery>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%edi
mov    %ecx,%esi
mov    %r8d,%edx
call   1050 <queryFileByLoc@plt>
mov    %rax,%rbx
lea    0xeaf(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s %s\00"
define void @printQuery(i32* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %7
%13 = load i32, i32* %9
%14 = load i32, i32* %10
%15 = call i8* @queryFileByLoc(i32 %12, i32 %13, i32 %14)
store i8* %15, i8** %11
%16 = load i32*, i32** %6
%17 = load i8*, i8** %8
%18 = load i8*, i8** %11
%19 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18)
%20 = load i8*, i8** %11
%21 = call i32 @free(i8* %20)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
define void @printQuery(i32* nocapture %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i8* @queryFileByLoc(i32 %1, i32 %3, i32 %4)
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %6)
%8 = tail call i32 @free(i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_tx(char const *);
void log_s(const char *s) { uart_tx(s); }


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

x86 assembly (clang, -O2):
<log_s>:
jmp    1030 <uart_tx@plt>

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

LLVM IR (-O2):
define void @log_s(i8* %0) {
%2 = tail call i32 @uart_tx(i8* %0)
ret void
}
int compare(const void *a, const void *b) {
  return ((int)*(int *)a) - ((int)*(int *)b);
}


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

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

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

LLVM IR (-O2):
define i32 @compare(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 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
__attribute__((weak)) void rgblight_increase_hue(void) {}


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

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

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

LLVM IR (-O2):
define weak void @rgblight_increase_hue() {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t colour_create(uint8_t r, uint8_t g, uint8_t b) {
  return (r << 16) + (g << 8) + (b);
}


x86 assembly (clang, -O0):
<colour_create>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x10,%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<colour_create>:
shl    $0x10,%edi
shl    $0x8,%esi
lea    (%rsi,%rdi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @colour_create(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 = shl i32 %7, 16
%9 = load i32, i32* %5
%10 = shl i32 %9, 8
%11 = add nsw i32 %8, %10
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @colour_create(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 16
%5 = shl i32 %1, 8
%6 = add nsw i32 %5, %4
%7 = add nsw i32 %6, %2
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ copro_pdp11_read16(int /*<<< orphan*/);
uint16_t read16(uint16_t a) { return copro_pdp11_read16(a); }


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

x86 assembly (clang, -O2):
<read16>:
jmp    1030 <copro_pdp11_read16@plt>

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

LLVM IR (-O2):
define i32 @read16(i32 %0) {
%2 = tail call i32 @copro_pdp11_read16(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int creat(char *, int);
int /*<<< orphan*/ remove(char *);
void edit_locker2(int ready) {
  if (ready) {
    int fd = creat("2.locker", 0666);
    close(fd);
  } else
    remove("2.locker");
}


x86 assembly (clang, -O0):
<edit_locker2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1166 <edit_locker2+0x36>
lea    0xeb4(%rip),%rdi
mov    $0x1b6,%esi
call   1050 <creat@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
jmp    1172 <edit_locker2+0x42>
lea    0xe93(%rip),%rdi
call   1030 <remove@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edit_locker2>:
test   %edi,%edi
je     114e <edit_locker2+0x1e>
push   %rax
lea    0xec4(%rip),%rdi
mov    $0x1b6,%esi
call   1050 <creat@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <close@plt>
lea    0xeab(%rip),%rdi
jmp    1030 <remove@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"2.locker\00"
define void @edit_locker2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 @creat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 438)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @close(i32 %8)
br label %12
10: ; preds = %1
%11 = call i32 @remove(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"2.locker\00"
define void @edit_locker2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @creat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 438)
%5 = tail call i32 @close(i32 %4)
br label %8
6: ; preds = %1
%7 = tail call i32 @remove(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dasumpw(int, double *, int);
int main() {
  double x[] = {-1.0, 2.0, -3.0, 4.0, -5.0, 6.0, -7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dasumpw(N, x, stride);
  printf("sumabs: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
movl   $0x4,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
call   1050 <stdlib_strided_dasumpw@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dasumpw@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double -1.000000e+00, double 2.000000e+00, double -3.000000e+00, double 4.000000e+00, double -5.000000e+00, double 6.000000e+00, double -7.000000e+00, double 8.000000e+00]
@.str = [13 x i8] c"sumabs: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x double]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dasumpw(i32 %6, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double -1.000000e+00, double 2.000000e+00, double -3.000000e+00, double 4.000000e+00, double -5.000000e+00, double 6.000000e+00, double -7.000000e+00, double 8.000000e+00]
@.str = [13 x i8] c"sumabs: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dasumpw(i32 4, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Type definitions */
struct can_frame {
  int *data;
};

/* Variables and functions */
int sdo_get_subindex(const struct can_frame *frame) {
  return frame->data[1 + 2];
}


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

x86 assembly (clang, -O2):
<sdo_get_subindex>:
mov    (%rdi),%rax
mov    0xc(%rax),%eax
ret

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

LLVM IR (-O2):
%struct.can_frame = type { i32* }
define i32 @sdo_get_subindex(%struct.can_frame* nocapture %0) {
%2 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %0, i64 0, i32 0
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
ret i32 %5
}
char *EndWord(char *pos) {
  while (!*pos && *pos != ' ' && *pos != '\n') {
    ++pos;
  }
  return pos;
}


x86 assembly (clang, -O0):
<EndWord>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpb   $0x0,(%rcx)
mov    %al,-0x9(%rbp)
jne    113f <EndWord+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     113f <EndWord+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    114f <EndWord+0x4f>
jmp    1160 <EndWord+0x60>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <EndWord+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EndWord>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rax)
lea    0x1(%rax),%rax
je     1110 <EndWord+0x10>
ret

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

LLVM IR (-O2):
define i8* @EndWord(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %2, label %7
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ tool_cancel();
int /*<<< orphan*/ window_land_should_close();
void window_land_close() {
  if (!window_land_should_close())
    tool_cancel();
}


x86 assembly (clang, -O0):
<window_land_close>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <window_land_should_close@plt>
cmp    $0x0,%eax
jne    113b <window_land_close+0x1b>
mov    $0x0,%al
call   1030 <tool_cancel@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<window_land_close>:
push   %rax
xor    %eax,%eax
call   1040 <window_land_should_close@plt>
test   %eax,%eax
je     112e <window_land_close+0xe>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <tool_cancel@plt>

LLVM IR (-O0):
define void @window_land_close() {
%1 = call i32 (...) @window_land_should_close()
%2 = icmp ne i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = call i32 (...) @tool_cancel()
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
define void @window_land_close() {
%1 = tail call i32 (...) @window_land_should_close()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @tool_cancel()
br label %5
5: ; preds = %3, %0
ret void
}