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

/* Variables and functions */
struct memlock *get_memlock();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ mem_unlock(struct memlock *, char *);
int /*<<< orphan*/ printf(char *);
int do_unlock() {
  struct memlock *lock = get_memlock();
  if (NULL == lock) {
    printf("get lock faild\n");
    return -1;
  }
  while (1) {
    getchar();
    mem_unlock(lock, "unlock");
  }
}


x86 assembly (clang, -O0):
<do_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <get_memlock@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    1176 <do_unlock+0x36>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    117b <do_unlock+0x3b>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x8(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1030 <mem_unlock@plt>
jmp    117b <do_unlock+0x3b>

x86 assembly (clang, -O2):
<do_unlock>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <get_memlock@plt>
test   %rax,%rax
je     1174 <do_unlock+0x34>
mov    %rax,%rbx
lea    0xea6(%rip),%r14
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <mem_unlock@plt>
jmp    1160 <do_unlock+0x20>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.memlock = type { i32 }
@.str = [16 x i8] c"get lock faild\0A\00"
@.str.1 = [7 x i8] c"unlock\00"
define i32 @do_unlock() {
%1 = alloca %struct.memlock*
%2 = call %struct.memlock* (...) @get_memlock()
store %struct.memlock* %2, %struct.memlock** %1
%3 = load %struct.memlock*, %struct.memlock** %1
%4 = icmp eq %struct.memlock* null, %3
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 -1
7: ; preds = %0
br label %8
8: ; preds = %7, %8
%9 = call i32 (...) @getchar()
%10 = load %struct.memlock*, %struct.memlock** %1
%11 = call i32 @mem_unlock(%struct.memlock* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %8
}

LLVM IR (-O2):
%struct.memlock = type { i32 }
@.str.1 = [7 x i8] c"unlock\00"
@str = [15 x i8] c"get lock faild\00"
define i32 @do_unlock() {
%1 = tail call %struct.memlock* (...) @get_memlock()
%2 = icmp eq %struct.memlock* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 -1
5: ; preds = %0, %5
%6 = tail call i32 (...) @getchar()
%7 = tail call i32 @mem_unlock(%struct.memlock* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %5
}
/* Variables and functions */
int read_byte();
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write_block(int, int, int /*<<< orphan*/,
                               int /*<<< orphan*/);
int digitalRead(int pin) {
  write_block(1, pin, 0, 0);
  usleep(10000);
  return read_byte();
}


x86 assembly (clang, -O0):
<digitalRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1040 <write_block@plt>
mov    $0x2710,%edi
call   1050 <usleep@plt>
mov    $0x0,%al
call   1030 <read_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<digitalRead>:
push   %rax
mov    %edi,%esi
mov    $0x1,%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <write_block@plt>
mov    $0x2710,%edi
call   1050 <usleep@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <read_byte@plt>

LLVM IR (-O0):
define i32 @digitalRead(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @write_block(i32 1, i32 %3, i32 0, i32 0)
%5 = call i32 @usleep(i32 10000)
%6 = call i32 (...) @read_byte()
ret i32 %6
}

LLVM IR (-O2):
define i32 @digitalRead(i32 %0) {
%2 = tail call i32 @write_block(i32 1, i32 %0, i32 0, i32 0)
%3 = tail call i32 @usleep(i32 10000)
%4 = tail call i32 (...) @read_byte()
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/ *, int);
void encode_native_64_signed(char *buf, int64_t x) { memcpy(buf, &x, 8); }


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

x86 assembly (clang, -O2):
<encode_native_64_signed>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @encode_native_64_signed(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 = call i32 @memcpy(i8* %5, i32* %4, i32 8)
ret void
}

LLVM IR (-O2):
define void @encode_native_64_signed(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @memcpy(i8* %0, i32* %3, i32 8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, char *);
void function_est_time(char *est_time) {
  write("csv-task.csv", "%s\n", est_time);
}


x86 assembly (clang, -O0):
<function_est_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_est_time>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeec(%rip),%rsi
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"csv-task.csv\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @function_est_time(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @write(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"csv-task.csv\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @function_est_time(i8* %0) {
%2 = tail call i32 @write(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
void _M2_rboxes_finish(__attribute__((unused)) int argc,
                       __attribute__((unused)) char *argv[]) {}


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

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

LLVM IR (-O0):
define void @_M2_rboxes_finish(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @_M2_rboxes_finish(i32 %0, i8** nocapture %1) {
ret void
}
void g_thread_self() {}


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

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

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

LLVM IR (-O2):
define void @g_thread_self() {
ret void
}
int is_ws_char(char x) {
  return (x == ' ' || x == '\t' || x == '\r' || x == '\n');
}


x86 assembly (clang, -O0):
<is_ws_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_ws_char+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_ws_char+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_ws_char+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ws_char>:
cmp    $0x20,%dil
ja     1120 <is_ws_char+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100002200,%rdx
bt     %rcx,%rdx
jae    1120 <is_ws_char+0x20>
ret
xor    %eax,%eax
cmp    $0xa,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_ws_char(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 13, label %5
i8 9, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 10
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
void *cs2qpcb();
void *cs2qpcb_(void) { return cs2qpcb(); }


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

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

LLVM IR (-O0):
define i8* @cs2qpcb_() {
%1 = call i8* (...) @cs2qpcb()
ret i8* %1
}

LLVM IR (-O2):
define i8* @cs2qpcb_() {
%1 = tail call i8* (...) @cs2qpcb()
ret i8* %1
}
void empty_signal_handler(int signo) { return; }


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

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

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

LLVM IR (-O2):
define void @empty_signal_handler(i32 %0) {
ret void
}
/* Type definitions */
struct stat {
  size_t st_blksize;
};

/* Variables and functions */
size_t posix_stat_st_blksize(const struct stat *st) { return st->st_blksize; }


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

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

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

LLVM IR (-O2):
%struct.stat = type { i64 }
define i64 @posix_stat_st_blksize(%struct.stat* nocapture %0) {
%2 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned long);
void genname(unsigned long n, char *m) { sprintf(m, "%lu", n); }


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

x86 assembly (clang, -O2):
<genname>:
mov    %rsi,%rax
mov    %rdi,%rdx
lea    0xee3(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
define void @genname(i64 %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mpfr_t;
typedef int mpfr_rnd_t;

/* Variables and functions */
int /*<<< orphan*/ mpfr_div_d(int /*<<< orphan*/, int /*<<< orphan*/, double,
                              int);
void mpfrdivd(mpfr_t r2, mpfr_t r1, double *d, mpfr_rnd_t *irnd) {
  double d1;
  int n1;
  d1 = *d;
  n1 = *irnd;
  mpfr_div_d(r2, r1, d1, n1);
}


x86 assembly (clang, -O0):
<mpfrdivd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
mov    -0x24(%rbp),%edx
call   1030 <mpfr_div_d@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpfrdivd>:
movsd  (%rdx),%xmm0
mov    (%rcx),%edx
jmp    1030 <mpfr_div_d@plt>

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

LLVM IR (-O2):
define void @mpfrdivd(i32 %0, i32 %1, double* nocapture %2, i32* nocapture %3) {
%5 = load double, double* %2
%6 = load i32, i32* %3
%7 = tail call i32 @mpfr_div_d(i32 %0, i32 %1, double %5, i32 %6)
ret void
}
void gtk_text_view_get_tabs() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_view_get_tabs() {
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double RandomZeroOne() { return (double)rand() / (double)RAND_MAX; }


x86 assembly (clang, -O0):
<RandomZeroOne>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomZeroOne>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @RandomZeroOne() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @RandomZeroOne() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
/* Variables and functions */
scalar_t__ ldexpl(long double, int);
int /*<<< orphan*/ link_failure_ldexpl();
void test_ldexpl(long double ld, int x) {
  if (ldexpl(ld, x) != ldexpl(ld, x))
    link_failure_ldexpl();
}


x86 assembly (clang, -O0):
<test_ldexpl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %edi,-0x14(%rbp)
fldt   -0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <ldexpl@plt>
mov    %rax,-0x20(%rbp)
fldt   -0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <ldexpl@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     116c <test_ldexpl+0x4c>
mov    $0x0,%al
call   1040 <link_failure_ldexpl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ldexpl>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
fldt   0x40(%rsp)
fld    %st(0)
fstpt  0x1c(%rsp)
fstpt  (%rsp)
call   1030 <ldexpl@plt>
mov    %rax,%r14
fldt   0x1c(%rsp)
fstpt  (%rsp)
mov    %ebx,%edi
call   1030 <ldexpl@plt>
cmp    %rax,%r14
jne    1159 <test_ldexpl+0x39>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
jmp    1040 <link_failure_ldexpl@plt>

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

LLVM IR (-O2):
define void @test_ldexpl(x86_fp80 %0, i32 %1) {
%3 = tail call i64 @ldexpl(x86_fp80 %0, i32 %1)
%4 = tail call i64 @ldexpl(x86_fp80 %0, i32 %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @link_failure_ldexpl()
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
short session_id_chk(const char *session_id) {
  if (0 == strcmp(session_id, "0000000000000000")) {
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<session_id_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1145 <session_id_chk+0x35>
movw   $0xffff,-0x2(%rbp)
jmp    114b <session_id_chk+0x3b>
movw   $0x1,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<session_id_chk>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0000000000000000\00"
define signext i16 @session_id_chk(i8* %0) {
%2 = alloca i16
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 0, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i16 -1, i16* %2
br label %9
8: ; preds = %1
store i16 1, i16* %2
br label %9
9: ; preds = %8, %7
%10 = load i16, i16* %2
ret i16 %10
}

LLVM IR (-O2):
@.str = [17 x i8] c"0000000000000000\00"
define signext i16 @session_id_chk(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i16 -1, i16 1
ret i16 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int get_file_size(char *_fname) {
  FILE *fp = fopen(_fname, "rb");
  fseek(fp, 0, SEEK_END);
  int file_size = ftell(fp);
  fclose(fp);
  return file_size;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e7d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1040 <ftell@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <fseek@plt>
mov    %rbx,%rdi
call   1040 <ftell@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
define i32 @get_file_size(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i32 0, i32 %8)
%10 = load i32*, i32** %3
%11 = call i32 @ftell(i32* %10)
store i32 %11, i32* %4
%12 = load i32*, i32** %3
%13 = call i32 @fclose(i32* %12)
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
define i32 @get_file_size(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %2, i32 0, i32 %3)
%5 = tail call i32 @ftell(i32* %2)
%6 = tail call i32 @fclose(i32* %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) { printf("It's Friday!\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 = [14 x i8] c"It's Friday!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"It's Friday!\00"
define i32 @main() {
%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 */
int /*<<< orphan*/ asprintf(char **, char *, char *, char *, char *, char *);
int /*<<< orphan*/ system(char *);
void rmSampleDir(char *dir) {
  char *commandout;
  asprintf(&commandout, "%s %s%s%s", "sudo rm -r", "/tmp/Umweltmonitoring",
           "/mic", dir);
  system(commandout);
}


x86 assembly (clang, -O0):
<rmSampleDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%r9
lea    -0x10(%rbp),%rdi
lea    0xec5(%rip),%rsi
lea    0xec8(%rip),%rdx
lea    0xecc(%rip),%rcx
lea    0xedb(%rip),%r8
call   1040 <asprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmSampleDir>:
push   %rax
mov    %rdi,%r9
lea    0xed5(%rip),%rsi
lea    0xed8(%rip),%rdx
lea    0xedc(%rip),%rcx
lea    0xeeb(%rip),%r8
mov    %rsp,%rdi
call   1040 <asprintf@plt>
mov    (%rsp),%rdi
call   1030 <system@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%s %s%s%s\00"
@.str.1 = [11 x i8] c"sudo rm -r\00"
@.str.2 = [22 x i8] c"/tmp/Umweltmonitoring\00"
@.str.3 = [5 x i8] c"/mic\00"
define void @rmSampleDir(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %3
%7 = call i32 @system(i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s %s%s%s\00"
@.str.1 = [11 x i8] c"sudo rm -r\00"
@.str.2 = [22 x i8] c"/tmp/Umweltmonitoring\00"
@.str.3 = [5 x i8] c"/mic\00"
define void @rmSampleDir(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%5 = load i8*, i8** %2
%6 = call i32 @system(i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(void) {
  printf("%d", '0');
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 48)
ret i32 0
}
/* Variables and functions */
char *mg_strndup(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
char *mg_strdup(const char *str) { return (mg_strndup(str, strlen(str))); }


x86 assembly (clang, -O0):
<mg_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <mg_strndup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_strdup>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <mg_strndup@plt>

LLVM IR (-O0):
define i8* @mg_strdup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i8* @mg_strndup(i8* %3, i32 %5)
ret i8* %6
}

LLVM IR (-O2):
define i8* @mg_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i8* @mg_strndup(i8* %0, i32 %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, char);
int /*<<< orphan*/ scanf(char *, char *, char *, char *);
int main() {
  char a;
  char b;
  char c;
  scanf("%c%c%c", &a, &b, &c);
  printf("%c%c%c\n", a, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x5(%rbp),%rsi
lea    -0x6(%rbp),%rdx
lea    -0x7(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x5(%rbp),%cl
mov    -0x6(%rbp),%al
lea    0xeb3(%rip),%rdi
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x7(%rbp),%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x7(%rsp),%rsi
lea    0x6(%rsp),%rdx
lea    0x5(%rsp),%rcx
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%esi
movsbl 0x6(%rsp),%edx
movsbl 0x5(%rsp),%ecx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%c%c%c\00"
@.str.1 = [8 x i8] c"%c%c%c\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %3)
%5 = load i8, i8* %1
%6 = load i8, i8* %2
%7 = load i8, i8* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8 signext %5, i8 signext %6, i8 signext %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ eprintf(char *, char *, int, size_t);
void *malloc(size_t);
void *emalloc(size_t n) {
  void *p;
  p = malloc(n);
  if (p == NULL)
    eprintf("malloc of %u bytes failed:",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/StreamUtils/gstreamer/refs/heads/master/"
            "libs/gst/check/libcheck/check_error.c",
            66 - 2, n);
  return p;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1160 <emalloc+0x40>
mov    -0x8(%rbp),%rcx
lea    0xeb1(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x40,%edx
call   1040 <eprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114f <emalloc+0x2f>
lea    0xec5(%rip),%rdi
lea    0xed9(%rip),%rsi
mov    $0x40,%edx
mov    %r14,%rcx
call   1040 <eprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"malloc of %u bytes failed:\00"
@.str.1 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/StreamUtils/gstreamer/refs/heads/master/libs/gst/check/libcheck/check_error.c\00"
define i8* @emalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i64, i64* %2
%10 = call i32 @eprintf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 64, i64 %9)
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [27 x i8] c"malloc of %u bytes failed:\00"
@.str.1 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/StreamUtils/gstreamer/refs/heads/master/libs/gst/check/libcheck/check_error.c\00"
define noalias i8* @emalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @eprintf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 64, i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
scalar_t__ islower(int);
int tolower(int c) { return islower(c) ? (c - 'a' + 'A') : c; }


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     113e <tolower+0x2e>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <tolower+0x34>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <islower@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @tolower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @islower(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 97
%9 = add nsw i32 %8, 65
br label %12
10: ; preds = %1
%11 = load i32, i32* %2
br label %12
12: ; preds = %10, %6
%13 = phi i32 [ %9, %6 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i64 @islower(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ ft_memcpy(char *, char const *, int);
int ft_strlen(char const *);
char *ft_strcpy(char *dst, const char *src) {
  int len;
  len = ft_strlen(src) + 1;
  ft_memcpy(dst, src, len);
  return (dst);
}


x86 assembly (clang, -O0):
<ft_strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ft_strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <ft_memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <ft_strlen@plt>
lea    0x1(%rax),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <ft_memcpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @ft_strcpy(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** %4
%7 = call i32 @ft_strlen(i8* %6)
%8 = add nsw i32 %7, 1
store i32 %8, i32* %5
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = call i32 @ft_memcpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @ft_strcpy(i8* returned %0, i8* %1) {
%3 = tail call i32 @ft_strlen(i8* %1)
%4 = add nsw i32 %3, 1
%5 = tail call i32 @ft_memcpy(i8* %0, i8* %1, i32 %4)
ret i8* %0
}
void printk_all_partitions(void) {}


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

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

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

LLVM IR (-O2):
define void @printk_all_partitions() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a;
  a = -2L;
  printf("%d", 5 > 1 + 2 && 2 || 2 * 4 < 4 - !0);
  printf("%d", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffffe,-0x8(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 -2)
ret i32 0
}
__attribute__((always_)) void idle_cpu(void) {
  __asm__ __volatile__("			\n"
                       "	pause		\n"
                       "	pause		\n"
                       "	pause		\n"
                       "	pause		\n" ::
                           :);
}


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

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

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

LLVM IR (-O2):
define void @idle_cpu() {
tail call void asm sideeffect "\09\09\09\0A\09pause\09\09\0A\09pause\09\09\0A\09pause\09\09\0A\09pause\09\09\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void speex_error(const char *str) {
  fprintf(stderr, "Fatal error: %s\n", str);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Fatal error: %s\0A\00"
define void @speex_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
float sqrt(float x) {
  float xhalf = 0.5f * x;
  union {
    float x;
    int i;
  } u;
  u.x = x;
  u.i = 0x5f3759df - (u.i >> 1);
  u.x = u.x * (1.5f - xhalf * u.x * u.x);
  return 1 / u.x;
}


x86 assembly (clang, -O0):
<sqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f3759df,%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xea2(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe89(%rip),%xmm0
divss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrt>:
movd   %xmm0,%eax
sar    %eax
mov    $0x5f3759df,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
mulss  0xee7(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0xedb(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  0xed3(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @sqrt(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca %union.anon
store float %0, float* %2
%5 = load float, float* %2
%6 = fmul float 5.000000e-01, %5
store float %6, float* %3
%7 = load float, float* %2
%8 = bitcast %union.anon* %4 to float*
store float %7, float* %8
%9 = bitcast %union.anon* %4 to i32*
%10 = load i32, i32* %9
%11 = ashr i32 %10, 1
%12 = sub nsw i32 1597463007, %11
%13 = bitcast %union.anon* %4 to i32*
store i32 %12, i32* %13
%14 = bitcast %union.anon* %4 to float*
%15 = load float, float* %14
%16 = load float, float* %3
%17 = bitcast %union.anon* %4 to float*
%18 = load float, float* %17
%19 = fmul float %16, %18
%20 = bitcast %union.anon* %4 to float*
%21 = load float, float* %20
%22 = fneg float %19
%23 = call float @llvm.fmuladd.f32(float %22, float %21, float 1.500000e+00)
%24 = fmul float %15, %23
%25 = bitcast %union.anon* %4 to float*
store float %24, float* %25
%26 = bitcast %union.anon* %4 to float*
%27 = load float, float* %26
%28 = fdiv float 1.000000e+00, %27
ret float %28
}

LLVM IR (-O2):
define float @sqrt(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = sub nsw i32 1597463007, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %0, -5.000000e-01
%7 = fmul float %6, %5
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float 1.500000e+00)
%9 = fmul float %8, %5
%10 = fdiv float 1.000000e+00, %9
ret float %10
}
int test_imm_07uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x07 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_07uint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0x7,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_07uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 7
%7 = icmp ne i64 %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_07uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 458752
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *my_stpcpy(char *dst, const char *src) {
  char *q = dst;
  const char *p = src;
  while (*p)
    *q++ = *p++;
  return q;
}


x86 assembly (clang, -O0):
<my_stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     1150 <my_stpcpy+0x50>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    111c <my_stpcpy+0x1c>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_stpcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <my_stpcpy+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <my_stpcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @my_stpcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
ret i8* %14
}
void set_sda_line(unsigned long pci_base, int state) {
  if (state == 1)
    (*(unsigned char *)(pci_base + 0x0e) |= (1 << 2));
  else if (state == 0)
    (*(unsigned char *)(pci_base + 0x0e) &= ~(1 << 2));
}


x86 assembly (clang, -O0):
<set_sda_line>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1128 <set_sda_line+0x28>
mov    -0x8(%rbp),%rax
movzbl 0xe(%rax),%ecx
or     $0x4,%ecx
mov    %cl,0xe(%rax)
jmp    1145 <set_sda_line+0x45>
cmpl   $0x0,-0xc(%rbp)
jne    1140 <set_sda_line+0x40>
mov    -0x8(%rbp),%rax
movzbl 0xe(%rax),%ecx
and    $0xfffffffb,%ecx
mov    %cl,0xe(%rax)
jmp    1145 <set_sda_line+0x45>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_sda_line>:
test   %esi,%esi
je     110e <set_sda_line+0xe>
cmp    $0x1,%esi
jne    1112 <set_sda_line+0x12>
orb    $0x4,0xe(%rdi)
ret
andb   $0xfb,0xe(%rdi)
ret

LLVM IR (-O0):
define void @set_sda_line(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i64, i64* %3
%9 = add i64 %8, 14
%10 = inttoptr i64 %9 to i8*
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = or i32 %12, 4
%14 = trunc i32 %13 to i8
store i8 %14, i8* %10
br label %27
15: ; preds = %2
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i64, i64* %3
%20 = add i64 %19, 14
%21 = inttoptr i64 %20 to i8*
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = and i32 %23, -5
%25 = trunc i32 %24 to i8
store i8 %25, i8* %21
br label %26
26: ; preds = %18, %15
br label %27
27: ; preds = %26, %7
ret void
}

LLVM IR (-O2):
define void @set_sda_line(i64 %0, i32 %1) {
switch i32 %1, label %13 [
i32 1, label %3
i32 0, label %8
]
3: ; preds = %2
%4 = add i64 %0, 14
%5 = inttoptr i64 %4 to i8*
%6 = load i8, i8* %5
%7 = or i8 %6, 4
store i8 %7, i8* %5
br label %13
8: ; preds = %2
%9 = add i64 %0, 14
%10 = inttoptr i64 %9 to i8*
%11 = load i8, i8* %10
%12 = and i8 %11, -5
store i8 %12, i8* %10
br label %13
13: ; preds = %2, %8, %3
ret void
}
int regulator_is_enabled(struct regulator *regulator) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.regulator = type opaque
define i32 @regulator_is_enabled(%struct.regulator* nocapture readnone %0) {
ret i32 1
}
void A_timerinterrupt() {}


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

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

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

LLVM IR (-O2):
define void @A_timerinterrupt() {
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
scalar_t__ _pidof(char const *, int **);
int /*<<< orphan*/ free(int *);
int pidof(const char *name) {
  pid_t *pids;
  pid_t p;
  if (_pidof(name, &pids) > 0) {
    p = *pids;
    free(pids);
    return p;
  }
  return -1;
}


x86 assembly (clang, -O0):
<pidof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <_pidof@plt>
cmp    $0x0,%rax
jle    1160 <pidof+0x40>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <pidof+0x47>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pidof>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rsi
call   1040 <_pidof@plt>
test   %rax,%rax
jle    1142 <pidof+0x22>
mov    0x8(%rsp),%rdi
mov    (%rdi),%ebx
call   1030 <free@plt>
jmp    1147 <pidof+0x27>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @pidof(i8* %0) {
%2 = alloca i32*
%3 = bitcast i32** %2 to i8*
%4 = call i64 @_pidof(i8* %0, i32** %2)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = call i32 @free(i32* %7)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %8, %6 ], [ -1, %1 ]
ret i32 %11
}