xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xf9() {
  Assert_real((iscntrl(249) == 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_iscntrl.c",
              1250, ("iscntrl should be 0 for 0xf9"));
}


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

x86 assembly (clang, -O2):
<t_iscntrl_0xf9>:
push   %rax
mov    $0xf9,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4e2,%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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xf9\00"
define void @t_iscntrl_0xf9() {
%1 = call i64 @iscntrl(i32 249)
%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 1250, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xf9\00"
define void @t_iscntrl_0xf9() {
%1 = tail call i64 @iscntrl(i32 249)
%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 1250, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t etna_umin(uint32_t a, uint32_t b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<etna_umin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <etna_umin+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <etna_umin+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<etna_umin>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @etna_umin(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @etna_umin(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
short **realloc_smatrix(short **m, long nrl, long nrh, long ncl, long nch,
                        long nr) {
  return NULL;
}


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

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

LLVM IR (-O0):
define i16** @realloc_smatrix(i16** %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i16**
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i16** %0, i16*** %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
ret i16** null
}

LLVM IR (-O2):
define noalias i16** @realloc_smatrix(i16** nocapture readnone %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
ret i16** null
}
int platform_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @platform_init() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(
      stderr,
      "This program takes 8-bit IQ samples from an rtlsdr dongle as an\n"
      "input and performs fm demodulation, outputting a .wav file at 48KHz.\n"
      "\n"
      "Use: fmdemod <input> <sample rate> <output>\n"
      "\t<input> - path to input file, or \"-\" for stdin\n"
      "\t<output> - path to output file\n"
      "\t<sample rate> - sample rate of the input file.\n"
      "\tMust be a multiple of 4800\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [335 x i8] c"This program takes 8-bit IQ samples from an rtlsdr dongle as an\0Ainput and performs fm demodulation, outputting a .wav file at 48KHz.\0A\0AUse: fmdemod <input> <sample rate> <output>\0A\09<input> - path to input file, or \22-\22 for stdin\0A\09<output> - path to output file\0A\09<sample rate> - sample rate of the input file.\0A\09Must be a multiple of 4800\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([335 x i8], [335 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [335 x i8] c"This program takes 8-bit IQ samples from an rtlsdr dongle as an\0Ainput and performs fm demodulation, outputting a .wav file at 48KHz.\0A\0AUse: fmdemod <input> <sample rate> <output>\0A\09<input> - path to input file, or \22-\22 for stdin\0A\09<output> - path to output file\0A\09<sample rate> - sample rate of the input file.\0A\09Must be a multiple of 4800\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([335 x i8], [335 x i8]* @.str, i64 0, i64 0))
ret void
}
int initramfs_getch(struct riku_devfs_node *self, char *c) {
  *c = 0x0;
  return 0;
}


x86 assembly (clang, -O0):
<initramfs_getch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<initramfs_getch>:
movb   $0x0,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.riku_devfs_node = type opaque
define i32 @initramfs_getch(%struct.riku_devfs_node* %0, i8* %1) {
%3 = alloca %struct.riku_devfs_node*
%4 = alloca i8*
store %struct.riku_devfs_node* %0, %struct.riku_devfs_node** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
store i8 0, i8* %5
ret i32 0
}

LLVM IR (-O2):
%struct.riku_devfs_node = type opaque
define i32 @initramfs_getch(%struct.riku_devfs_node* nocapture readnone %0, i8* nocapture writeonly %1) {
store i8 0, i8* %1
ret i32 0
}
/* Variables and functions */
long long Integer_0_toInteger_2_Boolean(bool value) { return value ? 1 : 0; }


x86 assembly (clang, -O0):
<Integer_0_toInteger_2_Boolean>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<Integer_0_toInteger_2_Boolean>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i64 @Integer_0_toInteger_2_Boolean(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @Integer_0_toInteger_2_Boolean(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void usage(void) {
  die("Usage: xtract system [ | gzip | piggyback > piggy.s]");
}


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

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

LLVM IR (-O0):
@.str = [53 x i8] c"Usage: xtract system [ | gzip | piggyback > piggy.s]\00"
define void @usage() {
%1 = call i32 @die(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"Usage: xtract system [ | gzip | piggyback > piggy.s]\00"
define void @usage() {
%1 = tail call i32 @die(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ c2xx_sniff();
int /*<<< orphan*/ gsmtap_open(char *);
int main(int argc, char **argv) {
  gsmtap_open(argv[1]);
  c2xx_sniff();
  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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <gsmtap_open@plt>
mov    $0x0,%al
call   1030 <c2xx_sniff@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <gsmtap_open@plt>
xor    %eax,%eax
call   1030 <c2xx_sniff@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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @gsmtap_open(i8* %8)
%10 = call i32 (...) @c2xx_sniff()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @gsmtap_open(i8* %4)
%6 = tail call i32 (...) @c2xx_sniff()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SDL_Quit();
int /*<<< orphan*/ clrscr();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ srv_print(char *);
void directory_failed() {
  clrscr();
  srv_print("directory failed");
  SDL_Quit();
  exit(1);
}


x86 assembly (clang, -O0):
<directory_failed>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <clrscr@plt>
lea    0xeae(%rip),%rdi
call   1060 <srv_print@plt>
mov    $0x0,%al
call   1040 <SDL_Quit@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<directory_failed>:
push   %rax
xor    %eax,%eax
call   1030 <clrscr@plt>
lea    0xeb1(%rip),%rdi
call   1060 <srv_print@plt>
xor    %eax,%eax
call   1040 <SDL_Quit@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"directory failed\00"
define void @directory_failed() {
%1 = call i32 (...) @clrscr()
%2 = call i32 @srv_print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @SDL_Quit()
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"directory failed\00"
define void @directory_failed() {
%1 = tail call i32 (...) @clrscr()
%2 = tail call i32 @srv_print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @SDL_Quit()
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ _mon_putc(char const);
void __attribute__((weak)) _mon_puts(const char *s) {
  if (!s)
    return;
  while (*s) {
    _mon_putc(*s);
    s++;
  }
}


x86 assembly (clang, -O0):
<_mon_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <_mon_puts+0x1c>
jmp    115b <_mon_puts+0x4b>
jmp    1131 <_mon_puts+0x21>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <_mon_puts+0x4b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <_mon_putc@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1131 <_mon_puts+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mon_puts>:
push   %rbx
test   %rdi,%rdi
je     1143 <_mon_puts+0x33>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1143 <_mon_puts+0x33>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <_mon_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <_mon_puts+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define weak void @_mon_puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %17
6: ; preds = %1
br label %7
7: ; preds = %11, %6
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8*, i8** %2
%13 = load i8, i8* %12
%14 = call i32 @_mon_putc(i8 signext %13)
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
br label %7
17: ; preds = %5, %7
ret void
}

LLVM IR (-O2):
define weak void @_mon_puts(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %11, %6 ], [ %4, %3 ]
%8 = phi i8* [ %10, %6 ], [ %0, %3 ]
%9 = tail call i32 @_mon_putc(i8 signext %7)
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
ret void
}
double test_logb(double x) { return __builtin_logb(x); }


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

x86 assembly (clang, -O2):
<test_logb>:
jmp    1030 <logb@plt>

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

LLVM IR (-O2):
define double @test_logb(double %0) {
%2 = tail call double @logb(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ free_via_ptr(int *);
scalar_t__ malloc_via_ptr(int);
void malloc_ptr_free_ptr_ok() {
  int *p = (int *)malloc_via_ptr(sizeof(int));
  free_via_ptr(p);
}


x86 assembly (clang, -O0):
<malloc_ptr_free_ptr_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <malloc_via_ptr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <free_via_ptr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_ptr_free_ptr_ok>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc_via_ptr@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <free_via_ptr@plt>

LLVM IR (-O0):
define void @malloc_ptr_free_ptr_ok() {
%1 = alloca i32*
%2 = call i64 @malloc_via_ptr(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = call i32 @free_via_ptr(i32* %4)
ret void
}

LLVM IR (-O2):
define void @malloc_ptr_free_ptr_ok() {
%1 = tail call i64 @malloc_via_ptr(i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @free_via_ptr(i32* %2)
ret void
}
/* Variables and functions */
int retSized(int);
int main(int argc, char **argv) {
  int v = retSized(argc);
  return v;
}


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)
mov    -0x8(%rbp),%edi
call   1030 <retSized@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <retSized@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @retSized(i32 %0)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
double difftime(time_t tim1, time_t tim2) { return (double)(tim1 - tim2); }


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

x86 assembly (clang, -O2):
<difftime>:
sub    %rsi,%rdi
cvtsi2sd %rdi,%xmm0
ret

LLVM IR (-O0):
define double @difftime(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
%8 = sitofp i64 %7 to double
ret double %8
}

LLVM IR (-O2):
define double @difftime(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
%4 = sitofp i64 %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
clear() { printf("\033[H\033[2J"); }


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define i32 @clear() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define i32 @clear() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int LLI2C_output_clock(int);
int LLI2C_output_data(int);
int send_i2c_nack(void) {
  int err;
  err = LLI2C_output_data(1);
  if (err)
    return err;
  err = LLI2C_output_clock(1);
  if (err)
    return err;
  err = LLI2C_output_clock(0);
  if (err)
    return err;
  return 0;
}


x86 assembly (clang, -O0):
<send_i2c_nack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <LLI2C_output_data@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114a <send_i2c_nack+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1192 <send_i2c_nack+0x72>
mov    $0x1,%edi
call   1040 <LLI2C_output_clock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     116c <send_i2c_nack+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1192 <send_i2c_nack+0x72>
xor    %edi,%edi
call   1040 <LLI2C_output_clock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     118b <send_i2c_nack+0x6b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1192 <send_i2c_nack+0x72>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_i2c_nack>:
push   %rax
mov    $0x1,%edi
call   1030 <LLI2C_output_data@plt>
test   %eax,%eax
jne    113d <send_i2c_nack+0x1d>
mov    $0x1,%edi
call   1040 <LLI2C_output_clock@plt>
test   %eax,%eax
je     113f <send_i2c_nack+0x1f>
pop    %rcx
ret
xor    %edi,%edi
pop    %rax
jmp    1040 <LLI2C_output_clock@plt>

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

LLVM IR (-O2):
define i32 @send_i2c_nack() {
%1 = tail call i32 @LLI2C_output_data(i32 1)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i32 @LLI2C_output_clock(i32 1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @LLI2C_output_clock(i32 0)
br label %8
8: ; preds = %6, %3, %0
%9 = phi i32 [ %1, %0 ], [ %4, %3 ], [ %7, %6 ]
ret i32 %9
}
int test_isLess(int x, int y) { return x < y; }


x86 assembly (clang, -O0):
<test_isLess>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isLess>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @test_isLess(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_isLess(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned int AT91F_US_Baudrate(const unsigned int main_clock,
                               const unsigned int baud_rate) {
  unsigned int baud_value = ((main_clock * 10) / (baud_rate * 16));
  if ((baud_value % 10) >= 5)
    baud_value = (baud_value / 10) + 1;
  else
    baud_value /= 10;
  return baud_value;
}


x86 assembly (clang, -O0):
<AT91F_US_Baudrate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0xa,-0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x4,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x5,%edx
jb     1147 <AT91F_US_Baudrate+0x47>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <AT91F_US_Baudrate+0x56>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AT91F_US_Baudrate>:
add    %edi,%edi
lea    (%rdi,%rdi,4),%eax
shl    $0x4,%esi
xor    %edx,%edx
div    %esi
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%eax
cmp    $0x5,%eax
sbb    $0xffffffff,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @AT91F_US_Baudrate(i32 %0, i32 %1) {
%3 = mul i32 %0, 10
%4 = shl i32 %1, 4
%5 = udiv i32 %3, %4
%6 = urem i32 %5, 10
%7 = icmp ugt i32 %6, 4
%8 = udiv i32 %5, 10
%9 = zext i1 %7 to i32
%10 = add nuw nsw i32 %8, %9
ret i32 %10
}
void g_string_assign() {}


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

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

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

LLVM IR (-O2):
define void @g_string_assign() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void function1(int a) {
  printf("You entered %d so function1 was called.\n\n", a);
}


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

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

LLVM IR (-O0):
@.str = [42 x i8] c"You entered %d so function1 was called.\0A\0A\00"
define void @function1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"You entered %d so function1 was called.\0A\0A\00"
define void @function1(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void foo175() {}


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

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

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

LLVM IR (-O2):
define void @foo175() {
ret void
}
/* Variables and functions */
size_t tdb_nextpowof2(size_t val) {
  val--;
  val |= val >> 1;
  val |= val >> 2;
  val |= val >> 4;
  val |= val >> 8;
  val |= val >> 16;
  return val + 1;
}


x86 assembly (clang, -O0):
<tdb_nextpowof2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x4,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tdb_nextpowof2>:
lea    -0x1(%rdi),%rax
mov    %rax,%rcx
shr    %rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x2,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
or     %rax,%rcx
mov    %rcx,%rdx
shr    $0x8,%rdx
or     %rcx,%rdx
mov    %rdx,%rax
shr    $0x10,%rax
or     %rdx,%rax
add    $0x1,%rax
ret

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

LLVM IR (-O2):
define i64 @tdb_nextpowof2(i64 %0) {
%2 = add i64 %0, -1
%3 = lshr i64 %2, 1
%4 = or i64 %3, %2
%5 = lshr i64 %4, 2
%6 = or i64 %5, %4
%7 = lshr i64 %6, 4
%8 = or i64 %7, %6
%9 = lshr i64 %8, 8
%10 = or i64 %9, %8
%11 = lshr i64 %10, 16
%12 = or i64 %11, %10
%13 = add i64 %12, 1
ret i64 %13
}
/* Variables and functions */
int /*<<< orphan*/ ip4();
int /*<<< orphan*/ ip6();
int main(void) {
  ip4();
  ip6();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <ip4@plt>
mov    $0x0,%al
call   1030 <ip6@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <ip4@plt>
xor    %eax,%eax
call   1030 <ip6@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @ip4()
%3 = call i32 (...) @ip6()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ip4()
%2 = tail call i32 (...) @ip6()
ret i32 0
}
void uDMAChannelRequest(unsigned long ulChannelNum) {
  ;
  (*((volatile unsigned long *)(0x400FF014))) = 1 << (ulChannelNum & 0x1f);
}


x86 assembly (clang, -O0):
<uDMAChannelRequest>:
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    $0x400ff014,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @uDMAChannelRequest(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 1074786324 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAChannelRequest(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 1074786324 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gui_bar_item_update(char *);
int gui_bar_item_signal_cb(void *data, const char *signal,
                           const char *type_data, void *signal_data) {
  (void)signal;
  (void)type_data;
  (void)signal_data;
  gui_bar_item_update((char *)data);
  return 0;
}


x86 assembly (clang, -O0):
<gui_bar_item_signal_cb>:
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
call   1030 <gui_bar_item_update@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_bar_item_signal_cb>:
push   %rax
call   1030 <gui_bar_item_update@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gui_bar_item_signal_cb(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** %6
%10 = load i8*, i8** %7
%11 = load i8*, i8** %8
%12 = load i8*, i8** %5
%13 = call i32 @gui_bar_item_update(i8* %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @gui_bar_item_signal_cb(i8* %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
%5 = tail call i32 @gui_bar_item_update(i8* %0)
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
char *str() {
  char *sonuc = malloc(5);
  int a = 15;
  sprintf(sonuc, "%d , %d", a, a);
  return sonuc;
}


x86 assembly (clang, -O0):
<str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeb2(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str>:
push   %rbx
mov    $0x5,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
mov    $0xf,%edx
mov    $0xf,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d , %d\00"
define noalias i8* @str() {
%1 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%2 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 15, i32 15)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int q1a() {
  int a = 0;
  int b = 0;
  int c = -1;
  printf("\n%s\n", "q1a ------");
  c = a++ || ++b;
  printf("%d %d %d\n", a, b, c);
  return 1;
}


x86 assembly (clang, -O0):
<q1a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
lea    0xecc(%rip),%rdi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
jne    116d <q1a+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q1a>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee6(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [11 x i8] c"q1a ------\00"
@.str.2 = [10 x i8] c"%d %d %d\0A\00"
define i32 @q1a() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1, i32 1)
ret i32 1
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int read_multprec_target_system(int decimals) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc(491, &decimals, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<read_multprec_target_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1eb,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_multprec_target_system>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1eb,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @read_multprec_target_system(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %3
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc(i32 491, i32* %2, i32* %6, double* %7, i32 0)
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @read_multprec_target_system(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc(i32 491, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
struct node *delete (struct node **head, struct node *node) {
  return *head;
}


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

x86 assembly (clang, -O2):
<delete>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.node = type opaque
define %struct.node* @delete(%struct.node** %0, %struct.node* %1) {
%3 = alloca %struct.node**
%4 = alloca %struct.node*
store %struct.node** %0, %struct.node*** %3
store %struct.node* %1, %struct.node** %4
%5 = load %struct.node**, %struct.node*** %3
%6 = load %struct.node*, %struct.node** %5
ret %struct.node* %6
}

LLVM IR (-O2):
%struct.node = type opaque
define %struct.node* @delete(%struct.node** nocapture %0, %struct.node* nocapture readnone %1) {
%3 = load %struct.node*, %struct.node** %0
ret %struct.node* %3
}
/* Variables and functions */
float pow(float, int);
float inCubic(float t, float b, float c, float d) {
  return c * pow(t / d, 3) + b;
}


x86 assembly (clang, -O0):
<inCubic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movss  -0x14(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inCubic>:
push   %rax
movss  %xmm2,(%rsp)
movss  %xmm1,0x4(%rsp)
divss  %xmm3,%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @inCubic(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %7
%10 = load float, float* %5
%11 = load float, float* %8
%12 = fdiv float %10, %11
%13 = call float @pow(float %12, i32 3)
%14 = load float, float* %6
%15 = call float @llvm.fmuladd.f32(float %9, float %13, float %14)
ret float %15
}

LLVM IR (-O2):
define float @inCubic(float %0, float %1, float %2, float %3) {
%5 = fdiv float %0, %3
%6 = tail call float @pow(float %5, i32 3)
%7 = tail call float @llvm.fmuladd.f32(float %2, float %6, float %1)
ret float %7
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dmean(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_dmean(N, x, stride);
  printf("mean: %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_dmean@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_dmean@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 = [11 x i8] c"mean: %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_dmean(i32 %6, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 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 = [11 x i8] c"mean: %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_dmean(i32 4, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Variables and functions */
int range_validbuf(const void *buf, size_t len) {
  return (buf && (uintptr_t)buf + len >= (uintptr_t)buf);
}


x86 assembly (clang, -O0):
<range_validbuf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1131 <range_validbuf+0x31>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmp    %rcx,%rax
setae  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_validbuf>:
test   %rdi,%rdi
setne  %al
not    %rdi
cmp    %rsi,%rdi
setae  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @range_validbuf(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = ptrtoint i8* %8 to i64
%10 = load i64, i64* %4
%11 = add i64 %9, %10
%12 = load i8*, i8** %3
%13 = ptrtoint i8* %12 to i64
%14 = icmp uge i64 %11, %13
br label %15
15: ; preds = %7, %2
%16 = phi i1 [ false, %2 ], [ %14, %7 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @range_validbuf(i8* %0, i64 %1) {
%3 = icmp ne i8* %0, null
%4 = ptrtoint i8* %0 to i64
%5 = xor i64 %4, -1
%6 = icmp uge i64 %5, %1
%7 = and i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
void rop3_240_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  *D = T;
}


x86 assembly (clang, -O0):
<rop3_240_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_240_0_0>:
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_240_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = load i8*, i8** %4
store i8 %7, i8* %8
ret void
}

LLVM IR (-O2):
define void @rop3_240_0_0(i8* nocapture writeonly %0, i8 zeroext %1, i8 zeroext %2) {
store i8 %2, i8* %0
ret void
}
/* Variables and functions */
long long getpagesize();
double pages_to_megabytes(int pages) {
  return (((long long)pages) * getpagesize()) / (1024.0 * 1024.0);
}


x86 assembly (clang, -O0):
<pages_to_megabytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpagesize@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
imul   %rcx,%rax
cvtsi2sd %rax,%xmm0
movsd  0xebe(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pages_to_megabytes>:
push   %rbx
movslq %edi,%rbx
xor    %eax,%eax
call   1030 <getpagesize@plt>
imul   %rbx,%rax
cvtsi2sd %rax,%xmm0
mulsd  0xed4(%rip),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @pages_to_megabytes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = call i64 (...) @getpagesize()
%6 = mul nsw i64 %4, %5
%7 = sitofp i64 %6 to double
%8 = fdiv double %7, 0x4130000000000000
ret double %8
}

LLVM IR (-O2):
define double @pages_to_megabytes(i32 %0) {
%2 = sext i32 %0 to i64
%3 = tail call i64 (...) @getpagesize()
%4 = mul nsw i64 %3, %2
%5 = sitofp i64 %4 to double
%6 = fmul double %5, 0x3EB0000000000000
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printbuf(char *buf, int buf_len) {
  int i = buf_len;
  char *p = buf;
  while (i > 0) {
    printf("%c", *p++);
    i--;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1165 <printbuf+0x55>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <printbuf+0x1d>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printbuf>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    1134 <printbuf+0x24>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
nop
movsbl (%rbx),%edi
add    $0x1,%rbx
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1120 <printbuf+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @printbuf(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i8* [ %7, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ %1, %2 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = tail call i32 @putchar(i32 %9)
%11 = add nsw i32 %6, -1
%12 = icmp ugt i32 %6, 1
br i1 %12, label %4, label %13
13: ; preds = %4, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}