xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ R_OK;
int /*<<< orphan*/ W_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int is_directory_readwritable(char *path) {
  return (access(path, R_OK) == 0 && access(path, W_OK) == 0);
}


x86 assembly (clang, -O0):
<is_directory_readwritable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    115c <is_directory_readwritable+0x4c>
mov    -0x8(%rbp),%rdi
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_directory_readwritable>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     112e <is_directory_readwritable+0x1e>
pop    %rbx
ret
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <access@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@R_OK = global i32 0
@W_OK = global i32 0
define i32 @is_directory_readwritable(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @R_OK
%5 = call i64 @access(i8* %3, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = load i32, i32* @W_OK
%10 = call i64 @access(i8* %8, i32 %9)
%11 = icmp eq i64 %10, 0
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
@R_OK = global i32 0
@W_OK = global i32 0
define i32 @is_directory_readwritable(i8* nocapture %0) {
%2 = load i32, i32* @R_OK
%3 = tail call i64 @access(i8* %0, i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* @W_OK
%7 = tail call i64 @access(i8* %0, i32 %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %11
}
/* Type definitions */
struct domain {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ boundary_reflect_rout(struct domain *);
int /*<<< orphan*/ boundary_zerograd_zbot(struct domain *, int /*<<< orphan*/);
int /*<<< orphan*/ boundary_zerograd_ztop(struct domain *, int /*<<< orphan*/);
void boundary_trans(struct domain *theDomain, int dim) {
  if (dim == 1) {
    boundary_reflect_rout(theDomain);
  } else if (dim == 2) {
    boundary_zerograd_zbot(theDomain, 0);
    boundary_zerograd_ztop(theDomain, 0);
  }
}


x86 assembly (clang, -O0):
<boundary_trans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1157 <boundary_trans+0x27>
mov    -0x8(%rbp),%rdi
call   1030 <boundary_reflect_rout@plt>
jmp    117c <boundary_trans+0x4c>
cmpl   $0x2,-0xc(%rbp)
jne    1177 <boundary_trans+0x47>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <boundary_zerograd_zbot@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <boundary_zerograd_ztop@plt>
jmp    117c <boundary_trans+0x4c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boundary_trans>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x2,%esi
je     1147 <boundary_trans+0x17>
cmp    $0x1,%esi
jne    115c <boundary_trans+0x2c>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <boundary_reflect_rout@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <boundary_zerograd_zbot@plt>
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1050 <boundary_zerograd_ztop@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.domain = type { i32 }
define void @boundary_trans(%struct.domain* %0, i32 %1) {
%3 = alloca %struct.domain*
%4 = alloca i32
store %struct.domain* %0, %struct.domain** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load %struct.domain*, %struct.domain** %3
%9 = call i32 @boundary_reflect_rout(%struct.domain* %8)
br label %19
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load %struct.domain*, %struct.domain** %3
%15 = call i32 @boundary_zerograd_zbot(%struct.domain* %14, i32 0)
%16 = load %struct.domain*, %struct.domain** %3
%17 = call i32 @boundary_zerograd_ztop(%struct.domain* %16, i32 0)
br label %18
18: ; preds = %13, %10
br label %19
19: ; preds = %18, %7
ret void
}

LLVM IR (-O2):
%struct.domain = type { i32 }
define void @boundary_trans(%struct.domain* %0, i32 %1) {
switch i32 %1, label %8 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 @boundary_reflect_rout(%struct.domain* %0)
br label %8
5: ; preds = %2
%6 = tail call i32 @boundary_zerograd_zbot(%struct.domain* %0, i32 0)
%7 = tail call i32 @boundary_zerograd_ztop(%struct.domain* %0, i32 0)
br label %8
8: ; preds = %2, %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void exp05_fp() { print("hello"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
define void @exp05_fp() {
%1 = call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define void @exp05_fp() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ insert_at(int /*<<< orphan*/, int);
void prepend(int num) { insert_at(0, num); }


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

x86 assembly (clang, -O2):
<prepend>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <insert_at@plt>

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

LLVM IR (-O2):
define void @prepend(i32 %0) {
%2 = tail call i32 @insert_at(i32 0, i32 %0)
ret void
}
const char *Tuple_Brief(void) { return "Basic Collection"; }


x86 assembly (clang, -O0):
<Tuple_Brief>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tuple_Brief>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Basic Collection\00"
define i8* @Tuple_Brief() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [17 x i8] c"Basic Collection\00"
define i8* @Tuple_Brief() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
int ilog2(unsigned long v) {
  int l = 0;
  while ((1UL << l) < v) {
    l++;
  }
  return l;
}


x86 assembly (clang, -O0):
<ilog2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
cmp    -0x8(%rbp),%rax
jae    1134 <ilog2+0x34>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ilog2+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ilog2>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%eax
shl    %cl,%rax
add    $0x1,%rcx
cmp    %rdi,%rax
jb     1110 <ilog2+0x10>
add    $0xffffffff,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ilog2(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %6, %2 ], [ 0, %1 ]
%4 = shl nuw i64 1, %3
%5 = icmp ult i64 %4, %0
%6 = add nuw i64 %3, 1
br i1 %5, label %2, label %7
7: ; preds = %2
%8 = trunc i64 %3 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char *);
char *path_append(char *path, const char *new) {
  char *pathtail = path + strlen(path);
  *pathtail = '/';
  strcpy(pathtail + 1, new);
  return pathtail;
}


x86 assembly (clang, -O0):
<path_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_append>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
cltq
lea    (%rbx,%rax,1),%r15
movb   $0x2f,(%rbx,%rax,1)
lea    (%rbx,%rax,1),%rdi
add    $0x1,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @path_append(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
store i8* %10, i8** %5
%11 = load i8*, i8** %5
store i8 47, i8* %11
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8*, i8** %4
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define i8* @path_append(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 47, i8* %5
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = tail call i32 @strcpy(i8* %6, i8* %1)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  ((void)argc);
  ((void)argv);
  printf("POLARSSL_X509_CRT_WRITE_C and/or POLARSSL_X509_CRT_PARSE_C and/or "
         "POLARSSL_FS_IO and/or "
         "POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C and/or "
         "POLARSSL_ERROR_C not defined.\n");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [172 x i8] c"POLARSSL_X509_CRT_WRITE_C and/or POLARSSL_X509_CRT_PARSE_C and/or POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C and/or POLARSSL_ERROR_C not defined.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [171 x i8] c"POLARSSL_X509_CRT_WRITE_C and/or POLARSSL_X509_CRT_PARSE_C and/or POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C and/or POLARSSL_ERROR_C not defined.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([171 x i8], [171 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ wa_sa(int, int, int *, int *);
int main(void) {
  int a = 5, b = 3, p = 1, m = 1;
  wa_sa(a, b, &p, &m);
  printf("p = %d   m = %d\n", p, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1040 <wa_sa@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x1,0x4(%rsp)
movl   $0x1,(%rsp)
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    $0x5,%edi
mov    $0x3,%esi
call   1040 <wa_sa@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"p = %d m = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%5 = call i32 @wa_sa(i32 5, i32 3, i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
wchar_t *wmemcpy(wchar_t *restrict ws1, const wchar_t *restrict ws2, size_t n) {
  for (size_t i = 0; i < n; i++) {
    ws1[i] = ws2[i];
  }
  return ws1;
}


x86 assembly (clang, -O0):
<wmemcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114d <wmemcpy+0x4d>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1118 <wmemcpy+0x18>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmemcpy>:
push   %rbx
mov    %rdi,%rbx
test   %rdx,%rdx
je     1125 <wmemcpy+0x15>
shl    $0x2,%rdx
mov    %rbx,%rdi
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32* @wmemcpy(i32* noalias returned writeonly %0, i32* noalias nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %0 to i8*
%8 = shl nuw i64 %2, 2
br label %9
9: ; preds = %5, %3
ret i32* %0
}
int isCharDigit(char c) { return (c >= '0' && c <= '9'); }


x86 assembly (clang, -O0):
<isCharDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <isCharDigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isCharDigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isCharDigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isCharDigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct stat {
  scalar_t__ st_nlink;
};

/* Variables and functions */
int /*<<< orphan*/ fstat(int, struct stat *);
int isFdExists(int fd) {
  struct stat statbuf;
  fstat(fd, &statbuf);
  return (statbuf.st_nlink > 0);
}


x86 assembly (clang, -O0):
<isFdExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <fstat@plt>
cmpq   $0x0,-0x10(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isFdExists>:
push   %rax
mov    %rsp,%rsi
call   1030 <fstat@plt>
xor    %eax,%eax
cmpq   $0x0,(%rsp)
setg   %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @isFdExists(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.stat
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @fstat(i32 %4, %struct.stat* %3)
%6 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%7 = load i64, i64* %6
%8 = icmp sgt i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @isFdExists(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%6 = load i64, i64* %5
%7 = icmp sgt i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
void RTLockValidatorMayPanic(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLockValidatorMayPanic() {
ret void
}
/* Type definitions */
struct chanfd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ chanfd_send(struct chanfd *, unsigned int const *);
void chanfd_send_uint(struct chanfd *channel, const unsigned int *elem) {
  chanfd_send(channel, elem);
}


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

x86 assembly (clang, -O2):
<chanfd_send_uint>:
jmp    1030 <chanfd_send@plt>

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

LLVM IR (-O2):
%struct.chanfd = type { i32 }
define void @chanfd_send_uint(%struct.chanfd* %0, i32* %1) {
%3 = tail call i32 @chanfd_send(%struct.chanfd* %0, i32* %1)
ret void
}
int digit(c)
register int c;
{ return (c >= '0' && c <= '9'); }


x86 assembly (clang, -O0):
<digit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <digit+0x20>
cmpl   $0x39,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @digit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @digit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
void *malloc(unsigned long);
void *gp_alloc(unsigned long size, char *usage) {
  (void)usage;
  return malloc(size);
}


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

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

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

LLVM IR (-O2):
define noalias i8* @gp_alloc(i64 %0, i8* nocapture readnone %1) {
%3 = tail call i8* @malloc(i64 %0)
ret i8* %3
}
/* Variables and functions */
double pow(double const, int);
double _square(const int numInputs, const double *inputs,
               const double *connectionWeights) {
  return pow(inputs[0], 2);
}


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

x86 assembly (clang, -O2):
<_square>:
movsd  (%rsi),%xmm0
mov    $0x2,%edi
jmp    1030 <pow@plt>

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

LLVM IR (-O2):
define double @_square(i32 %0, double* nocapture %1, double* nocapture readnone %2) {
%4 = load double, double* %1
%5 = tail call double @pow(double %4, i32 2)
ret double %5
}
long long min_ll(long long a, long long b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<min_ll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <min_ll+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <min_ll+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_ll>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @min_ll(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @min_ll(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
void *malloc(int);
void *MemAlloc(int size) { return malloc(size); }


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

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

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

LLVM IR (-O2):
define noalias i8* @MemAlloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
void __attribute__((section(".after_vectors"), weak)) NMI_Handler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<NMI_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <NMI_Handler+0x9>
jmp    1109 <NMI_Handler+0x9>

x86 assembly (clang, -O2):
<NMI_Handler>:
jmp    1100 <NMI_Handler>

LLVM IR (-O0):
define weak void @NMI_Handler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @NMI_Handler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
struct stat {
  long st_size;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
long int mr_tools_fsize(const char *file_path) {
  struct stat st;
  if (stat(file_path, &st) == 0)
    return st.st_size;
  return -1;
}


x86 assembly (clang, -O0):
<mr_tools_fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    1140 <mr_tools_fsize+0x30>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1148 <mr_tools_fsize+0x38>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mr_tools_fsize>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
neg    %rax
sbb    %rax,%rax
or     (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i64 @mr_tools_fsize(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%10 = load i64, i64* %9
store i64 %10, i64* %2
br label %12
11: ; preds = %1
store i64 -1, i64* %2
br label %12
12: ; preds = %11, %8
%13 = load i64, i64* %2
ret i64 %13
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i64 @mr_tools_fsize(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i64, i64* %6
%8 = select i1 %5, i64 %7, i64 -1
ret i64 %8
}
unsigned int readl(unsigned int address) {
  return *((volatile unsigned int *)address);
}


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

x86 assembly (clang, -O2):
<readl>:
mov    %edi,%eax
mov    (%rax),%eax
ret

LLVM IR (-O0):
define i32 @readl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @readl(i32 %0) {
%2 = zext i32 %0 to i64
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
ret i32 %4
}
unsigned xrop3_3_0_0(unsigned char s, unsigned char t) {
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  stk1 = T | S;
  stk1 = ~stk1;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_3_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_3_0_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
or     %ecx,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @xrop3_3_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 8
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 %10, %12
store i32 %13, i32* %5
%14 = load i8, i8* %4
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = or i32 %16, %18
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = or i32 %20, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = xor i32 %23, -1
store i32 %24, i32* %7
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
define i32 @xrop3_3_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = or i32 %6, %4
%8 = xor i32 %7, -1
ret i32 %8
}
void *doit(void *arg) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
jmp    1108 <doit+0x8>

x86 assembly (clang, -O2):
<doit>:
jmp    1100 <doit>

LLVM IR (-O0):
define i8* @doit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define noalias i8* @doit(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
/* Type definitions */
struct Cyc_Lexing_lexbuf {
  int dummy;
};

/* Variables and functions */
int Cyc_asm_comment_rec(struct Cyc_Lexing_lexbuf *, int);
int Cyc_asm_comment(struct Cyc_Lexing_lexbuf *lexbuf) {
  int _T0;
  _T0 = Cyc_asm_comment_rec(lexbuf, 9);
  return _T0;
}


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

x86 assembly (clang, -O2):
<Cyc_asm_comment>:
mov    $0x9,%esi
jmp    1030 <Cyc_asm_comment_rec@plt>

LLVM IR (-O0):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_asm_comment(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = alloca %struct.Cyc_Lexing_lexbuf*
%3 = alloca i32
store %struct.Cyc_Lexing_lexbuf* %0, %struct.Cyc_Lexing_lexbuf** %2
%4 = load %struct.Cyc_Lexing_lexbuf*, %struct.Cyc_Lexing_lexbuf** %2
%5 = call i32 @Cyc_asm_comment_rec(%struct.Cyc_Lexing_lexbuf* %4, i32 9)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_asm_comment(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = tail call i32 @Cyc_asm_comment_rec(%struct.Cyc_Lexing_lexbuf* %0, i32 9)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ run_trial(int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int);
main() {
  int i, seed;
  printf("enter seed:");
  scanf("%d", &seed);
  srand(seed);
  for (i = 0; i < 1; i++)
    run_trial(i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1040 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    119a <main+0x5a>
mov    -0x8(%rbp),%edi
call   1060 <run_trial@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117a <main+0x3a>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <srand@plt>
xor    %edi,%edi
call   1060 <run_trial@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"enter seed:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 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* %3)
%6 = load i32, i32* %3
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %2
br label %8
8: ; preds = %14, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i32, i32* %2
%13 = call i32 @run_trial(i32 %12)
br label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %8
17: ; preds = %8
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [12 x i8] c"enter seed:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 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)
%5 = load i32, i32* %1
%6 = call i32 @srand(i32 %5)
%7 = call i32 @run_trial(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void myFunc() { printf("hello\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define void @myFunc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int listenAddress(int sockfd) {
  int ret = listen(sockfd, 10);
  if (ret == -1) {
    perror("listen sock error:");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<listenAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0xa,%esi
call   1030 <listen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    115d <listenAddress+0x3d>
lea    0xeb4(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1164 <listenAddress+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listenAddress>:
push   %rax
mov    $0xa,%esi
call   1030 <listen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1136 <listenAddress+0x16>
pop    %rcx
ret
lea    0xec3(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"listen sock error:\00"
define i32 @listenAddress(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @listen(i32 %5, i32 10)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [19 x i8] c"listen sock error:\00"
define i32 @listenAddress(i32 %0) {
%2 = tail call i32 @listen(i32 %0, i32 10)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
double sqrt(double);
double nsl_geom_point_point_dist(double x1, double y1, double x2, double y2) {
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}


x86 assembly (clang, -O0):
<nsl_geom_point_point_dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
subsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsl_geom_point_point_dist>:
subsd  %xmm0,%xmm2
subsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm3
mulsd  %xmm2,%xmm2
addsd  %xmm3,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1136 <nsl_geom_point_point_dist+0x26>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
ret
movapd %xmm2,%xmm0
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @nsl_geom_point_point_dist(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %7
%10 = load double, double* %5
%11 = fsub double %9, %10
%12 = load double, double* %7
%13 = load double, double* %5
%14 = fsub double %12, %13
%15 = load double, double* %8
%16 = load double, double* %6
%17 = fsub double %15, %16
%18 = load double, double* %8
%19 = load double, double* %6
%20 = fsub double %18, %19
%21 = fmul double %17, %20
%22 = call double @llvm.fmuladd.f64(double %11, double %14, double %21)
%23 = call double @sqrt(double %22)
ret double %23
}

LLVM IR (-O2):
define double @nsl_geom_point_point_dist(double %0, double %1, double %2, double %3) {
%5 = fsub double %2, %0
%6 = fsub double %3, %1
%7 = fmul double %6, %6
%8 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %7)
%9 = tail call double @sqrt(double %8)
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ strlower(char *);
char *xstrdup(char const *);
char *xstrlower(const char *str) {
  char *copy = xstrdup(str);
  strlower(copy);
  return copy;
}


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

x86 assembly (clang, -O2):
<xstrlower>:
push   %rbx
call   1030 <xstrdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlower@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @xstrlower(i8* %0) {
%2 = tail call i8* @xstrdup(i8* %0)
%3 = tail call i32 @strlower(i8* %2)
ret i8* %2
}
void limpa(char vet[], int n) {
  int i;
  for (i = 0; i < n; i++)
    vet[i] = 0;
}


x86 assembly (clang, -O0):
<limpa>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <limpa+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <limpa+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<limpa>:
test   %esi,%esi
jle    1122 <limpa+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @limpa(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
int foo();
int bar() {
  int x = (1) ? foo() : 1;
#pragma omp taskwait on(x)
  return x;
}


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

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

LLVM IR (-O0):
define i32 @bar() {
%1 = alloca i32
%2 = call i32 (...) @foo()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

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

/* Variables and functions */
uint8_t instruction_operation_extract_mode(uint16_t instruction) {
  return (instruction >> 0x03) & 0x07;
}


x86 assembly (clang, -O0):
<instruction_operation_extract_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
and    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<instruction_operation_extract_mode>:
mov    %edi,%eax
shr    $0x3,%eax
and    $0x7,%eax
ret

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

LLVM IR (-O2):
define i32 @instruction_operation_extract_mode(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 7
ret i32 %3
}
int equal_int(void *ip, void *jp) { return *(int *)ip == *(int *)jp; }


x86 assembly (clang, -O0):
<equal_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_int>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @equal_int(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 i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @equal_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
void TIM8_BRK_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @TIM8_BRK_IRQHandler() {
ret void
}
int pmem_has_hw_drain(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @pmem_has_hw_drain() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ editorProcessKeypress();
int /*<<< orphan*/ editorRefreshScreen();
int /*<<< orphan*/ startRawMode();
int main() {
  startRawMode();
  while (1) {
    editorRefreshScreen();
    editorProcessKeypress();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <startRawMode@plt>
mov    $0x0,%al
call   1030 <editorRefreshScreen@plt>
mov    $0x0,%al
call   1050 <editorProcessKeypress@plt>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <startRawMode@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <editorRefreshScreen@plt>
xor    %eax,%eax
call   1050 <editorProcessKeypress@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @startRawMode()
br label %3
3: ; preds = %0, %3
%4 = call i32 (...) @editorRefreshScreen()
%5 = call i32 (...) @editorProcessKeypress()
br label %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @startRawMode()
br label %2
2: ; preds = %0, %2
%3 = tail call i32 (...) @editorRefreshScreen()
%4 = tail call i32 (...) @editorProcessKeypress()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int foo(int argc, char **argv) {
  int a;
  int b;
  int c;
  b = argc + 1;
  c = argc + 2;
  a = b + c;
  if (argc > 2) {
    c = argc + 3;
  }
  printf("%d, %d\n", a, b + c);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    114d <foo+0x3d>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
add    -0x1c(%rbp),%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    0x2(%rdi),%eax
lea    0x3(%rdi),%ecx
cmp    $0x3,%edi
cmovl  %eax,%ecx
lea    (%rdi,%rdi,1),%esi
add    $0x3,%esi
lea    (%rcx,%rdi,1),%edx
add    $0x1,%edx
lea    0xed1(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @foo(i32 %0, i8** nocapture readnone %1) {
%3 = add nsw i32 %0, 1
%4 = add nsw i32 %0, 2
%5 = icmp sgt i32 %0, 2
%6 = add nsw i32 %0, 3
%7 = select i1 %5, i32 %6, i32 %4
%8 = add nsw i32 %3, %4
%9 = add nsw i32 %7, %3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i32 undef
}