xunge/DecIR huggingface dataset:
/* Type definitions */
typedef unsigned int uint64_t;

/* Variables and functions */
int parse_uint64(unsigned int *, char const *, unsigned int, unsigned int);
int parse_uint(unsigned int *result, const char *str, unsigned int lo,
               unsigned int hi) {
  uint64_t result64;
  int status;
  status = parse_uint64(&result64, str, lo, hi);
  if (status == 0)
    *result = result64;
  return status;
}


x86 assembly (clang, -O0):
<parse_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    -0x1c(%rbp),%rdi
call   1030 <parse_uint64@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    114f <parse_uint+0x3f>
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_uint>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rdi
call   1030 <parse_uint64@plt>
test   %eax,%eax
jne    112c <parse_uint+0x1c>
mov    0xc(%rsp),%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @parse_uint(i32* nocapture writeonly %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = call i32 @parse_uint64(i32* %5, i8* %1, i32 %2, i32 %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = load i32, i32* %5
store i32 %10, i32* %0
br label %11
11: ; preds = %9, %4
ret i32 %7
}
void test_argv2Ints(int argc, char **argv) {
  printf("Running %s...", __FUNCTION__);
}


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

x86 assembly (clang, -O2):
<test_argv2Ints>:
lea    0xee9(%rip),%rdi
lea    0xef0(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Running %s...\00"
@__FUNCTION__.test_argv2Ints = [15 x i8] c"test_argv2Ints\00"
define void @test_argv2Ints(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.test_argv2Ints, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Running %s...\00"
@__FUNCTION__.test_argv2Ints = [15 x i8] c"test_argv2Ints\00"
define void @test_argv2Ints(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.test_argv2Ints, i64 0, i64 0))
ret void
}
int test_imm_DBuint8_mem(unsigned char *val) {
  return ((*val) & (-0xDB << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DBuint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffff25,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_DBuint8_mem>:
testb  $0x25,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_DBuint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -219
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_DBuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 37
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("Usage: generic_buffer [options]...\n"
         "Capture, convert and output data from IIO device buffer\n"
         "  -c <n>     Do n conversions\n"
         "  -e         Disable wait for event (new data)\n"
         "  -g         Use trigger-less mode\n"
         "  -l <n>     Set buffer length to n samples\n"
         "  -n <name>  Set device name (mandatory)\n"
         "  -t <name>  Set trigger name\n"
         "  -w <n>     Set delay between reads in us (event-less mode)\n");
}


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

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

LLVM IR (-O0):
@.str = [380 x i8] c"Usage: generic_buffer [options]...\0ACapture, convert and output data from IIO device buffer\0A -c <n> Do n conversions\0A -e Disable wait for event (new data)\0A -g Use trigger-less mode\0A -l <n> Set buffer length to n samples\0A -n <name> Set device name (mandatory)\0A -t <name> Set trigger name\0A -w <n> Set delay between reads in us (event-less mode)\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([380 x i8], [380 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [379 x i8] c"Usage: generic_buffer [options]...\0ACapture, convert and output data from IIO device buffer\0A -c <n> Do n conversions\0A -e Disable wait for event (new data)\0A -g Use trigger-less mode\0A -l <n> Set buffer length to n samples\0A -n <name> Set device name (mandatory)\0A -t <name> Set trigger name\0A -w <n> Set delay between reads in us (event-less mode)\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([379 x i8], [379 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned int big2littleui(unsigned int);
scalar_t__ isLittleEndian();
unsigned int big2hostui(unsigned int num) {
  if (isLittleEndian())
    return big2littleui(num);
  return num;
}


x86 assembly (clang, -O0):
<big2hostui>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <isLittleEndian@plt>
cmp    $0x0,%rax
je     114c <big2hostui+0x2c>
mov    -0x8(%rbp),%edi
call   1040 <big2littleui@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <big2hostui+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big2hostui>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <isLittleEndian@plt>
test   %rax,%rax
je     1137 <big2hostui+0x17>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <big2littleui@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @big2hostui(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i64 (...) @isLittleEndian()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = call i32 @big2littleui(i32 %7)
store i32 %8, i32* %2
br label %11
9: ; preds = %1
%10 = load i32, i32* %3
store i32 %10, i32* %2
br label %11
11: ; preds = %9, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @big2hostui(i32 %0) {
%2 = tail call i64 (...) @isLittleEndian()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @big2littleui(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
long tcp_seek_null(void *handle, long offset, int whence) { return -1; }


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

x86 assembly (clang, -O2):
<tcp_seek_null>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @tcp_seek_null(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
ret i64 -1
}

LLVM IR (-O2):
define i64 @tcp_seek_null(i8* nocapture readnone %0, i64 %1, i32 %2) {
ret i64 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_storeu_si128(int /*<<< orphan*/ *, int /*<<< orphan*/);
void store(const void *p, __m128i x) { _mm_storeu_si128((__m128i *)p, x); }


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

x86 assembly (clang, -O2):
<store>:
jmp    1030 <_mm_storeu_si128@plt>

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

LLVM IR (-O2):
define void @store(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @_mm_storeu_si128(i32* %3, i32 %1)
ret void
}
unsigned long long root(unsigned long long *setArr, unsigned long long A) {
  while (setArr[A] != A) {
    setArr[A] = setArr[setArr[A]];
    A = setArr[A];
  }
  return A;
}


x86 assembly (clang, -O0):
<root>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x10(%rbp),%rax
je     1157 <root+0x57>
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
jmp    110c <root+0xc>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<root>:
mov    %rsi,%rax
mov    (%rdi,%rsi,8),%rcx
cmp    %rsi,%rcx
je     1124 <root+0x24>
lea    (%rdi,%rax,8),%rdx
mov    (%rdi,%rcx,8),%rax
mov    %rax,(%rdx)
lea    (%rdi,%rax,8),%rdx
mov    (%rdi,%rax,8),%rcx
cmp    %rax,%rcx
jne    1110 <root+0x10>
ret

LLVM IR (-O0):
define i64 @root(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
br label %5
5: ; preds = %12, %2
%6 = load i64*, i64** %3
%7 = load i64, i64* %4
%8 = getelementptr inbounds i64, i64* %6, i64 %7
%9 = load i64, i64* %8
%10 = load i64, i64* %4
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %5
%13 = load i64*, i64** %3
%14 = load i64*, i64** %3
%15 = load i64, i64* %4
%16 = getelementptr inbounds i64, i64* %14, i64 %15
%17 = load i64, i64* %16
%18 = getelementptr inbounds i64, i64* %13, i64 %17
%19 = load i64, i64* %18
%20 = load i64*, i64** %3
%21 = load i64, i64* %4
%22 = getelementptr inbounds i64, i64* %20, i64 %21
store i64 %19, i64* %22
%23 = load i64*, i64** %3
%24 = load i64, i64* %4
%25 = getelementptr inbounds i64, i64* %23, i64 %24
%26 = load i64, i64* %25
store i64 %26, i64* %4
br label %5
27: ; preds = %5
%28 = load i64, i64* %4
ret i64 %28
}

LLVM IR (-O2):
define i64 @root(i64* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i64, i64* %0, i64 %1
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, %1
br i1 %5, label %14, label %6
6: ; preds = %2, %6
%7 = phi i64 [ %12, %6 ], [ %4, %2 ]
%8 = phi i64* [ %11, %6 ], [ %3, %2 ]
%9 = getelementptr inbounds i64, i64* %0, i64 %7
%10 = load i64, i64* %9
store i64 %10, i64* %8
%11 = getelementptr inbounds i64, i64* %0, i64 %10
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, %10
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = phi i64 [ %1, %2 ], [ %10, %6 ]
ret i64 %15
}
/* Variables and functions */
int PMPI_Buffer_detach(void *, int *);
int MPI_Buffer_detach(void *bufferptr, int *size) {
  ;
  return PMPI_Buffer_detach(bufferptr, size);
}


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

x86 assembly (clang, -O2):
<MPI_Buffer_detach>:
jmp    1030 <PMPI_Buffer_detach@plt>

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

LLVM IR (-O2):
define i32 @MPI_Buffer_detach(i8* %0, i32* %1) {
%3 = tail call i32 @PMPI_Buffer_detach(i8* %0, i32* %1)
ret i32 %3
}
void _CcOS_dummy(void) {}


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

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

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

LLVM IR (-O2):
define void @_CcOS_dummy() {
ret void
}
long syscall0(int op) {
  long ret;
  asm volatile("int $0xff"
               : "=a"(ret)
               : "0"(op)
               : "cc", "ebx", "edi", "esi", "memory");
  return ret;
}


x86 assembly (clang, -O0):
<syscall0>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
int    $0xff
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall0>:
push   %rbx
mov    %edi,%eax
int    $0xff
pop    %rbx
ret

LLVM IR (-O0):
define i64 @syscall0(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = call i64 asm sideeffect "int $$0xff", "={ax},0,~{cc},~{ebx},~{edi},~{esi},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
ret i64 %7
}

LLVM IR (-O2):
define i64 @syscall0(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i64 asm sideeffect "int $$0xff", "={ax},0,~{cc},~{ebx},~{edi},~{esi},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %2)
ret i64 %3
}
void interrupt_systick(void) {
  while (1) {
  }
}


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

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

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

LLVM IR (-O2):
define void @interrupt_systick() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ SetUpMemBanks();
__attribute__((no)) void MemOverlay_ChangeNtfy(void) { SetUpMemBanks(); }


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

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

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

LLVM IR (-O2):
define void @MemOverlay_ChangeNtfy() {
%1 = tail call i32 (...) @SetUpMemBanks()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ lv;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int read_uint32(FILE *fp, uint32_t *ptr) {
  uint32_t lv;
  if (fread(&lv, sizeof(lv), 1, fp) != 1) {
    return 1;
  }
  *ptr = lv;
  return 0;
}


x86 assembly (clang, -O0):
<read_uint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x1c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     114c <read_uint32+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    115c <read_uint32+0x4c>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_uint32>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x1,%ebp
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    113f <read_uint32+0x2f>
mov    0x4(%rsp),%eax
mov    %eax,(%rbx)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_uint32(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
%7 = load i32*, i32** %4
%8 = call i32 @fread(i32* %6, i32 4, i32 1, i32* %7)
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %14
11: ; preds = %2
%12 = load i32, i32* %6
%13 = load i32*, i32** %5
store i32 %12, i32* %13
store i32 0, i32* %3
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @read_uint32(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @fread(i32* %3, i32 4, i32 1, i32* %0)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* %3
store i32 %8, i32* %1
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ 0, %7 ], [ 1, %2 ]
ret i32 %10
}
void openInput() {}


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

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

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

LLVM IR (-O2):
define void @openInput() {
ret void
}
void not_annotated_c_1_2() {}


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

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

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

LLVM IR (-O2):
define void @not_annotated_c_1_2() {
ret void
}
void GUI_SpriteDraw() {}


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

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

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

LLVM IR (-O2):
define void @GUI_SpriteDraw() {
ret void
}
/* Variables and functions */
int mystrlen(char const *);
scalar_t__ mystrncmp(char const *, char const *, int);
int __attribute__((always_)) equal_str(const char *s1, const char *s2) {
  int min_len = (mystrlen(s1) < mystrlen(s2) ? mystrlen(s1) : mystrlen(s2));
  return (mystrncmp(s1, s2, min_len) == 0);
}


x86 assembly (clang, -O0):
<equal_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mystrlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <mystrlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1163 <equal_str+0x43>
mov    -0x8(%rbp),%rdi
call   1030 <mystrlen@plt>
mov    %eax,-0x1c(%rbp)
jmp    116f <equal_str+0x4f>
mov    -0x10(%rbp),%rdi
call   1030 <mystrlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <mystrncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_str>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <mystrlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <mystrlen@plt>
cmp    %eax,%ebp
mov    %r14,%rdi
cmovl  %rbx,%rdi
call   1030 <mystrlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <mystrncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @equal_str(i8* %0, i8* %1) {
%3 = tail call i32 @mystrlen(i8* %0)
%4 = tail call i32 @mystrlen(i8* %1)
%5 = icmp slt i32 %3, %4
%6 = select i1 %5, i8* %0, i8* %1
%7 = tail call i32 @mystrlen(i8* %6)
%8 = tail call i64 @mystrncmp(i8* %0, i8* %1, i32 %7)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("hello, \cworld!\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"hello, cworld!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"hello, cworld!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int extrafunction(void) {
  puts("Hello world!");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
define i32 @extrafunction() {
%1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
define i32 @extrafunction() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ is_sep(char const);
char *skip_sep(const char *s, int sz) {
  while (sz > 0 && is_sep(*s)) {
    s++;
    sz--;
  }
  return (char *)s;
}


x86 assembly (clang, -O0):
<skip_sep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jle    1144 <skip_sep+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_sep@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1154 <skip_sep+0x44>
jmp    116e <skip_sep+0x5e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <skip_sep+0xf>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_sep>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %esi,%esi
jle    1139 <skip_sep+0x29>
mov    %esi,%ebp
add    $0x1,%ebp
nop
movsbl (%rbx),%edi
call   1030 <is_sep@plt>
test   %rax,%rax
je     1139 <skip_sep+0x29>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     1120 <skip_sep+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @skip_sep(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2, %10
%5 = phi i32 [ %12, %10 ], [ %1, %2 ]
%6 = phi i8* [ %11, %10 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = tail call i64 @is_sep(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = add nsw i32 %5, -1
%13 = icmp sgt i32 %5, 1
br i1 %13, label %4, label %14
14: ; preds = %4, %10, %2
%15 = phi i8* [ %0, %2 ], [ %11, %10 ], [ %6, %4 ]
ret i8* %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, int);
void print(char *name, char *type, int offset) {
  printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
         offset);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"#define %s(task) *((%s *) &(((char *) (task))[%d]))\0A\00"
define void @print(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"#define %s(task) *((%s *) &(((char *) (task))[%d]))\0A\00"
define void @print(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
char const *dirname(char *);
int /*<<< orphan*/ free(char *);
char *strdup(char const *);
char *fp_dir(const char *path) {
  char *p = strdup(path), *dir = NULL;
  if (!p) {
    return NULL;
  }
  dir = strdup(dirname(p));
  free(p);
  return dir;
}


x86 assembly (clang, -O0):
<fp_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1169 <fp_dir+0x39>
movq   $0x0,-0x8(%rbp)
jmp    118f <fp_dir+0x5f>
mov    -0x18(%rbp),%rdi
call   1040 <dirname@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp_dir>:
push   %r14
push   %rbx
push   %rax
call   1050 <strdup@plt>
test   %rax,%rax
je     1161 <fp_dir+0x31>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <dirname@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
jmp    1163 <fp_dir+0x33>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i8* @fp_dir(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i8* @dirname(i8* %2)
%6 = tail call i8* @strdup(i8* %5)
%7 = tail call i32 @free(i8* %2)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %6, %4 ], [ null, %1 ]
ret i8* %9
}
unsigned int sumDigits(unsigned int num) {
  if (num == 0)
    return 0;
  return (num % 10) + sumDigits(num / 10);
}


x86 assembly (clang, -O0):
<sumDigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <sumDigits+0x21>
movl   $0x0,-0x4(%rbp)
jmp    115b <sumDigits+0x4b>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
call   1030 <sumDigits@plt>
mov    -0xc(%rbp),%edx
add    %eax,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumDigits>:
xor    %eax,%eax
test   %edi,%edi
je     112d <sumDigits+0x2d>
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
add    %ecx,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <sumDigits+0x10>
ret

LLVM IR (-O0):
define i32 @sumDigits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %14
7: ; preds = %1
%8 = load i32, i32* %3
%9 = urem i32 %8, 10
%10 = load i32, i32* %3
%11 = udiv i32 %10, 10
%12 = call i32 @sumDigits(i32 %11)
%13 = add i32 %9, %12
store i32 %13, i32* %2
br label %14
14: ; preds = %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @sumDigits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = urem i32 %4, 10
%7 = udiv i32 %4, 10
%8 = add i32 %6, %5
%9 = icmp ult i32 %4, 10
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ ceil(double const);
void ceil_w_d(const double *source, int32_t *dest) {
  *dest = (int32_t)ceil(*source);
}


x86 assembly (clang, -O0):
<ceil_w_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <ceil@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_w_d>:
push   %rbx
mov    %rsi,%rbx
movsd  (%rdi),%xmm0
call   1030 <ceil@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @ceil_w_d(double* %0, i64* %1) {
%3 = alloca double*
%4 = alloca i64*
store double* %0, double** %3
store i64* %1, i64** %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = call i64 @ceil(double %6)
%8 = load i64*, i64** %4
store i64 %7, i64* %8
ret void
}

LLVM IR (-O2):
define void @ceil_w_d(double* nocapture %0, i64* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = tail call i64 @ceil(double %3)
store i64 %4, i64* %1
ret void
}
/* Variables and functions */
void *calloc(int, unsigned int);
int /*<<< orphan*/ std_err(char *);
void *alloc_c(unsigned numb) {
  void *p;
  if (!numb)
    ++numb;
  if (!(p = calloc(1, numb)))
    std_err("failed memory allocate");
  return (p);
}


x86 assembly (clang, -O0):
<alloc_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113e <alloc_c+0x1e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1165 <alloc_c+0x45>
lea    0xea0(%rip),%rdi
call   1040 <std_err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_c>:
push   %rbx
mov    %edi,%esi
test   %edi,%edi
mov    $0x1,%eax
cmove  %eax,%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <alloc_c+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <std_err@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [23 x i8] c"failed memory allocate\00"
define noalias i8* @alloc_c(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 1, i32 %0
%4 = tail call i8* @calloc(i32 1, i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @std_err(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret i8* %4
}
void pool_unmap(struct _WsbmBufStorage *buf) { ; }


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

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

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

LLVM IR (-O2):
%struct._WsbmBufStorage = type opaque
define void @pool_unmap(%struct._WsbmBufStorage* nocapture %0) {
ret void
}
/* Variables and functions */
int call(int, int /*<<< orphan*/);
int /*<<< orphan*/ f();
int rest(int list) { return call(list, f()); }


x86 assembly (clang, -O0):
<rest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <call@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rest>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <f@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <call@plt>

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

LLVM IR (-O2):
define i32 @rest(i32 %0) {
%2 = tail call i32 (...) @f()
%3 = tail call i32 @call(i32 %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
double ldexpf(double, int);
double ldexp(double value, int power) { return ldexpf(value, power); }


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

x86 assembly (clang, -O2):
<ldexp>:
jmp    1030 <ldexpf@plt>

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

LLVM IR (-O2):
define double @ldexp(double %0, i32 %1) {
%3 = tail call double @ldexpf(double %0, i32 %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int parse_exit(char **tokens, int n_tokens) { exit(0); }


x86 assembly (clang, -O0):
<parse_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define i32 @parse_exit(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @parse_exit(i8** nocapture readnone %0, i32 %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
unsigned int a2nibble(unsigned char nibble) {
  nibble = nibble | 0x20;
  if (nibble > '9')
    return (nibble - 'a' + 10);
  return (nibble - '0');
}


x86 assembly (clang, -O0):
<a2nibble>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
or     $0x20,%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jle    1133 <a2nibble+0x33>
movzbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <a2nibble+0x3d>
movzbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a2nibble>:
or     $0x20,%dil
movzbl %dil,%ecx
lea    -0x30(%rcx),%edx
lea    -0x57(%rcx),%eax
cmp    $0x3a,%cl
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define i32 @a2nibble(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = or i32 %5, 32
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp sgt i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = sub nsw i32 %13, 97
%15 = add nsw i32 %14, 10
store i32 %15, i32* %2
br label %20
16: ; preds = %1
%17 = load i8, i8* %3
%18 = zext i8 %17 to i32
%19 = sub nsw i32 %18, 48
store i32 %19, i32* %2
br label %20
20: ; preds = %16, %11
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @a2nibble(i8 zeroext %0) {
%2 = or i8 %0, 32
%3 = zext i8 %2 to i32
%4 = icmp ugt i8 %2, 57
%5 = select i1 %4, i32 -87, i32 -48
%6 = add nsw i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int d86f_track_flags(int);
int d86f_is_mfm(int drive) { return (d86f_track_flags(drive) & 8) ? 1 : 0; }


x86 assembly (clang, -O0):
<d86f_is_mfm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <d86f_track_flags@plt>
mov    %eax,%edx
and    $0x8,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d86f_is_mfm>:
push   %rax
call   1030 <d86f_track_flags@plt>
shr    $0x3,%eax
and    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @d86f_is_mfm(i32 %0) {
%2 = tail call i32 @d86f_track_flags(i32 %0)
%3 = lshr i32 %2, 3
%4 = and i32 %3, 1
ret i32 %4
}
/* Type definitions */
struct atom {
  int dummy;
};

/* Variables and functions */
scalar_t__ Mem_calloc(int, int, char *, int);
struct atom **atom_new() {
  struct atom **buckets;
  buckets = (struct atom **)Mem_calloc(
      (2048), (sizeof(*buckets)),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/ajholanda/guv/refs/heads/master/atom.c",
      79);
  return buckets;
}


x86 assembly (clang, -O0):
<atom_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x800,%edi
mov    $0x8,%esi
lea    0xed7(%rip),%rdx
mov    $0x4f,%ecx
call   1030 <Mem_calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atom_new>:
lea    0xee9(%rip),%rdx
mov    $0x800,%edi
mov    $0x8,%esi
mov    $0x4f,%ecx
jmp    1030 <Mem_calloc@plt>

LLVM IR (-O0):
%struct.atom = type { i32 }
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ajholanda/guv/refs/heads/master/atom.c\00"
define %struct.atom** @atom_new() {
%1 = alloca %struct.atom**
%2 = call i64 @Mem_calloc(i32 2048, i32 8, i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 79)
%3 = inttoptr i64 %2 to %struct.atom**
store %struct.atom** %3, %struct.atom*** %1
%4 = load %struct.atom**, %struct.atom*** %1
ret %struct.atom** %4
}

LLVM IR (-O2):
%struct.atom = type { i32 }
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ajholanda/guv/refs/heads/master/atom.c\00"
define %struct.atom** @atom_new() {
%1 = tail call i64 @Mem_calloc(i32 2048, i32 8, i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 79)
%2 = inttoptr i64 %1 to %struct.atom**
ret %struct.atom** %2
}
char *locale_charset(void) { return "UTF-8"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"UTF-8\00"
define i8* @locale_charset() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"UTF-8\00"
define i8* @locale_charset() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int c3(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @c3() {
ret i32 3
}

LLVM IR (-O2):
define i32 @c3() {
ret i32 3
}
int RoundUpToMultiple(int value, int factor) {
  if (value < 1) {
    return value + ((-value) % factor);
  } else {
    return value + factor - 1 - ((value - 1) % factor);
  }
}


x86 assembly (clang, -O0):
<RoundUpToMultiple>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    1130 <RoundUpToMultiple+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x4(%rbp)
jmp    114e <RoundUpToMultiple+0x4e>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0xc(%rbp)
mov    -0x14(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RoundUpToMultiple>:
test   %edi,%edi
jle    1118 <RoundUpToMultiple+0x18>
lea    (%rsi,%rdi,1),%ecx
add    $0xffffffff,%edi
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%edi
not    %edi
add    %ecx,%edi
mov    %edi,%eax
ret
mov    %edi,%eax
cltd
idiv   %esi
sub    %edx,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @RoundUpToMultiple(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = srem i32 %0, %1
%6 = sub nsw i32 %0, %5
br label %13
7: ; preds = %2
%8 = add nsw i32 %1, %0
%9 = add nsw i32 %0, -1
%10 = srem i32 %9, %1
%11 = xor i32 %10, -1
%12 = add i32 %8, %11
br label %13
13: ; preds = %7, %4
%14 = phi i32 [ %6, %4 ], [ %12, %7 ]
ret i32 %14
}
int main() {
  int a = 30;
  int b = 9 - a / 5;
  int c;
  c = b * 4;
  if (c > 10) {
    c = c - 10;
  }
  return c * (60 / a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1e,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x9,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jle    1145 <main+0x45>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x3c,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 30, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 5
%7 = sub nsw i32 9, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 4
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 10
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 10
store i32 %14, i32* %4
br label %15
15: ; preds = %12, %0
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = sdiv i32 60, %17
%19 = mul nsw i32 %16, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
char *malloc(int);
int /*<<< orphan*/ *popen(char *, char *);
char *get_machine_type() {
  FILE *strm =
      popen("$REGIMENTD/apps/reuters/runtime/chez_machine_type_threaded", "r");
  char *format = malloc(100);
  fscanf(strm, "%s\n", format);
  return format;
}


x86 assembly (clang, -O0):
<get_machine_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xef5(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x8(%rbp)
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_machine_type>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
lea    0xef9(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,%r14
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xedf(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1030 <fscanf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [59 x i8] c"$REGIMENTD/apps/reuters/runtime/chez_machine_type_threaded\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i8* @get_machine_type() {
%1 = alloca i32*
%2 = alloca i8*
%3 = call i32* @popen(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = call i8* @malloc(i32 100)
store i8* %4, i8** %2
%5 = load i32*, i32** %1
%6 = load i8*, i8** %2
%7 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@.str = [59 x i8] c"$REGIMENTD/apps/reuters/runtime/chez_machine_type_threaded\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i8* @get_machine_type() {
%1 = tail call i32* @popen(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%3 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i8* %2
}