xunge/DecIR huggingface dataset:
/* Type definitions */
struct statement {
  int dummy;
};

/* Variables and functions */
struct statement *stmt_void();
struct statement *stmt_label(struct statement *stmt, const char *label) {
  return stmt_void();
}


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

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

LLVM IR (-O0):
%struct.statement = type { i32 }
define %struct.statement* @stmt_label(%struct.statement* %0, i8* %1) {
%3 = alloca %struct.statement*
%4 = alloca i8*
store %struct.statement* %0, %struct.statement** %3
store i8* %1, i8** %4
%5 = call %struct.statement* (...) @stmt_void()
ret %struct.statement* %5
}

LLVM IR (-O2):
%struct.statement = type { i32 }
define %struct.statement* @stmt_label(%struct.statement* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call %struct.statement* (...) @stmt_void()
ret %struct.statement* %3
}
/* Variables and functions */
int /*<<< orphan*/ lt_fatal(char *, int, char *);
scalar_t__ malloc(size_t);
void *xmalloc(size_t num) {
  void *p = (void *)malloc(num);
  if (!p)
    lt_fatal("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/sim9108/SDKS/refs/heads/master/"
             "LibFontConfig/src/fc-query/.libs/lt-fc-query.c",
             311, "memory exhausted");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115c <xmalloc+0x3c>
lea    0xeb5(%rip),%rdi
mov    $0x137,%esi
lea    0xf51(%rip),%rdx
call   1030 <lt_fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1146 <xmalloc+0x26>
lea    0xecb(%rip),%rdi
lea    0xf6c(%rip),%rdx
mov    $0x137,%esi
call   1030 <lt_fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

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/sim9108/SDKS/refs/heads/master/LibFontConfig/src/fc-query/.libs/lt-fc-query.c\00"
@.str.1 = [17 x i8] c"memory exhausted\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @malloc(i64 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 @lt_fatal(i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 311, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i8*, i8** %3
ret i8* %12
}

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/sim9108/SDKS/refs/heads/master/LibFontConfig/src/fc-query/.libs/lt-fc-query.c\00"
@.str.1 = [17 x i8] c"memory exhausted\00"
define i8* @xmalloc(i64 %0) {
%2 = tail call i64 @malloc(i64 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @lt_fatal(i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 311, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = inttoptr i64 %2 to i8*
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int _ar_error(char const *message, int ret) {
  fputs("ar"
        ": ",
        stderr);
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_ar_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ar_error>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"ar: \00"
@stderr = global i32 0
define i32 @_ar_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @perror(i8* %7)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"ar: \00"
@stderr = global i32 0
define i32 @_ar_error(i8* nocapture %0, i32 returned %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @perror(i8* %0)
ret i32 %1
}
/* Variables and functions */
int bob_mcbob();
int main(int argc, char **argv) { return bob_mcbob(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <bob_mcbob@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @bob_mcbob()
ret i32 %3
}
void INT_Excep_PERIB_INTB199(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB199() {
ret void
}
/* Type definitions */
typedef size_t ssize_t;

/* Variables and functions */
int errno;
int /*<<< orphan*/ printf(char *, int);
size_t send(int, void *, size_t, int);
int send_data(int socket, void *buffer, size_t size, int flags) {
  ssize_t rc = send(socket, buffer, size, flags);
  if (rc < 0) {
    printf("send failed: %d\n", errno);
    return -1;
  }
  if (rc != size)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<send_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <send@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jae    1179 <send_data+0x59>
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    119a <send_data+0x7a>
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1193 <send_data+0x73>
movl   $0x1,-0x4(%rbp)
jmp    119a <send_data+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_data>:
push   %rbx
mov    %rdx,%rbx
call   1030 <send@plt>
xor    %ecx,%ecx
cmp    %rbx,%rax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"send failed: %d\0A\00"
@errno = global i32 0
define i32 @send_data(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i64
store i32 %0, i32* %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i32 %3, i32* %9
%11 = load i32, i32* %6
%12 = load i8*, i8** %7
%13 = load i64, i64* %8
%14 = load i32, i32* %9
%15 = call i64 @send(i32 %11, i8* %12, i64 %13, i32 %14)
store i64 %15, i64* %10
%16 = load i64, i64* %10
%17 = icmp ult i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %4
%19 = load i32, i32* @errno
%20 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %19)
store i32 -1, i32* %5
br label %27
21: ; preds = %4
%22 = load i64, i64* %10
%23 = load i64, i64* %8
%24 = icmp ne i64 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 1, i32* %5
br label %27
26: ; preds = %21
store i32 0, i32* %5
br label %27
27: ; preds = %26, %25, %18
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @send_data(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i64 @send(i32 %0, i8* %1, i64 %2, i32 %3)
%6 = icmp ne i64 %5, %2
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ _IO(int, int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int *);
void RDA_pin_to_low(int fd) {
  int bt_on_off = 0;
  ioctl(fd, _IO(234, 102), &bt_on_off);
}


x86 assembly (clang, -O0):
<RDA_pin_to_low>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0xea,%edi
mov    $0x66,%esi
call   1030 <_IO@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
lea    -0x8(%rbp),%rdx
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RDA_pin_to_low>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0x0,0xc(%rsp)
mov    $0xea,%edi
mov    $0x66,%esi
call   1030 <_IO@plt>
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @RDA_pin_to_low(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @_IO(i32 234, i32 102)
%6 = call i32 @ioctl(i32 %4, i32 %5, i32* %3)
ret void
}

LLVM IR (-O2):
define void @RDA_pin_to_low(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i32 @_IO(i32 234, i32 102)
%5 = call i32 @ioctl(i32 %0, i32 %4, i32* %2)
ret void
}
void update_innovation_gyro(float gyro_pitch, float gyro_roll, float pitch_rate,
                            float roll_rate, float *out_5217011749530427604) {
  out_5217011749530427604[0] = gyro_roll - roll_rate;
  out_5217011749530427604[1] = gyro_pitch - pitch_rate;
}


x86 assembly (clang, -O0):
<update_innovation_gyro>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_innovation_gyro>:
subss  %xmm3,%xmm1
movss  %xmm1,(%rdi)
subss  %xmm2,%xmm0
movss  %xmm0,0x4(%rdi)
ret

LLVM IR (-O0):
define void @update_innovation_gyro(float %0, float %1, float %2, float %3, float* %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float*
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float* %4, float** %10
%11 = load float, float* %7
%12 = load float, float* %9
%13 = fsub float %11, %12
%14 = load float*, float** %10
%15 = getelementptr inbounds float, float* %14, i64 0
store float %13, float* %15
%16 = load float, float* %6
%17 = load float, float* %8
%18 = fsub float %16, %17
%19 = load float*, float** %10
%20 = getelementptr inbounds float, float* %19, i64 1
store float %18, float* %20
ret void
}

LLVM IR (-O2):
define void @update_innovation_gyro(float %0, float %1, float %2, float %3, float* nocapture writeonly %4) {
%6 = fsub float %1, %3
store float %6, float* %4
%7 = fsub float %0, %2
%8 = getelementptr inbounds float, float* %4, i64 1
store float %7, float* %8
ret void
}
/* Type definitions */
struct _musstream {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct _musstream *);
int mem_close(struct _musstream *this) {
  if (this) {
    free(this);
  }
  return 0;
}


x86 assembly (clang, -O0):
<mem_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <mem_close+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_close>:
test   %rdi,%rdi
je     111f <mem_close+0xf>
push   %rax
call   1030 <free@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct._musstream = type { i32 }
define i32 @mem_close(%struct._musstream* %0) {
%2 = alloca %struct._musstream*
store %struct._musstream* %0, %struct._musstream** %2
%3 = load %struct._musstream*, %struct._musstream** %2
%4 = icmp ne %struct._musstream* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load %struct._musstream*, %struct._musstream** %2
%7 = call i32 @free(%struct._musstream* %6)
br label %8
8: ; preds = %5, %1
ret i32 0
}

LLVM IR (-O2):
%struct._musstream = type { i32 }
define i32 @mem_close(%struct._musstream* %0) {
%2 = icmp eq %struct._musstream* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct._musstream* %0)
br label %5
5: ; preds = %3, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ pause();
int main(int argc, char **argv) {
  close(0);
  pause();
  exit(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)
xor    %edi,%edi
call   1030 <close@plt>
mov    $0x0,%al
call   1040 <pause@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <close@plt>
xor    %eax,%eax
call   1040 <pause@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @close(i32 0)
%7 = call i32 (...) @pause()
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @close(i32 0)
%4 = tail call i32 (...) @pause()
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
size_t strcmp(char *, char *);
size_t wcscspn(const wchar_t *s1, const wchar_t *s2) {
  return strcmp((char *)s1, (char *)s2);
}


x86 assembly (clang, -O0):
<wcscspn>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscspn>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i64 @wcscspn(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 = bitcast i32* %5 to i8*
%7 = load i32*, i32** %4
%8 = bitcast i32* %7 to i8*
%9 = call i64 @strcmp(i8* %6, i8* %8)
ret i64 %9
}

LLVM IR (-O2):
define i64 @wcscspn(i32* %0, i32* %1) {
%3 = bitcast i32* %0 to i8*
%4 = bitcast i32* %1 to i8*
%5 = tail call i64 @strcmp(i8* %3, i8* %4)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ usleep(int);
void skypopen_clean_disp(void *data) {
  int *dispptr;
  int disp;
  dispptr = data;
  disp = *dispptr;
  if (disp) {
    close(disp);
  } else {
  }
  usleep(1000);
}


x86 assembly (clang, -O0):
<skypopen_clean_disp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1154 <skypopen_clean_disp+0x34>
mov    -0x14(%rbp),%edi
call   1030 <close@plt>
jmp    1159 <skypopen_clean_disp+0x39>
jmp    1159 <skypopen_clean_disp+0x39>
mov    $0x3e8,%edi
call   1040 <usleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skypopen_clean_disp>:
push   %rax
mov    (%rdi),%edi
test   %edi,%edi
je     112c <skypopen_clean_disp+0xc>
call   1030 <close@plt>
mov    $0x3e8,%edi
pop    %rax
jmp    1040 <usleep@plt>

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

LLVM IR (-O2):
define void @skypopen_clean_disp(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @close(i32 %3)
br label %7
7: ; preds = %1, %5
%8 = tail call i32 @usleep(i32 1000)
ret void
}
void mem_put_le24_as_int(void *vmem, int val) {
  unsigned char *mem = (unsigned char *)vmem;
  mem[0] = (val >> 0) & 0xff;
  mem[1] = (val >> 8) & 0xff;
  mem[2] = (val >> 16) & 0xff;
}


x86 assembly (clang, -O0):
<mem_put_le24_as_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_put_le24_as_int>:
mov    %esi,%eax
mov    %al,(%rdi)
mov    %ah,0x1(%rdi)
shr    $0x10,%eax
mov    %al,0x2(%rdi)
ret

LLVM IR (-O0):
define void @mem_put_le24_as_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i32, i32* %4
%8 = ashr i32 %7, 0
%9 = and i32 %8, 255
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 %10, i8* %12
%13 = load i32, i32* %4
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8 %16, i8* %18
%19 = load i32, i32* %4
%20 = ashr i32 %19, 16
%21 = and i32 %20, 255
%22 = trunc i32 %21 to i8
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 2
store i8 %22, i8* %24
ret void
}

LLVM IR (-O2):
define void @mem_put_le24_as_int(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *lowercase(char *);
int strcmp(char *, char *);
int compare_strings_lower(const void *a, const void *b) {
  char *astr = *(char **)a;
  char *bstr = *(char **)b;
  char *a_low = lowercase(astr);
  char *b_low = lowercase(bstr);
  int ret = strcmp(a_low, b_low);
  free(a_low);
  free(b_low);
  return ret;
}


x86 assembly (clang, -O0):
<compare_strings_lower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <lowercase@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <lowercase@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_strings_lower>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rdi
mov    (%rsi),%r14
call   1050 <lowercase@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1050 <lowercase@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @compare_strings_lower(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%10 = load i8*, i8** %3
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
store i8* %12, i8** %5
%13 = load i8*, i8** %4
%14 = bitcast i8* %13 to i8**
%15 = load i8*, i8** %14
store i8* %15, i8** %6
%16 = load i8*, i8** %5
%17 = call i8* @lowercase(i8* %16)
store i8* %17, i8** %7
%18 = load i8*, i8** %6
%19 = call i8* @lowercase(i8* %18)
store i8* %19, i8** %8
%20 = load i8*, i8** %7
%21 = load i8*, i8** %8
%22 = call i32 @strcmp(i8* %20, i8* %21)
store i32 %22, i32* %9
%23 = load i8*, i8** %7
%24 = call i32 @free(i8* %23)
%25 = load i8*, i8** %8
%26 = call i32 @free(i8* %25)
%27 = load i32, i32* %9
ret i32 %27
}

LLVM IR (-O2):
define i32 @compare_strings_lower(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i8* @lowercase(i8* %4)
%8 = tail call i8* @lowercase(i8* %6)
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %7, i8* dereferenceable(1) %8)
%10 = tail call i32 @free(i8* %7)
%11 = tail call i32 @free(i8* %8)
ret i32 %9
}
int main(int argc, char *argv[]) {
  int i;
  char c = 'C';
  for (i = 0; i != 1000000; ++i) {
    ((c) >= 'A' && (c) <= 'Z') ? 1 : 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x43,-0x15(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xf4240,-0x14(%rbp)
je     115a <main+0x5a>
movsbl -0x15(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x16(%rbp)
jl     1149 <main+0x49>
movsbl -0x15(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111d <main+0x1d>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 67, i8* %7
store i32 0, i32* %6
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 1000000
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i8, i8* %7
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 65
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 90
br label %19
19: ; preds = %15, %11
%20 = phi i1 [ false, %11 ], [ %18, %15 ]
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 1, i32 0
br label %23
23: ; preds = %19
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %8
26: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 5000; i >= 0; i--) {
    printf(" %d", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1388,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     114d <main+0x3d>
mov    -0x8(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1388,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jb     1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 5000, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nsw i32 %2, -1
%5 = icmp eq i32 %2, 0
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SYS_exit;
int /*<<< orphan*/ SYS_write;
int strlen(char *);
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int, ...);
int main(void) {
  char *buf = "Hello world!\n";
  int count = strlen(buf);
  syscall(SYS_write, 1, buf, count);
  syscall(SYS_exit, 42);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <syscall@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    $0x2a,%esi
mov    $0x0,%al
call   1040 <syscall@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    0x2ea9(%rip),%rcx
mov    (%rcx),%edi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <syscall@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
mov    $0x2a,%esi
xor    %eax,%eax
call   1040 <syscall@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@SYS_write = global i32 0
@SYS_exit = global i32 0
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strlen(i8* %3)
store i32 %4, i32* %2
%5 = load i32, i32* @SYS_write
%6 = load i8*, i8** %1
%7 = load i32, i32* %2
%8 = call i32 (i32, i32, ...) @syscall(i32 %5, i32 1, i8* %6, i32 %7)
%9 = load i32, i32* @SYS_exit
%10 = call i32 (i32, i32, ...) @syscall(i32 %9, i32 42)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello world!\0A\00"
@SYS_write = global i32 0
@SYS_exit = global i32 0
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @SYS_write
%3 = tail call i32 (i32, i32, ...) @syscall(i32 %2, i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = load i32, i32* @SYS_exit
%5 = tail call i32 (i32, i32, ...) @syscall(i32 %4, i32 42)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ Status;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
Status XScreenSaverUnregister(Display *dpy, int screen) {}


x86 assembly (clang, -O0):
<XScreenSaverUnregister>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @XScreenSaverUnregister(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* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @XScreenSaverUnregister(i32* nocapture readnone %0, i32 %1) {
ret i32 undef
}
void g_str_hash() {}


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

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

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

LLVM IR (-O2):
define void @g_str_hash() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void wfree(void *pointer) {
  free(pointer);
  pointer = NULL;
}


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

x86 assembly (clang, -O2):
<wfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @wfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int test_imm_31int8_mem(signed char *val) {
  return ((*val) & (0x31 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_31int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 49
%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_31int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 49
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *jd2fd(dj)
double dj;
{
  double tsec;
  tsec = (dj - 2433282.5) * 86400.0;
  return (ts2fd(tsec));
}


x86 assembly (clang, -O0):
<jd2fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xede(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeca(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <ts2fd@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jd2fd>:
push   %rax
addsd  0xee7(%rip),%xmm0
mulsd  0xee7(%rip),%xmm0
mov    $0x1,%al
call   1030 <ts2fd@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @jd2fd(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fsub double %4, 0x4142908140000000
%6 = fmul double %5, 8.640000e+04
store double %6, double* %3
%7 = load double, double* %3
%8 = call i32 (double, ...) bitcast (i32 (...)* @ts2fd to i32 (double, ...)*)(double %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @jd2fd(double %0) {
%2 = fadd double %0, 0xC142908140000000
%3 = fmul double %2, 8.640000e+04
%4 = tail call i32 (double, ...) bitcast (i32 (...)* @ts2fd to i32 (double, ...)*)(double %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
/* Variables and functions */
int toupper(int);
int /*<<< orphan*/ usage();
int letterToCode(int letter) {
  switch (toupper(letter)) {
  case 'A':
    return 0x20;
  case 'H':
    return 0x2;
  case 'R':
    return 0x1;
  case 'S':
    return 0x4;
  default:
    usage();
  }
}


x86 assembly (clang, -O0):
<letterToCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <toupper@plt>
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x12,%eax
ja     1189 <letterToCode+0x69>
mov    -0x10(%rbp),%rax
lea    0xeb0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x20,-0x4(%rbp)
jmp    1190 <letterToCode+0x70>
movl   $0x2,-0x4(%rbp)
jmp    1190 <letterToCode+0x70>
movl   $0x1,-0x4(%rbp)
jmp    1190 <letterToCode+0x70>
movl   $0x4,-0x4(%rbp)
jmp    1190 <letterToCode+0x70>
mov    $0x0,%al
call   1040 <usage@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<letterToCode>:
push   %rax
call   1030 <toupper@plt>
mov    %eax,%ecx
add    $0xffffffbf,%ecx
cmp    $0x12,%ecx
ja     114c <letterToCode+0x2c>
mov    $0x20,%eax
lea    0xec4(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x2,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1040 <usage@plt>
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret
mov    $0x4,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @letterToCode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @toupper(i32 %4)
switch i32 %5, label %10 [
i32 65, label %6
i32 72, label %7
i32 82, label %8
i32 83, label %9
]
6: ; preds = %1
store i32 32, i32* %2
br label %12
7: ; preds = %1
store i32 2, i32* %2
br label %12
8: ; preds = %1
store i32 1, i32* %2
br label %12
9: ; preds = %1
store i32 4, i32* %2
br label %12
10: ; preds = %1
%11 = call i32 (...) @usage()
br label %12
12: ; preds = %6, %7, %8, %9, %10
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @letterToCode(i32 %0) {
%2 = tail call i32 @toupper(i32 %0)
switch i32 %2, label %6 [
i32 65, label %8
i32 72, label %3
i32 82, label %4
i32 83, label %5
]
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @usage()
br label %8
8: ; preds = %1, %3, %4, %5, %6
%9 = phi i32 [ undef, %6 ], [ 4, %5 ], [ 1, %4 ], [ 2, %3 ], [ 32, %1 ]
ret i32 %9
}
int fib(int x) {
  if (x < 2)
    return x;
  return fib(x - 1) + fib(x - 2);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1130 <fib+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <fib+0x43>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <fib+0x10>
mov    %ebx,%ecx
jmp    1144 <fib+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <fib+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
double Sleef_tan_u35(double x) { return __builtin_tan(x); }


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

x86 assembly (clang, -O2):
<Sleef_tan_u35>:
jmp    1030 <tan@plt>

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

LLVM IR (-O2):
define double @Sleef_tan_u35(double %0) {
%2 = tail call double @tan(double %0)
ret double %2
}
signed short read16(unsigned long reg1) {
  unsigned long *reg;
  signed short val;
  reg = (unsigned long *)reg1;
  val = (short)*(reg);
  return val;
}


x86 assembly (clang, -O0):
<read16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %ax,-0x12(%rbp)
movswl -0x12(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read16>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define signext i16 @read16(i64 %0) {
%2 = alloca i64
%3 = alloca i64*
%4 = alloca i16
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = inttoptr i64 %5 to i64*
store i64* %6, i64** %3
%7 = load i64*, i64** %3
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i16
store i16 %9, i16* %4
%10 = load i16, i16* %4
ret i16 %10
}

LLVM IR (-O2):
define signext i16 @read16(i64 %0) {
%2 = inttoptr i64 %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i16
ret i16 %4
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ nerror(char *);
int *ivector(long nl, long nh) {
  int *v;
  v = (int *)malloc((size_t)((nh - nl + 1 + 1) * sizeof(int)));
  if (!v)
    nerror("allocation failure in ivector()");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x1,%rdi
add    $0x1,%rdi
shl    $0x2,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1164 <ivector+0x44>
lea    0xea1(%rip),%rdi
call   1040 <nerror@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivector>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
sub    %rdi,%rsi
lea    0x8(,%rsi,4),%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <ivector+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <nerror@plt>
shl    $0x2,%r14
sub    %r14,%rbx
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = add nsw i64 %9, 1
%11 = mul i64 %10, 4
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %5
%14 = load i32*, i32** %5
%15 = icmp ne i32* %14, null
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 @nerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load i32*, i32** %5
%20 = load i64, i64* %3
%21 = sub i64 0, %20
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = getelementptr inbounds i32, i32* %22, i64 1
ret i32* %23
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 2
%5 = add i64 %4, 8
%6 = tail call i64 @malloc(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @nerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = inttoptr i64 %6 to i32*
%12 = sub i64 0, %0
%13 = getelementptr inbounds i32, i32* %11, i64 %12
%14 = getelementptr inbounds i32, i32* %13, i64 1
ret i32* %14
}
void foo695(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo695(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_64() {
  Assert_real((isqrt(64) == 8),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              325, ("Integer square root of 64 should be 8"));
}


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

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

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 64 should be 8\00"
define void @t_sqrt_64() {
%1 = call i32 @isqrt(i32 64)
%2 = icmp eq i32 %1, 8
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 325, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 64 should be 8\00"
define void @t_sqrt_64() {
%1 = tail call i32 @isqrt(i32 64)
%2 = icmp eq i32 %1, 8
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 325, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ strlen(char *);
void change_extension(char *restrict file_name,
                      const char *restrict extension) {
  int n = (int)strlen(file_name);
  for (int i = 0; i < 3; ++i) {
    file_name[n - 3 + i] = extension[i];
  }
}


x86 assembly (clang, -O0):
<change_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1169 <change_extension+0x59>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x3,%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1133 <change_extension+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_extension>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
movzwl (%r14),%ecx
mov    %cx,-0x3(%rax,%rbx,1)
mov    0x2(%r14),%cl
mov    %cl,-0x1(%rax,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @change_extension(i8* noalias %0, i8* noalias %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
store i32 0, i32* %6
br label %10
10: ; preds = %26, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %29
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 3
%22 = load i32, i32* %6
%23 = add nsw i32 %21, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %19, i64 %24
store i8 %18, i8* %25
br label %26
26: ; preds = %13
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %10
29: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @change_extension(i8* noalias nocapture %0, i8* noalias nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = add nsw i64 %5, -3
%7 = getelementptr i8, i8* %0, i64 %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_humidity();
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  printf("%s\r\n\r\n", "Content-Type:text/html");
  get_humidity();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"%s\0D\0A\0D\0A\00"
@.str.1 = [23 x i8] c"Content-Type:text/html\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @get_humidity()
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s\0D\0A\0D\0A\00"
@.str.1 = [23 x i8] c"Content-Type:text/html\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @get_humidity()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int pthread_getname_np(int /*<<< orphan*/, char *, size_t);
int linux_pthread_getname_np(pthread_t thread, char *name, size_t len) {
  return pthread_getname_np(thread, name, len);
}


x86 assembly (clang, -O0):
<linux_pthread_getname_np>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <pthread_getname_np@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linux_pthread_getname_np>:
jmp    1030 <pthread_getname_np@plt>

LLVM IR (-O0):
define i32 @linux_pthread_getname_np(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @pthread_getname_np(i32 %7, i8* %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @linux_pthread_getname_np(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @pthread_getname_np(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t Ch(uint64_t x, uint64_t y, uint64_t z) { return (x & y) ^ ((~x) & z); }


x86 assembly (clang, -O0):
<Ch>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
and    -0xc(%rbp),%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ch>:
mov    %esi,%eax
xor    %edx,%eax
and    %edi,%eax
xor    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @Ch(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, %0
%5 = xor i32 %0, -1
%6 = and i32 %5, %2
%7 = or i32 %6, %4
ret i32 %7
}