xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ AND_HOST_REG_L(int, int);
int TEST_HOST_REG_B(int dst_reg, int src_reg) {
  AND_HOST_REG_L(dst_reg, src_reg);
  return dst_reg;
}


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

x86 assembly (clang, -O2):
<TEST_HOST_REG_B>:
push   %rbx
mov    %edi,%ebx
call   1030 <AND_HOST_REG_L@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @TEST_HOST_REG_B(i32 returned %0, i32 %1) {
%3 = tail call i32 @AND_HOST_REG_L(i32 %0, i32 %1)
ret i32 %0
}
/* Type definitions */
typedef long clock_t;

/* Variables and functions */
long CLOCKS_PER_SEC;
long clock();
clock_t get_ticks_ms(void) { return clock() / (CLOCKS_PER_SEC / 1000L); }


x86 assembly (clang, -O0):
<get_ticks_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x8(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
cqto
idiv   %rcx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ticks_ms>:
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rcx
mov    0x2ec6(%rip),%rdx
movabs $0x20c49ba5e353f7cf,%rax
9b c4 20
imulq  (%rdx)
mov    %rdx,%rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x7,%rsi
add    %rax,%rsi
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1156 <get_ticks_ms+0x46>
mov    %rcx,%rax
cqto
idiv   %rsi
pop    %rcx
ret
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
pop    %rcx
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i64 0
define i64 @get_ticks_ms() {
%1 = call i64 (...) @clock()
%2 = load i64, i64* @CLOCKS_PER_SEC
%3 = sdiv i64 %2, 1000
%4 = sdiv i64 %1, %3
ret i64 %4
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i64 0
define i64 @get_ticks_ms() {
%1 = tail call i64 (...) @clock()
%2 = load i64, i64* @CLOCKS_PER_SEC
%3 = sdiv i64 %2, 1000
%4 = sdiv i64 %1, %3
ret i64 %4
}
void ft_striter(char *s, void (*f)(char *)) {
  if (s && (*f)) {
    while (*s)
      (*f)(s++);
  }
}


x86 assembly (clang, -O0):
<ft_striter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1157 <ft_striter+0x57>
cmpq   $0x0,-0x10(%rbp)
je     1157 <ft_striter+0x57>
jmp    112b <ft_striter+0x2b>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <ft_striter+0x52>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    %rdi,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
call   *%rax
jmp    112b <ft_striter+0x2b>
jmp    1157 <ft_striter+0x57>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striter>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1133 <ft_striter+0x33>
mov    %rsi,%r14
test   %rsi,%rsi
je     1133 <ft_striter+0x33>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1133 <ft_striter+0x33>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%r15
mov    %rbx,%rdi
call   *%r14
cmpb   $0x0,0x1(%rbx)
mov    %r15,%rbx
jne    1120 <ft_striter+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striter(i8* %0, void (i8*)* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne void (i8*)* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %6, %9
%10 = phi i8* [ %11, %9 ], [ %0, %6 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
tail call void %1(i8* %10)
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %9
14: ; preds = %9, %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void file_test_liberer(void **lieu) {
  free(*lieu);
  *lieu = NULL;
}


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

x86 assembly (clang, -O2):
<file_test_liberer>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @file_test_liberer(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
ret void
}
/* Variables and functions */
double pow(double, int);
double sqrt(int);
double get_sigma_selfint(double alpha) {
  return pow(sqrt(2. / 3.14159265358979323846) * alpha / 3., 1. / 3);
}


x86 assembly (clang, -O0):
<get_sigma_selfint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
xor    %edi,%edi
call   1040 <sqrt@plt>
mulsd  -0x8(%rbp),%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
xor    %edi,%edi
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sigma_selfint>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1040 <sqrt@plt>
mulsd  (%rsp),%xmm0
divsd  0xec6(%rip),%xmm0
xor    %edi,%edi
pop    %rax
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @get_sigma_selfint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call double @sqrt(i32 0)
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = fdiv double %5, 3.000000e+00
%7 = call double @pow(double %6, i32 0)
ret double %7
}

LLVM IR (-O2):
define double @get_sigma_selfint(double %0) {
%2 = tail call double @sqrt(i32 0)
%3 = fmul double %2, %0
%4 = fdiv double %3, 3.000000e+00
%5 = tail call double @pow(double %4, i32 0)
ret double %5
}
int ft_maplen(char **map) {
  int i;
  i = 0;
  while (map[i])
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<ft_maplen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1130 <ft_maplen+0x30>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ft_maplen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_maplen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <ft_maplen+0x10>
ret

LLVM IR (-O0):
define i32 @ft_maplen(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i8**, i8*** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %5, i64 %7
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @ft_maplen(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
void die(const char *message) {
  perror(message);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
unsigned int add(unsigned int *x, unsigned int *y) { return *x + *y; }


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

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

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

LLVM IR (-O2):
define i32 @add(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add i32 %4, %3
ret i32 %5
}
void malloc_cleanup() {}


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

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

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

LLVM IR (-O2):
define void @malloc_cleanup() {
ret void
}
/* Type definitions */
typedef float int32_t;

/* Variables and functions */
float const copysignfk(float, float);
float fabsfk(float);
scalar_t__ xisinff(float);
__attribute__((visibility("default"))) const float xtruncf(float x) {
  float fr = x - (int32_t)x;
  return (xisinff(x) || fabsfk(x) >= (float)(1LL << 23))
             ? x
             : copysignfk(x - fr, x);
}


x86 assembly (clang, -O0):
<xtruncf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <xisinff@plt>
cmp    $0x0,%rax
jne    117b <xtruncf+0x4b>
movss  -0x4(%rbp),%xmm0
call   1050 <fabsfk@plt>
movss  0xe8e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     118a <xtruncf+0x5a>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11a3 <xtruncf+0x73>
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1030 <copysignfk@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtruncf>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1040 <xisinff@plt>
test   %rax,%rax
jne    116f <xtruncf+0x3f>
movss  0x4(%rsp),%xmm0
call   1050 <fabsfk@plt>
ucomiss 0xead(%rip),%xmm0
jae    116f <xtruncf+0x3f>
movss  0x4(%rsp),%xmm1
movaps %xmm1,%xmm2
subss  %xmm1,%xmm2
movaps %xmm1,%xmm0
subss  %xmm2,%xmm0
pop    %rax
jmp    1030 <copysignfk@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @xtruncf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fsub float %4, %5
store float %6, float* %3
%7 = load float, float* %2
%8 = call i64 @xisinff(float %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = load float, float* %2
%12 = call float @fabsfk(float %11)
%13 = fcmp oge float %12, 0x4160000000000000
br i1 %13, label %14, label %16
14: ; preds = %10, %1
%15 = load float, float* %2
br label %22
16: ; preds = %10
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fsub float %17, %18
%20 = load float, float* %2
%21 = call float @copysignfk(float %19, float %20)
br label %22
22: ; preds = %16, %14
%23 = phi float [ %15, %14 ], [ %21, %16 ]
ret float %23
}

LLVM IR (-O2):
define float @xtruncf(float %0) {
%2 = fsub float %0, %0
%3 = tail call i64 @xisinff(float %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = tail call float @fabsfk(float %0)
%7 = fcmp ult float %6, 0x4160000000000000
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = fsub float %0, %2
%10 = tail call float @copysignfk(float %9, float %0)
br label %11
11: ; preds = %1, %5, %8
%12 = phi float [ %10, %8 ], [ %0, %5 ], [ %0, %1 ]
ret float %12
}
void moduleTypeNameByID(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               93, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<moduleTypeNameByID>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x5d,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<moduleTypeNameByID>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x5d,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.moduleTypeNameByID = [19 x i8] c"moduleTypeNameByID\00"
define void @moduleTypeNameByID() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.moduleTypeNameByID, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.moduleTypeNameByID = [19 x i8] c"moduleTypeNameByID\00"
define void @moduleTypeNameByID() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.moduleTypeNameByID, i64 0, i64 0))
ret void
}
int fun999() { return 999; }


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

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

LLVM IR (-O0):
define i32 @fun999() {
ret i32 999
}

LLVM IR (-O2):
define i32 @fun999() {
ret i32 999
}
void ata_acpi_bind(struct ata_device *dev) {}


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

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

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

LLVM IR (-O2):
%struct.ata_device = type opaque
define void @ata_acpi_bind(%struct.ata_device* nocapture %0) {
ret void
}
/* Type definitions */
struct i2c_client {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int i2c_master_send(struct i2c_client *, void const *, int);
struct i2c_client *to_i2c_client(struct device *);
int ft5x06_i2c_send(struct device *dev, const void *buf, int len) {
  struct i2c_client *client = to_i2c_client(dev);
  int count = i2c_master_send(client, buf, len);
  return count < 0 ? count : 0;
}


x86 assembly (clang, -O0):
<ft5x06_i2c_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <to_i2c_client@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <i2c_master_send@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1168 <ft5x06_i2c_send+0x48>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1172 <ft5x06_i2c_send+0x52>
xor    %eax,%eax
mov    %eax,-0x28(%rbp)
jmp    1172 <ft5x06_i2c_send+0x52>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft5x06_i2c_send>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <to_i2c_client@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <i2c_master_send@plt>
mov    %eax,%ecx
sar    $0x1f,%ecx
and    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.device = type { i32 }
%struct.i2c_client = type { i32 }
define i32 @ft5x06_i2c_send(%struct.device* %0, i8* %1, i32 %2) {
%4 = alloca %struct.device*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.i2c_client*
%8 = alloca i32
store %struct.device* %0, %struct.device** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load %struct.device*, %struct.device** %4
%10 = call %struct.i2c_client* @to_i2c_client(%struct.device* %9)
store %struct.i2c_client* %10, %struct.i2c_client** %7
%11 = load %struct.i2c_client*, %struct.i2c_client** %7
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = call i32 @i2c_master_send(%struct.i2c_client* %11, i8* %12, i32 %13)
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = load i32, i32* %8
br label %20
19: ; preds = %3
br label %20
20: ; preds = %19, %17
%21 = phi i32 [ %18, %17 ], [ 0, %19 ]
ret i32 %21
}

LLVM IR (-O2):
%struct.device = type { i32 }
%struct.i2c_client = type { i32 }
define i32 @ft5x06_i2c_send(%struct.device* %0, i8* %1, i32 %2) {
%4 = tail call %struct.i2c_client* @to_i2c_client(%struct.device* %0)
%5 = tail call i32 @i2c_master_send(%struct.i2c_client* %4, i8* %1, i32 %2)
%6 = icmp slt i32 %5, 0
%7 = select i1 %6, i32 %5, i32 0
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int main() {
  FILE *fp;
  char filename[] = "my_file.txt";
  fp = fopen(filename, "w");
  fprintf(fp, "This is a file created by my program! I am so happy.");
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x1c(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x2e656c69665f796d,%rax
6c 65 2e
mov    %rax,(%rsp)
movl   $0x747874,0x8(%rsp)
lea    0xeba(%rip),%rsi
mov    %rsp,%rdi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xeaa(%rip),%rdi
mov    $0x34,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.filename = [12 x i8] c"my_file.txt\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [53 x i8] c"This is a file created by my program! I am so happy.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [12 x i8]
store i32 0, i32* %1
%4 = bitcast [12 x i8]* %3 to i8*
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 @fclose(i32* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.filename = [12 x i8] c"my_file.txt\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [53 x i8] c"This is a file created by my program! I am so happy.\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i64 52, i64 1, i32* %3)
%5 = tail call i32 @fclose(i32* %3)
ret i32 0
}
/* Variables and functions */
int cio_read(int);
int jp2_read_jp() {
  if (0x0d0a870a != cio_read(4))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<jp2_read_jp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <cio_read@plt>
mov    %eax,%ecx
mov    $0xd0a870a,%eax
cmp    %ecx,%eax
je     113d <jp2_read_jp+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <jp2_read_jp+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jp2_read_jp>:
push   %rax
mov    $0x4,%edi
call   1030 <cio_read@plt>
xor    %ecx,%ecx
cmp    $0xd0a870a,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @jp2_read_jp() {
%1 = alloca i32
%2 = call i32 @cio_read(i32 4)
%3 = icmp ne i32 218793738, %2
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 1, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @jp2_read_jp() {
%1 = tail call i32 @cio_read(i32 4)
%2 = icmp ne i32 %1, 218793738
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
unsigned short fgetword(FILE *f) {
  unsigned char b[2];
  fread(b, 2, 1, f);
  return ((unsigned short)b[1] << 8) | (unsigned short)b[0];
}


x86 assembly (clang, -O0):
<fgetword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xa(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movzbl -0x9(%rbp),%eax
movzwl %ax,%eax
shl    $0x8,%eax
movzbl -0xa(%rbp),%ecx
movzwl %cx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgetword>:
push   %rax
mov    %rdi,%rcx
lea    0x6(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movzwl 0x6(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i16 @fgetword(i32* %0) {
%2 = alloca i32*
%3 = alloca [2 x i8]
store i32* %0, i32** %2
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = load i32*, i32** %2
%6 = call i32 @fread(i8* %4, i32 2, i32 1, i32* %5)
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i16
%10 = zext i16 %9 to i32
%11 = shl i32 %10, 8
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%13 = load i8, i8* %12
%14 = zext i8 %13 to i16
%15 = zext i16 %14 to i32
%16 = or i32 %11, %15
%17 = trunc i32 %16 to i16
ret i16 %17
}

LLVM IR (-O2):
define zeroext i16 @fgetword(i32* nocapture %0) {
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%4 = call i32 @fread(i8* %3, i32 2, i32 1, i32* %0)
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i16
%8 = shl nuw i16 %7, 8
%9 = load i8, i8* %3
%10 = zext i8 %9 to i16
%11 = or i16 %8, %10
ret i16 %11
}
int utf32_len(int *str) {
  int len;
  for (len = 0; str[len]; len++)
    ;
  return len;
}


x86 assembly (clang, -O0):
<utf32_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1134 <utf32_len+0x34>
jmp    1126 <utf32_len+0x26>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <utf32_len+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf32_len>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpl   $0x0,(%rdi)
lea    0x4(%rdi),%rdi
jne    1110 <utf32_len+0x10>
ret

LLVM IR (-O0):
define i32 @utf32_len(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32*, i32** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %4
br label %12
12: ; preds = %11
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @utf32_len(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
size_t ft_strlen(const char *str) {
  size_t i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<ft_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1136 <ft_strlen+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <ft_strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @ft_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
void __lwpval32(unsigned int, unsigned int, int);
void ___lwpval32(unsigned int A, unsigned int B, int const I) {
  return __lwpval32(A, B, 1);
}


x86 assembly (clang, -O0):
<___lwpval32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x1,%edx
call   1030 <__lwpval32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<___lwpval32>:
mov    $0x1,%edx
jmp    1030 <__lwpval32@plt>

LLVM IR (-O0):
define void @___lwpval32(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
ret void
}

LLVM IR (-O2):
define void @___lwpval32(i32 %0, i32 %1, i32 %2) {
tail call void @__lwpval32(i32 %0, i32 %1, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ kill_hostapd();
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
int /*<<< orphan*/ sleep(int);
void sig_from_hostapd(int sig_num) {
  signal(SIGUSR1, sig_from_hostapd);
  sleep(1);
  kill_hostapd();
}


x86 assembly (clang, -O0):
<sig_from_hostapd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    0x2e8d(%rip),%rsi
call   1030 <signal@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x0,%al
call   1040 <kill_hostapd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_from_hostapd>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    0x2e97(%rip),%rsi
call   1030 <signal@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <kill_hostapd@plt>

LLVM IR (-O0):
@SIGUSR1 = global i32 0
define void @sig_from_hostapd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SIGUSR1
%4 = call i32 @signal(i32 %3, void (i32)* @sig_from_hostapd)
%5 = call i32 @sleep(i32 1)
%6 = call i32 (...) @kill_hostapd()
ret void
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
define void @sig_from_hostapd(i32 %0) {
%2 = load i32, i32* @SIGUSR1
%3 = tail call i32 @signal(i32 %2, void (i32)* @sig_from_hostapd)
%4 = tail call i32 @sleep(i32 1)
%5 = tail call i32 (...) @kill_hostapd()
ret void
}
void i40e_qv_init_lock(struct i40e_q_vector *q_vector) {}


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

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

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

LLVM IR (-O2):
%struct.i40e_q_vector = type opaque
define void @i40e_qv_init_lock(%struct.i40e_q_vector* nocapture %0) {
ret void
}
/* Variables and functions */
char *strcpy(int /*<<< orphan*/, char const *);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ xmalloc(scalar_t__);
char *xstrdup(const char *string) {
  return strcpy(xmalloc(strlen(string) + 1), string);
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <xmalloc@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <xmalloc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = add nsw i64 %4, 1
%6 = call i32 @xmalloc(i64 %5)
%7 = load i8*, i8** %2
%8 = call i8* @strcpy(i32 %6, i8* %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i32 @xmalloc(i64 %3)
%5 = tail call i8* @strcpy(i32 %4, i8* %0)
ret i8* %5
}
/* Variables and functions */
int server();
int main() { return server(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @server()
ret i32 %1
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t ses_config_enclosure_descriptor_process_identifier(uint8_t *data) {
  return (data[0] >> 4) & 0x7;
}


x86 assembly (clang, -O0):
<ses_config_enclosure_descriptor_process_identifier>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sar    $0x4,%eax
and    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ses_config_enclosure_descriptor_process_identifier>:
mov    (%rdi),%eax
shr    $0x4,%eax
and    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @ses_config_enclosure_descriptor_process_identifier(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = ashr i32 %5, 4
%7 = and i32 %6, 7
ret i32 %7
}

LLVM IR (-O2):
define i32 @ses_config_enclosure_descriptor_process_identifier(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = lshr i32 %2, 4
%4 = and i32 %3, 7
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_cond_signal() {
  printf("NOT IMPLEMENTED:"
         "pa_cond_signal"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"NOT IMPLEMENTED:pa_cond_signal\0A\00"
define i32 @pa_cond_signal() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [31 x i8] c"NOT IMPLEMENTED:pa_cond_signal\00"
define i32 @pa_cond_signal() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void invlpg(void *addr) {
  __asm __volatile("invlpg (%0)" : : "r"(addr) : "memory");
}


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

x86 assembly (clang, -O2):
<invlpg>:
invlpg (%rdi)
ret

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

LLVM IR (-O2):
define void @invlpg(i8* %0) {
tail call void asm sideeffect "invlpg ($0)", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_data(unsigned int, unsigned int);
void print_primes(unsigned int *primes, unsigned int max) {
  unsigned int i;
  for (i = 0; i < max; ++i) {
    write_data(i, primes[i]);
  }
}


x86 assembly (clang, -O0):
<print_primes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1152 <print_primes+0x42>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1030 <write_data@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_primes+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_primes>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1144 <print_primes+0x34>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%esi
mov    %ebx,%edi
call   1030 <write_data@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <print_primes+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @print_primes(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @write_data(i32 %11, i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @print_primes(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @write_data(i32 %10, i32 %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
size_t data2string_length(const void *data, size_t size) {
  size_t length;
  if (data == NULL || size == 0)
    return 0;
  length = size * 2 + 1;
  return length;
}


x86 assembly (clang, -O0):
<data2string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1122 <data2string_length+0x22>
cmpq   $0x0,-0x18(%rbp)
jne    112f <data2string_length+0x2f>
movq   $0x0,-0x8(%rbp)
jmp    1147 <data2string_length+0x47>
mov    -0x18(%rbp),%rax
shl    $0x1,%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<data2string_length>:
test   %rsi,%rsi
lea    0x1(%rsi,%rsi,1),%rax
cmove  %rsi,%rax
test   %rdi,%rdi
cmove  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @data2string_length(i8* readnone %0, i64 %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
%6 = shl i64 %1, 1
%7 = or i64 %6, 1
%8 = select i1 %5, i64 0, i64 %7
ret i64 %8
}
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  unsigned long local1;
  {
    state[0UL] = (input[0UL] | 51238316UL) >> 3UL;
    local1 = 0UL;
    while (local1 < 1UL) {
      state[0UL] <<= ((state[0UL] >> 3UL) & 7UL) | 1UL;
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] | 515147141UL) & 696145614UL;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
or     $0x30dd5ac,%rax
shr    $0x3,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x1,-0x20(%rbp)
jae    1160 <RandomFunc+0x60>
mov    -0x18(%rbp),%rcx
shr    $0x3,%rcx
and    $0x7,%rcx
or     $0x1,%rcx
mov    -0x18(%rbp),%rax
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    1129 <RandomFunc+0x29>
mov    -0x18(%rbp),%rcx
or     $0x1eb48585,%rcx
and    $0x297e56ce,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    (%rdi),%eax
shl    $0x4,%eax
and    $0x1020000,%eax
or     $0x287c5684,%rax
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca [1 x i64]
%6 = alloca i64
store i64* %0, i64** %3
store i64* %1, i64** %4
%7 = load i64*, i64** %3
%8 = getelementptr inbounds i64, i64* %7, i64 0
%9 = load i64, i64* %8
%10 = or i64 %9, 51238316
%11 = lshr i64 %10, 3
%12 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
store i64 %11, i64* %12
store i64 0, i64* %6
br label %13
13: ; preds = %16, %2
%14 = load i64, i64* %6
%15 = icmp ult i64 %14, 1
br i1 %15, label %16, label %27
16: ; preds = %13
%17 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%18 = load i64, i64* %17
%19 = lshr i64 %18, 3
%20 = and i64 %19, 7
%21 = or i64 %20, 1
%22 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%23 = load i64, i64* %22
%24 = shl i64 %23, %21
store i64 %24, i64* %22
%25 = load i64, i64* %6
%26 = add i64 %25, 2
store i64 %26, i64* %6
br label %13
27: ; preds = %13
%28 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%29 = load i64, i64* %28
%30 = or i64 %29, 515147141
%31 = and i64 %30, 696145614
%32 = load i64*, i64** %4
%33 = getelementptr inbounds i64, i64* %32, i64 0
store i64 %31, i64* %33
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i64* nocapture %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = shl i64 %3, 4
%5 = and i64 %4, 16908288
%6 = or i64 %5, 679237252
store i64 %6, i64* %1
ret void
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(long *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *time2str(long time, char *buf) {
  struct tm *t = localtime(&time);
  strftime(buf, 32, "%Y-%m-%d-%H:%M:%S", t);
  return buf;
}


x86 assembly (clang, -O0):
<time2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x20,%esi
lea    0xeaf(%rip),%rdx
call   1040 <strftime@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time2str>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xec2(%rip),%rdx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %rax,%rcx
call   1040 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d-%H:%M:%S\00"
define i8* @time2str(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca %struct.tm*
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = call %struct.tm* @localtime(i64* %3)
store %struct.tm* %6, %struct.tm** %5
%7 = load i8*, i8** %4
%8 = load %struct.tm*, %struct.tm** %5
%9 = call i32 @strftime(i8* %7, i32 32, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
%10 = load i8*, i8** %4
ret i8* %10
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d-%H:%M:%S\00"
define i8* @time2str(i64 %0, i8* returned %1) {
%3 = alloca i64
store i64 %0, i64* %3
%4 = call %struct.tm* @localtime(i64* %3)
%5 = call i32 @strftime(i8* %1, i32 32, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
ret i8* %1
}
/* Variables and functions */
void *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, void *);
void *realloc(void *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  void *ptr = NULL;
  ptr = realloc(ptr, 0);
  printf("realloc(NULL, 0)  --  pointer = %p\n", ptr);
  ptr = malloc(0);
  printf("malloc(0)  --  pointer = %p\n", ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1050 <realloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1050 <realloc@plt>
lea    0xebf(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
lea    0xecd(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"realloc(NULL, 0) -- pointer = %p\0A\00"
@.str.1 = [29 x i8] c"malloc(0) -- pointer = %p\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%7 = load i8*, i8** %6
%8 = call i8* @realloc(i8* %7, i32 0)
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i8* @malloc(i32 0)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"realloc(NULL, 0) -- pointer = %p\0A\00"
@.str.1 = [29 x i8] c"malloc(0) -- pointer = %p\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @realloc(i8* null, i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i8* @malloc(i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret i32 0
}
int genRegister() {
  static int i = -1;
  i++;
  return i;
}


x86 assembly (clang, -O0):
<genRegister>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f0d(%rip)
mov    0x2f07(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<genRegister>:
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
ret

LLVM IR (-O0):
@genRegister.i = internal global i32 -1
define i32 @genRegister() {
%1 = load i32, i32* @genRegister.i
%2 = add nsw i32 %1, 1
store i32 %2, i32* @genRegister.i
%3 = load i32, i32* @genRegister.i
ret i32 %3
}

LLVM IR (-O2):
@genRegister.i = internal unnamed_addr global i32 -1
define i32 @genRegister() {
%1 = load i32, i32* @genRegister.i
%2 = add nsw i32 %1, 1
store i32 %2, i32* @genRegister.i
ret i32 %2
}