xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
int main(int argc, const char *argv[]) {
  unsigned long long offset = 0;
  char b;
  int memfd = open("/dev/mem", O_RDONLY);
  while (read(memfd, &b, 1) == 1) {
    ++offset;
  }
  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    0x2ea3(%rip),%rax
mov    (%rax),%esi
lea    0xeb2(%rip),%rdi
call   1040 <open@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x19(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
jne    1181 <main+0x61>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1156 <main+0x36>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1040 <open@plt>
mov    %eax,%ebx
lea    0x7(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
je     1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
%9 = load i32, i32* @O_RDONLY
%10 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 %10, i32* %8
br label %11
11: ; preds = %15, %2
%12 = load i32, i32* %8
%13 = call i32 @read(i32 %12, i8* %7, i32 1)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i64, i64* %6
%17 = add i64 %16, 1
store i64 %17, i64* %6
br label %11
18: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %6, %2
%7 = call i32 @read(i32 %5, i8* %3, i32 1)
%8 = icmp eq i32 %7, 1
br i1 %8, label %6, label %9
9: ; preds = %6
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void log_backend_syslog_close(void) { closelog(); }


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

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

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

LLVM IR (-O2):
define void @log_backend_syslog_close() {
%1 = tail call i32 (...) @closelog()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isupper(int);
void t_isupper_0x41() {
  Assert_real((isupper(65)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isupper.c",
              330, ("isupper should be 1 for A"));
}


x86 assembly (clang, -O0):
<t_isupper_0x41>:
push   %rbp
mov    %rsp,%rbp
mov    $0x41,%edi
call   1030 <isupper@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x14a,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0x41>:
push   %rax
mov    $0x41,%edi
call   1030 <isupper@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x14a,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 1 for A\00"
define void @t_isupper_0x41() {
%1 = call i32 @isupper(i32 65)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 330, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 1 for A\00"
define void @t_isupper_0x41() {
%1 = tail call i32 @isupper(i32 65)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 330, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __CRAB_intrinsic_add_tag(int *, int);
int /*<<< orphan*/ sea_dsa_set_modified(int *);
void init(int *x, int *y, int *i) {
  __CRAB_intrinsic_add_tag(i, 1);
  sea_dsa_set_modified(i);
  ;
  __CRAB_intrinsic_add_tag(x, 2);
  sea_dsa_set_modified(x);
  ;
  __CRAB_intrinsic_add_tag(y, 3);
  sea_dsa_set_modified(y);
  ;
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1040 <__CRAB_intrinsic_add_tag@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sea_dsa_set_modified@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1040 <__CRAB_intrinsic_add_tag@plt>
mov    -0x8(%rbp),%rdi
call   1030 <sea_dsa_set_modified@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <__CRAB_intrinsic_add_tag@plt>
mov    -0x10(%rbp),%rdi
call   1030 <sea_dsa_set_modified@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    $0x1,%esi
call   1040 <__CRAB_intrinsic_add_tag@plt>
mov    %rbx,%rdi
call   1030 <sea_dsa_set_modified@plt>
mov    %r15,%rdi
mov    $0x2,%esi
call   1040 <__CRAB_intrinsic_add_tag@plt>
mov    %r15,%rdi
call   1030 <sea_dsa_set_modified@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   1040 <__CRAB_intrinsic_add_tag@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <sea_dsa_set_modified@plt>

LLVM IR (-O0):
define void @init(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 = call i32 @__CRAB_intrinsic_add_tag(i32* %7, i32 1)
%9 = load i32*, i32** %6
%10 = call i32 @sea_dsa_set_modified(i32* %9)
%11 = load i32*, i32** %4
%12 = call i32 @__CRAB_intrinsic_add_tag(i32* %11, i32 2)
%13 = load i32*, i32** %4
%14 = call i32 @sea_dsa_set_modified(i32* %13)
%15 = load i32*, i32** %5
%16 = call i32 @__CRAB_intrinsic_add_tag(i32* %15, i32 3)
%17 = load i32*, i32** %5
%18 = call i32 @sea_dsa_set_modified(i32* %17)
ret void
}

LLVM IR (-O2):
define void @init(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @__CRAB_intrinsic_add_tag(i32* %2, i32 1)
%5 = tail call i32 @sea_dsa_set_modified(i32* %2)
%6 = tail call i32 @__CRAB_intrinsic_add_tag(i32* %0, i32 2)
%7 = tail call i32 @sea_dsa_set_modified(i32* %0)
%8 = tail call i32 @__CRAB_intrinsic_add_tag(i32* %1, i32 3)
%9 = tail call i32 @sea_dsa_set_modified(i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setup_parent(char *, int, char **);
int main(int argc, char *argv[]) { setup_parent("zeromq", argc, argv); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xed3(%rip),%rdi
call   1030 <setup_parent@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rdx
mov    %edi,%esi
lea    0xee3(%rip),%rdi
call   1030 <setup_parent@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"zeromq\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @setup_parent(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0, i8** %1)
ret i32 0
}
int a_double_cmp(const double *x, const double *y) { return *x - *y; }


x86 assembly (clang, -O0):
<a_double_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_double_cmp>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
cvttsd2si %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @a_double_cmp(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = fptosi double %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
double longBitsToDouble(int);
double pow2i(int q) { return longBitsToDouble(((int64_t)(q + 0x3ff)) << 52); }


x86 assembly (clang, -O0):
<pow2i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x3ff,%edi
mov    $0x34,%ecx
shl    %cl,%edi
call   1030 <longBitsToDouble@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow2i>:
jmp    1030 <longBitsToDouble@plt>

LLVM IR (-O0):
define double @pow2i(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1023
%5 = shl i32 %4, 52
%6 = call double @longBitsToDouble(i32 %5)
ret double %6
}

LLVM IR (-O2):
define double @pow2i(i32 %0) {
%2 = tail call double @longBitsToDouble(i32 poison)
ret double %2
}
/* Type definitions */
struct hostent {
  int dummy;
};
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int _nss_unbit_gethostbyname2_r(char const *, int /*<<< orphan*/,
                                struct hostent *, char *, size_t, int *, int *);
enum nss_status _nss_unbit_gethostbyname_r(const char *name,
                                           struct hostent *result, char *buffer,
                                           size_t buflen, int *errnop,
                                           int *h_errnop) {
  return _nss_unbit_gethostbyname2_r(name, AF_UNSPEC, result, buffer, buflen,
                                     errnop, h_errnop);
}


x86 assembly (clang, -O0):
<_nss_unbit_gethostbyname_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <_nss_unbit_gethostbyname2_r@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_unbit_gethostbyname_r>:
push   %rax
mov    %r8,%rax
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    0x2ec4(%rip),%rsi
mov    (%rsi),%esi
mov    %r9,(%rsp)
mov    %rax,%r9
call   1030 <_nss_unbit_gethostbyname2_r@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.hostent = type { i32 }
@AF_UNSPEC = global i32 0
define i32 @_nss_unbit_gethostbyname_r(i8* %0, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca %struct.hostent*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i32*
store i8* %0, i8** %7
store %struct.hostent* %1, %struct.hostent** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%13 = load i8*, i8** %7
%14 = load i32, i32* @AF_UNSPEC
%15 = load %struct.hostent*, %struct.hostent** %8
%16 = load i8*, i8** %9
%17 = load i64, i64* %10
%18 = load i32*, i32** %11
%19 = load i32*, i32** %12
%20 = call i32 @_nss_unbit_gethostbyname2_r(i8* %13, i32 %14, %struct.hostent* %15, i8* %16, i64 %17, i32* %18, i32* %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
@AF_UNSPEC = global i32 0
define i32 @_nss_unbit_gethostbyname_r(i8* %0, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5) {
%7 = load i32, i32* @AF_UNSPEC
%8 = tail call i32 @_nss_unbit_gethostbyname2_r(i8* %0, i32 %7, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5)
ret i32 %8
}
contadigitos(int n, int d) {
  int conta, resto;
  conta = 0;
  while (n != 0) {
    resto = n % 10;
    n = n / 10;
    if (resto == d)
      conta++;
  }
  return conta;
}


x86 assembly (clang, -O0):
<contadigitos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1151 <contadigitos+0x51>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    114c <contadigitos+0x4c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <contadigitos+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<contadigitos>:
xor    %eax,%eax
test   %edi,%edi
je     1147 <contadigitos+0x47>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%r9
imul   $0x66666667,%r9,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%r8d
mov    %r9d,%edx
sub    %r8d,%edx
xor    %ecx,%ecx
cmp    %esi,%edx
sete   %cl
add    %ecx,%eax
add    $0x9,%r9d
cmp    $0x12,%r9d
ja     1110 <contadigitos+0x10>
ret

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

LLVM IR (-O2):
define i32 @contadigitos(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ 0, %2 ]
%7 = srem i32 %5, 10
%8 = sdiv i32 %5, 10
%9 = icmp eq i32 %7, %1
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %6, %10
%12 = add i32 %5, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %4
14: ; preds = %4, %2
%15 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %15
}
int my_strlen(char *str) {
  int i;
  i = -1;
  if (str)
    while (str[++i] != '\0')
      ;
  return (i);
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1146 <my_strlen+0x46>
jmp    111f <my_strlen+0x1f>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1141 <my_strlen+0x41>
jmp    111f <my_strlen+0x1f>
jmp    1146 <my_strlen+0x46>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     111c <my_strlen+0x1c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <my_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @my_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %5, %3 ], [ -1, %1 ]
%5 = add nsw i64 %4, 1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = trunc i64 %5 to i32
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ -1, %1 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int f281(int *);
int f282(int *p) { return f281(p); }


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

x86 assembly (clang, -O2):
<f282>:
jmp    1030 <f281@plt>

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

LLVM IR (-O2):
define i32 @f282(i32* %0) {
%2 = tail call i32 @f281(i32* %0)
ret i32 %2
}
int neko_can_jit() { return 0; }


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

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

LLVM IR (-O0):
define i32 @neko_can_jit() {
ret i32 0
}

LLVM IR (-O2):
define i32 @neko_can_jit() {
ret i32 0
}
int ft_toupper(int c) { return ((c >= 'a' && c <= 'z') ? (c - 'a' + 'A') : c); }


x86 assembly (clang, -O0):
<ft_toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     112c <ft_toupper+0x2c>
cmpl   $0x7a,-0x4(%rbp)
jg     112c <ft_toupper+0x2c>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <ft_toupper+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Type definitions */
struct iio_device {
  int dummy;
};

/* Variables and functions */
int add_attr_or_channel_helper(struct iio_device *, char const *, int);
int add_attr_or_channel(void *d, const char *path) {
  return add_attr_or_channel_helper((struct iio_device *)d, path, false);
}


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

x86 assembly (clang, -O2):
<add_attr_or_channel>:
xor    %edx,%edx
jmp    1030 <add_attr_or_channel_helper@plt>

LLVM IR (-O0):
%struct.iio_device = type { i32 }
define i32 @add_attr_or_channel(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 = bitcast i8* %5 to %struct.iio_device*
%7 = load i8*, i8** %4
%8 = call i32 @add_attr_or_channel_helper(%struct.iio_device* %6, i8* %7, i32 0)
ret i32 %8
}

LLVM IR (-O2):
%struct.iio_device = type { i32 }
define i32 @add_attr_or_channel(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to %struct.iio_device*
%4 = tail call i32 @add_attr_or_channel_helper(%struct.iio_device* %3, i8* %1, i32 0)
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void USBEndpointDMADisable(uint32_t ui32Base, uint32_t ui32Endpoint,
                           uint32_t ui32Flags) {
  if (ui32Flags & 0x00002000) {
    (*((volatile uint8_t *)(ui32Base + (ui32Endpoint - 0x10) + 0x00000113))) &=
        ~0x00000010;
  } else {
    (*((volatile uint8_t *)(ui32Base + (ui32Endpoint - 0x10) + 0x00000117))) &=
        ~0x00000020;
  }
}


x86 assembly (clang, -O0):
<USBEndpointDMADisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     113c <USBEndpointDMADisable+0x3c>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x113,%eax
cltq
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    %ecx,(%rax)
jmp    1155 <USBEndpointDMADisable+0x55>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x117,%eax
cltq
mov    (%rax),%ecx
and    $0xffffffdf,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDMADisable>:
xor    %eax,%eax
and    $0x2000,%edx
sete   %al
add    %esi,%edi
shr    $0x9,%edx
add    $0xffffffdf,%edx
lea    (%rdi,%rax,4),%eax
add    $0x103,%eax
cltq
and    %edx,(%rax)
ret

LLVM IR (-O0):
define void @USBEndpointDMADisable(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 = and i32 %7, 8192
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 16
%14 = add nsw i32 %11, %13
%15 = add nsw i32 %14, 275
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = and i32 %18, -17
store volatile i32 %19, i32* %17
br label %30
20: ; preds = %3
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 16
%24 = add nsw i32 %21, %23
%25 = add nsw i32 %24, 279
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i32*
%28 = load volatile i32, i32* %27
%29 = and i32 %28, -33
store volatile i32 %29, i32* %27
br label %30
30: ; preds = %20, %10
ret void
}

LLVM IR (-O2):
define void @USBEndpointDMADisable(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 8192
%5 = icmp eq i32 %4, 0
%6 = add i32 %1, %0
%7 = select i1 %5, i32 263, i32 259
%8 = select i1 %5, i32 -33, i32 -17
%9 = add i32 %6, %7
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = and i32 %12, %8
store volatile i32 %13, i32* %11
ret void
}
float dcn_bw_mod(const float arg1, const float arg2) {
  if (((arg1) != (arg1)))
    return arg2;
  if (((arg2) != (arg2)))
    return arg1;
  return arg1 - arg1 * ((int)(arg1 / arg2));
}


x86 assembly (clang, -O0):
<dcn_bw_mod>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jne    1128 <dcn_bw_mod+0x28>
jp     1128 <dcn_bw_mod+0x28>
jmp    1137 <dcn_bw_mod+0x37>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1196 <dcn_bw_mod+0x96>
movss  -0xc(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jne    1151 <dcn_bw_mod+0x51>
jp     1151 <dcn_bw_mod+0x51>
jmp    1160 <dcn_bw_mod+0x60>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1196 <dcn_bw_mod+0x96>
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
divss  -0xc(%rbp),%xmm2
cvttss2si %xmm2,%eax
cvtsi2ss %eax,%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcn_bw_mod>:
ucomiss %xmm0,%xmm0
jp     1124 <dcn_bw_mod+0x24>
ucomiss %xmm1,%xmm1
jp     1121 <dcn_bw_mod+0x21>
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
cvttps2dq %xmm2,%xmm1
cvtdq2ps %xmm1,%xmm1
mulss  %xmm0,%xmm1
subss  %xmm1,%xmm0
ret
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @dcn_bw_mod(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %4
%8 = fcmp une float %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load float, float* %5
store float %10, float* %3
br label %27
11: ; preds = %2
%12 = load float, float* %5
%13 = load float, float* %5
%14 = fcmp une float %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load float, float* %4
store float %16, float* %3
br label %27
17: ; preds = %11
%18 = load float, float* %4
%19 = load float, float* %4
%20 = load float, float* %4
%21 = load float, float* %5
%22 = fdiv float %20, %21
%23 = fptosi float %22 to i32
%24 = sitofp i32 %23 to float
%25 = fneg float %19
%26 = call float @llvm.fmuladd.f32(float %25, float %24, float %18)
store float %26, float* %3
br label %27
27: ; preds = %17, %15, %9
%28 = load float, float* %3
ret float %28
}

LLVM IR (-O2):
define float @dcn_bw_mod(float %0, float %1) {
%3 = fcmp uno float %0, 0.000000e+00
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = fcmp uno float %1, 0.000000e+00
br i1 %5, label %12, label %6
6: ; preds = %4
%7 = fdiv float %0, %1
%8 = fptosi float %7 to i32
%9 = sitofp i32 %8 to float
%10 = fneg float %0
%11 = tail call float @llvm.fmuladd.f32(float %10, float %9, float %0)
br label %12
12: ; preds = %4, %2, %6
%13 = phi float [ %11, %6 ], [ %1, %2 ], [ %0, %4 ]
ret float %13
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ nomem();
void *n_malloc(size_t size) {
  register void *v;
  if ((v = malloc(size)) == NULL)
    nomem();
  return v;
}


x86 assembly (clang, -O0):
<n_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114a <n_malloc+0x2a>
mov    $0x0,%al
call   1030 <nomem@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_malloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <n_malloc+0x15>
xor    %eax,%eax
call   1030 <nomem@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @n_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @nomem()
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define noalias i8* @n_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @nomem()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int nhash_find_insert(int *, int);
int set_lookup(int *lookup_table, int size) {
  return (nhash_find_insert(lookup_table, size));
}


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

x86 assembly (clang, -O2):
<set_lookup>:
jmp    1030 <nhash_find_insert@plt>

LLVM IR (-O0):
define i32 @set_lookup(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 @nhash_find_insert(i32* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @set_lookup(i32* %0, i32 %1) {
%3 = tail call i32 @nhash_find_insert(i32* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int val;
  int *ptr_val;
  printf("please enter variable val please: \n");
  scanf("%d", &val);
  *ptr_val = val + 1;
  printf("ptr_val is: %d\n", *ptr_val);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"please enter variable val please: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"ptr_val is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
%8 = load i32*, i32** %3
store i32 %7, i32* %8
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [35 x i8] c"please enter variable val please: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int wl_ioctl(char const *, int, int *, int);
int wl_get_channel(const char *ifname, int *buf) {
  return wl_ioctl(ifname, 29, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<wl_get_channel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x1d,%esi
mov    $0x8,%ecx
call   1030 <wl_ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_get_channel>:
mov    %rsi,%rdx
mov    $0x1d,%esi
mov    $0x8,%ecx
jmp    1030 <wl_ioctl@plt>

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

LLVM IR (-O2):
define i32 @wl_get_channel(i8* %0, i32* %1) {
%3 = tail call i32 @wl_ioctl(i8* %0, i32 29, i32* %1, i32 8)
ret i32 %3
}
void avio_handshake() {}


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

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

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

LLVM IR (-O2):
define void @avio_handshake() {
ret void
}
int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) { return 0; }


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

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

LLVM IR (-O0):
%struct.snd_card = type opaque
%struct.snd_ac97 = type opaque
define i32 @olpc_quirks(%struct.snd_card* %0, %struct.snd_ac97* %1) {
%3 = alloca %struct.snd_card*
%4 = alloca %struct.snd_ac97*
store %struct.snd_card* %0, %struct.snd_card** %3
store %struct.snd_ac97* %1, %struct.snd_ac97** %4
ret i32 0
}

LLVM IR (-O2):
%struct.snd_card = type opaque
%struct.snd_ac97 = type opaque
define i32 @olpc_quirks(%struct.snd_card* nocapture readnone %0, %struct.snd_ac97* nocapture readnone %1) {
ret i32 0
}
int phy_resume(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @phy_resume() {
ret i32 0
}

LLVM IR (-O2):
define i32 @phy_resume() {
ret i32 0
}
/* Variables and functions */
void *malloc(unsigned int);
void *yh_c_buffer_malloc(unsigned int size) {
  void *p = malloc(size);
  return p;
}


x86 assembly (clang, -O0):
<yh_c_buffer_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yh_c_buffer_malloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @yh_c_buffer_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookinteger16array_(char *x, unsigned int *n) { lookNarray(x, (*n * 16)); }


x86 assembly (clang, -O0):
<lookinteger16array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x4,%esi
call   1030 <lookNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookinteger16array_>:
mov    (%rsi),%esi
shl    $0x4,%esi
jmp    1030 <lookNarray@plt>

LLVM IR (-O0):
define void @lookinteger16array_(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = mul i32 %7, 16
%9 = call i32 @lookNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @lookinteger16array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 4
%5 = tail call i32 @lookNarray(i8* %0, i32 %4)
ret void
}
void up(struct semaphore *disks_sem) { return; }


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

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

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

LLVM IR (-O2):
%struct.semaphore = type opaque
define void @up(%struct.semaphore* nocapture %0) {
ret void
}
void UI_CalcPostGameStats() {}


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

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

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

LLVM IR (-O2):
define void @UI_CalcPostGameStats() {
ret void
}
int if_else(int n) {
  int cost;
  if (n > 500)
    cost = 150;
  else if (n > 300)
    cost = 100;
  else if (n > 100)
    cost = 75;
  else if (n > 50)
    cost = 50;
  else
    cost = 0;
  return cost;
}


x86 assembly (clang, -O0):
<if_else>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1f4,-0x4(%rbp)
jle    1120 <if_else+0x20>
movl   $0x96,-0x8(%rbp)
jmp    117b <if_else+0x7b>
cmpl   $0x12c,-0x4(%rbp)
jle    1139 <if_else+0x39>
movl   $0x64,-0x8(%rbp)
jmp    1176 <if_else+0x76>
cmpl   $0x64,-0x4(%rbp)
jle    114f <if_else+0x4f>
movl   $0x4b,-0x8(%rbp)
jmp    1171 <if_else+0x71>
cmpl   $0x32,-0x4(%rbp)
jle    1165 <if_else+0x65>
movl   $0x32,-0x8(%rbp)
jmp    116c <if_else+0x6c>
movl   $0x0,-0x8(%rbp)
jmp    1171 <if_else+0x71>
jmp    1176 <if_else+0x76>
jmp    117b <if_else+0x7b>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<if_else>:
mov    $0x96,%eax
cmp    $0x1f4,%edi
jg     1131 <if_else+0x31>
mov    $0x64,%eax
cmp    $0x12c,%edi
jg     1131 <if_else+0x31>
mov    $0x4b,%eax
cmp    $0x64,%edi
jg     1131 <if_else+0x31>
xor    %ecx,%ecx
cmp    $0x33,%edi
mov    $0x32,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @if_else(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 500
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 150, i32* %3
br label %23
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 300
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 100, i32* %3
br label %22
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 100
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 75, i32* %3
br label %21
15: ; preds = %11
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 50
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 50, i32* %3
br label %20
19: ; preds = %15
store i32 0, i32* %3
br label %20
20: ; preds = %19, %18
br label %21
21: ; preds = %20, %14
br label %22
22: ; preds = %21, %10
br label %23
23: ; preds = %22, %6
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @if_else(i32 %0) {
%2 = icmp sgt i32 %0, 500
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 300
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = icmp sgt i32 %0, 100
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = icmp sgt i32 %0, 50
%9 = select i1 %8, i32 50, i32 0
br label %10
10: ; preds = %7, %5, %3, %1
%11 = phi i32 [ 150, %1 ], [ 100, %3 ], [ 75, %5 ], [ %9, %7 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main() {
  int a, b;
  int c;
  float f;
  a = 10;
  b = 20;
  c = a + b;
  printf("value of c: %d \n", c);
  f = 70.0 / 3.0;
  printf("value of f : %f \n", f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
movss  0xeb1(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"value of c: %d \0A\00"
@.str.1 = [18 x i8] c"value of f : %f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to float
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float %10)
store float 0x4037555560000000, float* %5
%12 = load float, float* %5
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), float %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"value of c: %d \0A\00"
@.str.1 = [18 x i8] c"value of f : %f \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float 3.000000e+01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), float 0x4037555560000000)
ret i32 0
}
void test_non_identifiers() {
  int i, x;
#pragma omp simd;
  for (i = 0; i < 16; ++i)
    ;
#pragma omp simd firstprivate(x);
  for (i = 0; i < 16; ++i)
    ;
#pragma omp simd private(x);
  for (i = 0; i < 16; ++i)
    ;
#pragma omp simd, private(x);
  for (i = 0; i < 16; ++i)
    ;
}


x86 assembly (clang, -O0):
<test_non_identifiers>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1128 <test_non_identifiers+0x28>
jmp    111a <test_non_identifiers+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <test_non_identifiers+0xb>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    114c <test_non_identifiers+0x4c>
jmp    113e <test_non_identifiers+0x3e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <test_non_identifiers+0x2f>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1170 <test_non_identifiers+0x70>
jmp    1162 <test_non_identifiers+0x62>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <test_non_identifiers+0x53>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1194 <test_non_identifiers+0x94>
jmp    1186 <test_non_identifiers+0x86>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <test_non_identifiers+0x77>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_non_identifiers() {
ret void
}
/* Variables and functions */
char *linear_allocator_align_ptr(char *ptr) {
  return (char *)((((intptr_t)ptr) + 8 - 1) & ~(8 - 1));
  ;
}


x86 assembly (clang, -O0):
<linear_allocator_align_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
sub    $0x1,%rax
and    $0xfffffffffffffff8,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear_allocator_align_ptr>:
lea    0x7(%rdi),%rax
and    $0xfffffffffffffff8,%rax
ret

LLVM IR (-O0):
define i8* @linear_allocator_align_ptr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = add nsw i64 %4, 8
%6 = sub nsw i64 %5, 1
%7 = and i64 %6, -8
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @linear_allocator_align_ptr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = add nsw i64 %2, 7
%4 = and i64 %3, -8
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int reverse(int);
int isPalindrome(int no) {
  int x = reverse(no);
  if (x == no)
    printf("The number entered (%d) is pallindrome \n", no);
  else
    printf("The number entered (%d) is not pallindrome \n", no);
  return 0;
}


x86 assembly (clang, -O0):
<isPalindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <reverse@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    1156 <isPalindrome+0x36>
mov    -0x4(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
jmp    1165 <isPalindrome+0x45>
mov    -0x4(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPalindrome>:
push   %rbx
mov    %edi,%ebx
call   1030 <reverse@plt>
cmp    %ebx,%eax
lea    0xecf(%rip),%rax
lea    0xef1(%rip),%rdi
cmove  %rax,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"The number entered (%d) is pallindrome \0A\00"
@.str.1 = [45 x i8] c"The number entered (%d) is not pallindrome \0A\00"
define i32 @isPalindrome(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @reverse(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %15
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"The number entered (%d) is pallindrome \0A\00"
@.str.1 = [45 x i8] c"The number entered (%d) is not pallindrome \0A\00"
define i32 @isPalindrome(i32 %0) {
%2 = tail call i32 @reverse(i32 %0)
%3 = icmp eq i32 %2, %0
%4 = select i1 %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @printf(i8* %4, i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help(void) {
  printf("'h'   - help\n");
  printf("'g'   - increase line spacing\n");
  printf("'G'   - decrease line spacing\n");
  printf("'s'   - double texture dimensions\n");
  printf("'S'   - halve texture dimensions\n");
}


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

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf23(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"'h' - help\0A\00"
@.str.1 = [31 x i8] c"'g' - increase line spacing\0A\00"
@.str.2 = [31 x i8] c"'G' - decrease line spacing\0A\00"
@.str.3 = [35 x i8] c"'s' - double texture dimensions\0A\00"
@.str.4 = [34 x i8] c"'S' - halve texture dimensions\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"'h' - help\00"
@str.5 = [30 x i8] c"'g' - increase line spacing\00"
@str.6 = [30 x i8] c"'G' - decrease line spacing\00"
@str.7 = [34 x i8] c"'s' - double texture dimensions\00"
@str.8 = [33 x i8] c"'S' - halve texture dimensions\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0))
ret void
}