xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr8setBank0(int);
int /*<<< orphan*/ prg32setBank0(int);
void m107_setParams(uint16_t addr, uint8_t val) {
  (void)addr;
  prg32setBank0((val >> 1) << 15);
  chr8setBank0(val << 13);
}


x86 assembly (clang, -O0):
<m107_setParams>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
sar    $0x1,%edi
shl    $0xf,%edi
call   1030 <prg32setBank0@plt>
mov    -0x8(%rbp),%edi
shl    $0xd,%edi
call   1040 <chr8setBank0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m107_setParams>:
push   %rbx
mov    %esi,%ebx
mov    %esi,%edi
and    $0xfffffffe,%edi
shl    $0xe,%edi
call   1030 <prg32setBank0@plt>
shl    $0xd,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <chr8setBank0@plt>

LLVM IR (-O0):
define void @m107_setParams(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 = ashr i32 %6, 1
%8 = shl i32 %7, 15
%9 = call i32 @prg32setBank0(i32 %8)
%10 = load i32, i32* %4
%11 = shl i32 %10, 13
%12 = call i32 @chr8setBank0(i32 %11)
ret void
}

LLVM IR (-O2):
define void @m107_setParams(i32 %0, i32 %1) {
%3 = shl i32 %1, 14
%4 = and i32 %3, -32768
%5 = tail call i32 @prg32setBank0(i32 %4)
%6 = shl i32 %1, 13
%7 = tail call i32 @chr8setBank0(i32 %6)
ret void
}
/* Variables and functions */
int rand();
int rand_int(int a, int b) { return rand() % (b - a + 1) + a; }


x86 assembly (clang, -O0):
<rand_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_int>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rand_int(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rand_int(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
int init(const char *str) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @init(i8* nocapture readnone %0) {
ret i32 1
}
void ff_hevc_put_hevc_uni_w_qpel_h24_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_qpel_h24_8_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *astring = "I am somwhere in memory.";
  intptr_t location = (intptr_t)astring;
  printf("%s\n", (char *)location);
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"I am somwhere in memory.\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = load i8*, i8** %1
%4 = ptrtoint i8* %3 to i64
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = inttoptr i64 %5 to i8*
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"I am somwhere in memory.\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int compare_doubles(const void *restrict a, const void *restrict b) {
  double arg1 = *(const double *restrict)a;
  double arg2 = *(const double *restrict)b;
  if (arg1 < arg2)
    return -1;
  if (arg1 > arg2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<compare_doubles>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1146 <compare_doubles+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <compare_doubles+0x69>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1162 <compare_doubles+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1169 <compare_doubles+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_doubles>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare_doubles(i8* noalias %0, i8* noalias %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
store double %10, double* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fcmp olt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load double, double* %6
%20 = load double, double* %7
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @compare_doubles(i8* noalias nocapture %0, i8* noalias nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp olt double %4, %6
%8 = fcmp ogt double %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ annoying(int);
int main(void) {
  annoying(30);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1e,%edi
call   1030 <annoying@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @annoying(i32 30)
ret i32 0
}
int doSetUnset(unsigned int *bitset, unsigned int mask, int value) {
  if (value)
    (*bitset) |= mask;
  else
    (*bitset) &= (~mask);
  return 1;
}


x86 assembly (clang, -O0):
<doSetUnset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1128 <doSetUnset+0x28>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
jmp    1136 <doSetUnset+0x36>
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<doSetUnset>:
test   %edx,%edx
je     1108 <doSetUnset+0x8>
or     (%rdi),%esi
jmp    110c <doSetUnset+0xc>
not    %esi
and    (%rdi),%esi
mov    %esi,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @doSetUnset(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* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32, i32* %5
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = or i32 %12, %10
store i32 %13, i32* %11
br label %20
14: ; preds = %3
%15 = load i32, i32* %5
%16 = xor i32 %15, -1
%17 = load i32*, i32** %4
%18 = load i32, i32* %17
%19 = and i32 %18, %16
store i32 %19, i32* %17
br label %20
20: ; preds = %14, %9
ret i32 1
}

LLVM IR (-O2):
define i32 @doSetUnset(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = load i32, i32* %0
%7 = or i32 %6, %1
br label %12
8: ; preds = %3
%9 = xor i32 %1, -1
%10 = load i32, i32* %0
%11 = and i32 %10, %9
br label %12
12: ; preds = %8, %5
%13 = phi i32 [ %11, %8 ], [ %7, %5 ]
store i32 %13, i32* %0
ret i32 1
}
/* Type definitions */
struct statfs {
  int dummy;
};

/* Variables and functions */
int statfs(char const *, struct statfs *);
int __statfs(const char *file, struct statfs *buf) { return statfs(file, buf); }


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

x86 assembly (clang, -O2):
<__statfs>:
jmp    1030 <statfs@plt>

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

LLVM IR (-O2):
%struct.statfs = type { i32 }
define i32 @__statfs(i8* %0, %struct.statfs* %1) {
%3 = tail call i32 @statfs(i8* %0, %struct.statfs* %1)
ret i32 %3
}
/* Variables and functions */
int strncmp(char const *, char *, int);
int _check_result(const char *s, char *line) { return strncmp(s, line, 2); }


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

x86 assembly (clang, -O2):
<_check_result>:
mov    $0x2,%edx
jmp    1030 <strncmp@plt>

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

LLVM IR (-O2):
define i32 @_check_result(i8* %0, i8* %1) {
%3 = tail call i32 @strncmp(i8* %0, i8* %1, i32 2)
ret i32 %3
}
/* Type definitions */
struct fid_pep {
  int dummy;
};
struct fid_fabric {
  int dummy;
};
struct fi_info {
  int dummy;
};

/* Variables and functions */
int gnix_passive_ep_open(struct fid_fabric *, struct fi_info *,
                         struct fid_pep **, void *);
int fi_passive_ep(struct fid_fabric *fabric, struct fi_info *info,
                  struct fid_pep **pep, void *context) {
  return gnix_passive_ep_open(fabric, info, pep, context);
}


x86 assembly (clang, -O0):
<fi_passive_ep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <gnix_passive_ep_open@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fi_passive_ep>:
jmp    1030 <gnix_passive_ep_open@plt>

LLVM IR (-O0):
%struct.fid_fabric = type { i32 }
%struct.fi_info = type { i32 }
%struct.fid_pep = type { i32 }
define i32 @fi_passive_ep(%struct.fid_fabric* %0, %struct.fi_info* %1, %struct.fid_pep** %2, i8* %3) {
%5 = alloca %struct.fid_fabric*
%6 = alloca %struct.fi_info*
%7 = alloca %struct.fid_pep**
%8 = alloca i8*
store %struct.fid_fabric* %0, %struct.fid_fabric** %5
store %struct.fi_info* %1, %struct.fi_info** %6
store %struct.fid_pep** %2, %struct.fid_pep*** %7
store i8* %3, i8** %8
%9 = load %struct.fid_fabric*, %struct.fid_fabric** %5
%10 = load %struct.fi_info*, %struct.fi_info** %6
%11 = load %struct.fid_pep**, %struct.fid_pep*** %7
%12 = load i8*, i8** %8
%13 = call i32 @gnix_passive_ep_open(%struct.fid_fabric* %9, %struct.fi_info* %10, %struct.fid_pep** %11, i8* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.fid_fabric = type { i32 }
%struct.fi_info = type { i32 }
%struct.fid_pep = type { i32 }
define i32 @fi_passive_ep(%struct.fid_fabric* %0, %struct.fi_info* %1, %struct.fid_pep** %2, i8* %3) {
%5 = tail call i32 @gnix_passive_ep_open(%struct.fid_fabric* %0, %struct.fi_info* %1, %struct.fid_pep** %2, i8* %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int a = 5;
  int b = 10;
  printf("5 + 10 = %i\n", 5 + 10);
  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)
movl   $0x5,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
lea    0xec5(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"5 + 10 = %i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 15)
ret i32 0
}
/* Type definitions */
struct jx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ jx_double(double);
int /*<<< orphan*/ jx_insert(struct jx *, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ jx_string(char const *);
void jx_insert_double(struct jx *j, const char *key, double value) {
  jx_insert(j, jx_string(key), jx_double(value));
}


x86 assembly (clang, -O0):
<jx_insert_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <jx_string@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <jx_double@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   1040 <jx_insert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jx_insert_double>:
push   %rbp
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1050 <jx_string@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
call   1030 <jx_double@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <jx_insert@plt>

LLVM IR (-O0):
%struct.jx = type { i32 }
define void @jx_insert_double(%struct.jx* %0, i8* %1, double %2) {
%4 = alloca %struct.jx*
%5 = alloca i8*
%6 = alloca double
store %struct.jx* %0, %struct.jx** %4
store i8* %1, i8** %5
store double %2, double* %6
%7 = load %struct.jx*, %struct.jx** %4
%8 = load i8*, i8** %5
%9 = call i32 @jx_string(i8* %8)
%10 = load double, double* %6
%11 = call i32 @jx_double(double %10)
%12 = call i32 @jx_insert(%struct.jx* %7, i32 %9, i32 %11)
ret void
}

LLVM IR (-O2):
%struct.jx = type { i32 }
define void @jx_insert_double(%struct.jx* %0, i8* %1, double %2) {
%4 = tail call i32 @jx_string(i8* %1)
%5 = tail call i32 @jx_double(double %2)
%6 = tail call i32 @jx_insert(%struct.jx* %0, i32 %4, i32 %5)
ret void
}
int(cstrlen)(const char *s) {
  const char *p = s;
  while (*p != '\0')
    p++;
  return (int)(p - s);
}


x86 assembly (clang, -O0):
<cstrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1131 <cstrlen+0x31>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <cstrlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cstrlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ isxdigit(unsigned char const);
int hex_digits(unsigned char const *s) {
  while (*s) {
    if (!(isxdigit(*s)))
      return 0;
    ++s;
  }
  return 1;
}


x86 assembly (clang, -O0):
<hex_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <hex_digits+0x4b>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%eax
jne    114a <hex_digits+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1162 <hex_digits+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <hex_digits+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_digits>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <hex_digits+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl %al,%edi
call   1030 <isxdigit@plt>
test   %eax,%eax
je     1149 <hex_digits+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <hex_digits+0x20>
jmp    114b <hex_digits+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @hex_digits(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isxdigit(i8 zeroext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t unfoldSigned(uint64_t x) {
  return ((x & 1) == 1) ? (x + 1) / 2 : -(x / 2);
}


x86 assembly (clang, -O0):
<unfoldSigned>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    112c <unfoldSigned+0x2c>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1140 <unfoldSigned+0x40>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unfoldSigned>:
test   $0x1,%dil
jne    1112 <unfoldSigned+0x12>
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
neg    %eax
ret
mov    %edi,%eax
add    $0x1,%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0x1,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @unfoldSigned(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
%9 = sdiv i32 %8, 2
br label %14
10: ; preds = %1
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 2
%13 = sub nsw i32 0, %12
br label %14
14: ; preds = %10, %6
%15 = phi i32 [ %9, %6 ], [ %13, %10 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @unfoldSigned(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = add nsw i32 %0, 1
%6 = sdiv i32 %5, 2
br label %9
7: ; preds = %1
%8 = sdiv i32 %0, -2
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ %6, %4 ], [ %8, %7 ]
ret i32 %10
}
int func1() { return 1; }


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

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

LLVM IR (-O0):
define i32 @func1() {
ret i32 1
}

LLVM IR (-O2):
define i32 @func1() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ NOROM_CPUcpsid();
void SysCtrlSystemReset(void) {
  NOROM_CPUcpsid();
  (*((volatile unsigned long
          *)(((unsigned long)(0x40090000 + 0x00000028) & 0xF0000000) |
             0x02000000 |
             (((unsigned long)(0x40090000 + 0x00000028) & 0x000FFFFF) << 5) |
             ((31) << 2)))) = 1;
  while (1) {
  }
}


x86 assembly (clang, -O0):
<SysCtrlSystemReset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <NOROM_CPUcpsid@plt>
mov    $0x4320057c,%eax
movq   $0x1,(%rax)
jmp    1127 <SysCtrlSystemReset+0x17>

x86 assembly (clang, -O2):
<SysCtrlSystemReset>:
push   %rax
xor    %eax,%eax
call   1030 <NOROM_CPUcpsid@plt>
movq   $0x1,0x4320057c
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1130 <SysCtrlSystemReset+0x20>

LLVM IR (-O0):
define void @SysCtrlSystemReset() {
%1 = call i32 (...) @NOROM_CPUcpsid()
store volatile i64 1, i64* inttoptr (i64 1126172028 to i64*)
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define void @SysCtrlSystemReset() {
%1 = tail call i32 (...) @NOROM_CPUcpsid()
store volatile i64 1, i64* inttoptr (i64 1126172028 to i64*)
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
int partition(int *, int, int);
void quick_sort(int array[], int start, int end) {
  if (start < end) {
    int sorted_pivot_idx = partition(array, start, end);
    quick_sort(array, start, sorted_pivot_idx - 1);
    quick_sort(array, sorted_pivot_idx + 1, end);
  }
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
int test_imm_E0int64_lowword_mem(long long *val) {
  return ((*val) & (0xE0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E0int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 224
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ do_send(int, char *);
void japi_resume_recog(int sd) { do_send(sd, "RESUME\n"); }


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

x86 assembly (clang, -O2):
<japi_resume_recog>:
lea    0xee9(%rip),%rsi
jmp    1030 <do_send@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"RESUME\0A\00"
define void @japi_resume_recog(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @do_send(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"RESUME\0A\00"
define void @japi_resume_recog(i32 %0) {
%2 = tail call i32 @do_send(i32 %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int _check_times(unsigned x, unsigned y) {
  unsigned long long whole_ans =
      ((unsigned long long)x) * ((unsigned long long)y);
  unsigned word_ans = (unsigned)whole_ans;
  if (word_ans < whole_ans || word_ans > (1 << 28))
    (_throw_badalloc_fn("/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/"
                        "cyclone/refs/heads/master/bin/genfiles/pratt_prover.c",
                        284));
  return word_ans;
}


x86 assembly (clang, -O0):
<_check_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jb     114d <_check_times+0x3d>
cmpl   $0x10000000,-0x14(%rbp)
jbe    1160 <_check_times+0x50>
lea    0xeac(%rip),%rdi
mov    $0x11c,%esi
mov    $0x0,%al
call   1030 <_throw_badalloc_fn@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_times>:
push   %rbx
mov    %edi,%eax
mul    %esi
mov    %eax,%ebx
jo     1121 <_check_times+0x11>
cmp    $0x10000001,%ebx
jb     1134 <_check_times+0x24>
lea    0xed8(%rip),%rdi
mov    $0x11c,%esi
xor    %eax,%eax
call   1030 <_throw_badalloc_fn@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/pratt_prover.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = mul i64 %8, %10
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %6
%20 = icmp ugt i32 %19, 268435456
br i1 %20, label %21, label %23
21: ; preds = %18, %2
%22 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 284)
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/pratt_prover.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%4 = extractvalue { i32, i1 } %3, 0
%5 = extractvalue { i32, i1 } %3, 1
%6 = icmp ugt i32 %4, 268435456
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 284)
br label %10
10: ; preds = %2, %8
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ IPC_RMID;
int semctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int sr_sem_close(int semid) { return semctl(semid, 0, IPC_RMID); }


x86 assembly (clang, -O0):
<sr_sem_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <semctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_sem_close>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
jmp    1030 <semctl@plt>

LLVM IR (-O0):
@IPC_RMID = global i32 0
define i32 @sr_sem_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @IPC_RMID
%5 = call i32 @semctl(i32 %3, i32 0, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@IPC_RMID = global i32 0
define i32 @sr_sem_close(i32 %0) {
%2 = load i32, i32* @IPC_RMID
%3 = tail call i32 @semctl(i32 %0, i32 0, i32 %2)
ret i32 %3
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int fstat(int, struct stat *);
int open(char const *, int /*<<< orphan*/);
int stat(const char *path, struct stat *buf) {
  int fd = open(path, O_RDONLY);
  int r;
  if (fd < 0)
    return fd;
  r = fstat(fd, buf);
  close(fd);
  return r;
}


x86 assembly (clang, -O0):
<stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    116a <stat+0x3a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1187 <stat+0x57>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <fstat@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <close@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stat>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1161 <stat+0x31>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <fstat@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <close@plt>
mov    %ebx,%eax
jmp    1163 <stat+0x33>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@O_RDONLY = global i32 0
define i32 @stat(i8* %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.stat*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store %struct.stat* %1, %struct.stat** %5
%8 = load i8*, i8** %4
%9 = load i32, i32* @O_RDONLY
%10 = call i32 @open(i8* %8, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %6
store i32 %14, i32* %3
br label %22
15: ; preds = %2
%16 = load i32, i32* %6
%17 = load %struct.stat*, %struct.stat** %5
%18 = call i32 @fstat(i32 %16, %struct.stat* %17)
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = call i32 @close(i32 %19)
%21 = load i32, i32* %7
store i32 %21, i32* %3
br label %22
22: ; preds = %15, %13
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@O_RDONLY = global i32 0
define i32 @stat(i8* nocapture %0, %struct.stat* nocapture %1) {
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* %0, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @fstat(i32 %4, %struct.stat* %1)
%8 = tail call i32 @close(i32 %4)
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ %7, %6 ], [ %4, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void usage(void) { fputs("Usage: COMMAND <if_name>\n", stderr); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: COMMAND <if_name>\0A\00"
@stderr = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Usage: COMMAND <if_name>\0A\00"
@stderr = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello() { printf("Hello World!\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello World!\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ bam_swap_endian_2(int /*<<< orphan*/);
void *bam_swap_endian_2p(void *x) {
  *(uint16_t *)x = bam_swap_endian_2(*(uint16_t *)x);
  return x;
}


x86 assembly (clang, -O0):
<bam_swap_endian_2p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <bam_swap_endian_2@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bam_swap_endian_2p>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <bam_swap_endian_2@plt>
mov    %eax,(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @bam_swap_endian_2p(i8* returned %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @bam_swap_endian_2(i32 %3)
store i32 %4, i32* %2
ret i8* %0
}
int test_imm_DBint8_mem(signed char *val) {
  return ((*val) & (0xDB << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_DBint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -37
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void _Block_assign_weak_default(const void *ptr, void *dest) {
  *(long *)dest = (long)ptr;
}


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

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

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

LLVM IR (-O2):
define void @_Block_assign_weak_default(i8* %0, i8* nocapture writeonly %1) {
%3 = ptrtoint i8* %0 to i64
%4 = bitcast i8* %1 to i64*
store i64 %3, i64* %4
ret void
}
int main() {
  char out = 0x55;
  __asm__("movl $0x42, %%eax; cmpl $0x42, %%eax; seto %%al" : "=a"(out));
  return out;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movb   $0x55,-0x5(%rbp)
mov    $0x42,%eax
cmp    $0x42,%eax
seto   %al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x42,%eax
cmp    $0x42,%eax
seto   %al
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 85, i8* %2
%3 = call i8 asm "movl $$0x42, %eax; cmpl $$0x42, %eax; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8 asm "movl $$0x42, %eax; cmpl $$0x42, %eax; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
%2 = sext i8 %1 to i32
ret i32 %2
}
void copia(void) {
  int i;
  extern char linea[], linea_max[];
  char *pointer = linea;
  char *target = linea_max;
  while (*pointer != '\0') {
    *target = *pointer;
    pointer += 1;
    target += 1;
  }
}


x86 assembly (clang, -O0):
<copia>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ee5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1153 <copia+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111a <copia+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copia>:
mov    0x2ee9(%rip),%rax
mov    (%rax),%cl
test   %cl,%cl
je     1130 <copia+0x30>
xor    %edx,%edx
mov    0x2ec2(%rip),%rsi
cs nopw 0x0(%rax,%rax,1)
mov    %cl,(%rsi,%rdx,1)
movzbl 0x1(%rax,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1120 <copia+0x20>
ret

LLVM IR (-O0):
@linea = external global [0 x i8]
@linea_max = external global [0 x i8]
define void @copia() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i8* getelementptr inbounds ([0 x i8], [0 x i8]* @linea, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([0 x i8], [0 x i8]* @linea_max, i64 0, i64 0), i8** %3
br label %4
4: ; preds = %9, %0
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = load i8*, i8** %3
store i8 %11, i8* %12
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %14, i8** %2
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %3
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
@linea = external global [0 x i8]
@linea_max = external global [0 x i8]
define void @copia() {
%1 = load i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @linea, i64 0, i64 0)
%2 = icmp eq i8 %1, 0
br i1 %2, label %11, label %3
3: ; preds = %0, %3
%4 = phi i8 [ %9, %3 ], [ %1, %0 ]
%5 = phi i8* [ %8, %3 ], [ getelementptr inbounds ([0 x i8], [0 x i8]* @linea_max, i64 0, i64 0), %0 ]
%6 = phi i8* [ %7, %3 ], [ getelementptr inbounds ([0 x i8], [0 x i8]* @linea, i64 0, i64 0), %0 ]
store i8 %4, i8* %5
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_peer_name(int, char *);
int /*<<< orphan*/ ssgl_log(int, char *, char *, char *);
void log_disconnect(int level, int connection, char *reason) {
  char client_ip[50];
  get_peer_name(connection, client_ip);
  ssgl_log(level, "ssgl_server: Disconnecting from %s, reason: %s\n", client_ip,
           reason);
}


x86 assembly (clang, -O0):
<log_disconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   1030 <get_peer_name@plt>
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb0(%rip),%rsi
call   1040 <ssgl_log@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_disconnect>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%rbx
mov    %edi,%ebp
mov    %rsp,%r14
mov    %esi,%edi
mov    %r14,%rsi
call   1030 <get_peer_name@plt>
lea    0xebf(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1040 <ssgl_log@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"ssgl_server: Disconnecting from %s, reason: %s\0A\00"
define void @log_disconnect(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [50 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %5
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%10 = call i32 @get_peer_name(i32 %8, i8* %9)
%11 = load i32, i32* %4
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = call i32 @ssgl_log(i32 %11, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"ssgl_server: Disconnecting from %s, reason: %s\0A\00"
define void @log_disconnect(i32 %0, i32 %1, i8* %2) {
%4 = alloca [50 x i8]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%6 = call i32 @get_peer_name(i32 %1, i8* %5)
%7 = call i32 @ssgl_log(i32 %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %2)
ret void
}
/* Variables and functions */
int day_of_year(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", day_of_year(2013, 07, 26));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7dd,%edi
mov    $0x7,%esi
mov    $0x1a,%edx
call   1040 <day_of_year@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7dd,%edi
mov    $0x7,%esi
mov    $0x1a,%edx
call   1040 <day_of_year@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @day_of_year(i32 2013, i32 7, i32 26)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ handle_51(int /*<<< orphan*/);
int gen_51() {
  handle_51(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_51>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_51@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_51() {
%1 = call i32 @handle_51(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_51() {
%1 = tail call i32 @handle_51(i32 0)
ret i32 0
}
int test_imm_78int16_reg(short val) {
  return ((val) & (-0x78 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_78int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff88,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_78int16_reg>:
test   $0xff88,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_78int16_reg(i16 signext %0) {
%2 = and i16 %0, -120
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}