xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
int main() {
  unsigned long lerpDerp = 40;
  printf("other libc: %lu\n", lerpDerp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x28,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xece(%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
mov    $0x28,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"other libc: %lu\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 40)
ret i32 0
}
/* Type definitions */
struct pplex {
  int dummy;
};
struct exptree {
  int dummy;
};

/* Variables and functions */
char const *parseexp(struct exptree *, struct pplex *, char const *,
                     int /*<<< orphan*/);
char const *parseexptree(struct exptree *t, struct pplex *cl,
                         char const *input) {
  return parseexp(t, cl, input, 0);
}


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

x86 assembly (clang, -O2):
<parseexptree>:
xor    %ecx,%ecx
jmp    1030 <parseexp@plt>

LLVM IR (-O0):
%struct.exptree = type { i32 }
%struct.pplex = type { i32 }
define i8* @parseexptree(%struct.exptree* %0, %struct.pplex* %1, i8* %2) {
%4 = alloca %struct.exptree*
%5 = alloca %struct.pplex*
%6 = alloca i8*
store %struct.exptree* %0, %struct.exptree** %4
store %struct.pplex* %1, %struct.pplex** %5
store i8* %2, i8** %6
%7 = load %struct.exptree*, %struct.exptree** %4
%8 = load %struct.pplex*, %struct.pplex** %5
%9 = load i8*, i8** %6
%10 = call i8* @parseexp(%struct.exptree* %7, %struct.pplex* %8, i8* %9, i32 0)
ret i8* %10
}

LLVM IR (-O2):
%struct.exptree = type { i32 }
%struct.pplex = type { i32 }
define i8* @parseexptree(%struct.exptree* %0, %struct.pplex* %1, i8* %2) {
%4 = tail call i8* @parseexp(%struct.exptree* %0, %struct.pplex* %1, i8* %2, i32 0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int execvp(char const *, char *const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void execvp_or_die(const char *path, char *const argv[]) {
  if (execvp(path, argv) == -1) {
    perror("error calling execvp()");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<execvp_or_die>:
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   1040 <execvp@plt>
cmp    $0xffffffff,%eax
jne    1170 <execvp_or_die+0x40>
lea    0xea3(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execvp_or_die>:
push   %rax
call   1040 <execvp@plt>
cmp    $0xffffffff,%eax
je     113d <execvp_or_die+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [23 x i8] c"error calling execvp()\00"
@EXIT_FAILURE = global i32 0
define void @execvp_or_die(i8* %0, i8** %1) {
%3 = tail call i32 @execvp(i8* %0, i8** %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void print_usage(char **argv) {
  fprintf(stderr, "Usage: %s --algorithm ALG --garlic G ", argv[0]);
  fputs("--lambda L --iterations I\n", stderr);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xebd(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
lea    0xece(%rip),%rdi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%eax
mov    (%rdi),%rdx
lea    0xecc(%rip),%rsi
mov    %eax,%edi
call   1040 <fprintf@plt>
mov    (%rbx),%esi
lea    0xee2(%rip),%rdi
pop    %rbx
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s --algorithm ALG --garlic G \00"
@.str.1 = [27 x i8] c"--lambda L --iterations I\0A\00"
define void @print_usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s --algorithm ALG --garlic G \00"
@.str.1 = [27 x i8] c"--lambda L --iterations I\0A\00"
define void @print_usage(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret void
}
unsigned int read_8(unsigned char const *buffer) { return buffer[0]; }


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

x86 assembly (clang, -O2):
<read_8>:
movzbl (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @read_8(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
ret i32 %3
}
void foo(void (*func)()) { (*func)(); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
jmp    *%rdi

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

LLVM IR (-O2):
define void @foo(void (...)* nocapture %0) {
tail call void (...) %0()
ret void
}
/* Variables and functions */
scalar_t__ read(int, char *, int);
int /*<<< orphan*/ write(int, char *, int);
void incoming() {
  char buf;
  for (;;)
    while (read(3, &buf, 1))
      write(1, &buf, 1);
}


x86 assembly (clang, -O0):
<incoming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
jmp    112d <incoming+0xd>
mov    $0x3,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x0,%rax
je     115f <incoming+0x3f>
mov    $0x1,%edx
lea    -0x1(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    112d <incoming+0xd>
jmp    1128 <incoming+0x8>

x86 assembly (clang, -O2):
<incoming>:
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    $0x3,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
test   %rax,%rax
je     1130 <incoming+0x10>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
test   %rax,%rax
jne    1150 <incoming+0x30>
jmp    1130 <incoming+0x10>

LLVM IR (-O0):
define void @incoming() {
%1 = alloca i8
br label %2
2: ; preds = %8, %0
br label %3
3: ; preds = %6, %2
%4 = call i64 @read(i32 3, i8* %1, i32 1)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 @write(i32 1, i8* %1, i32 1)
br label %3
8: ; preds = %3
br label %2
}

LLVM IR (-O2):
define void @incoming() {
%1 = alloca i8
br label %2
2: ; preds = %5, %0
%3 = call i64 @read(i32 3, i8* %1, i32 1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %2
br label %2
6: ; preds = %2, %6
%7 = call i32 @write(i32 1, i8* %1, i32 1)
%8 = call i64 @read(i32 3, i8* %1, i32 1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %5, label %6
}
f(n) unsigned n;
{
  if ((int)n >= 0)
    abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     112a <f+0x1a>
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %edi,%edi
jns    1115 <f+0x5>
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
unreachable
7: ; preds = %1
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %3, label %4
3: ; preds = %1
tail call void @abort()
unreachable
4: ; preds = %1
ret i32 undef
}
long long int d2sll(double d) { return (long long int)d; }


x86 assembly (clang, -O0):
<d2sll>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2sll>:
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @d2sll(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @d2sll(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
void stringlink(char *s, char *t) {
  while (*s != '\0') {
    s++;
  }
  while (*t != '\0') {
    *s++ = *t++;
  }
  *s = '\0';
}


x86 assembly (clang, -O0):
<stringlink>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     112d <stringlink+0x2d>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <stringlink+0xc>
jmp    1132 <stringlink+0x32>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1169 <stringlink+0x69>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1132 <stringlink+0x32>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringlink>:
mov    %rdi,%rcx
add    $0x1,%rdi
cmpb   $0x0,(%rcx)
jne    1100 <stringlink>
mov    (%rsi),%al
test   %al,%al
je     1136 <stringlink+0x36>
mov    $0xffffffffffffffff,%rcx
nopl   0x0(%rax)
mov    %al,(%rdi,%rcx,1)
movzbl 0x2(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1120 <stringlink+0x20>
add    %rcx,%rdi
mov    %rdi,%rcx
movb   $0x0,(%rcx)
ret

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

LLVM IR (-O2):
define void @stringlink(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %15, %11 ], [ %1, %8 ]
%14 = phi i8* [ %16, %11 ], [ %4, %8 ]
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %12, i8* %14
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
%20 = phi i8* [ %4, %8 ], [ %16, %11 ]
store i8 0, i8* %20
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void freeTokens(char **token) {
  int NDEX;
  NDEX = 0;
  while (*(token + NDEX) != NULL) {
    free(*(token + NDEX));
    NDEX++;
  }
  return;
}


x86 assembly (clang, -O0):
<freeTokens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <freeTokens+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <freeTokens+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeTokens>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1131 <freeTokens+0x21>
add    $0x8,%rbx
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <freeTokens+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @freeTokens(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @free(i8* %6)
%8 = add nuw nsw i64 %5, 1
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tolower(int);
void uninitvar_tolower(void) {
  int c;
  (void)tolower(c);
}


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

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

LLVM IR (-O0):
define void @uninitvar_tolower() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @tolower(i32 %2)
ret void
}

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

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int aio_fsync(int op, struct aiocb *cb) {
  errno = EINVAL;
  return -1;
}


x86 assembly (clang, -O0):
<aio_fsync>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec5(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aio_fsync>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.aiocb = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @aio_fsync(i32 %0, %struct.aiocb* %1) {
%3 = alloca i32
%4 = alloca %struct.aiocb*
store i32 %0, i32* %3
store %struct.aiocb* %1, %struct.aiocb** %4
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.aiocb = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @aio_fsync(i32 %0, %struct.aiocb* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
store i32 %3, i32* @errno
ret i32 -1
}
void rop3_227_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = *D & T;
  stk2 = S | stk3;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_227_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_227_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
and    %dl,%cl
or     %sil,%cl
xor    %dl,%cl
or     %sil,%cl
not    %cl
and    %sil,%al
or     %cl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_227_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = load i8, i8* %6
%14 = zext i8 %13 to i32
%15 = and i32 %12, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %9
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8, i8* %6
%24 = zext i8 %23 to i32
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = xor i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = trunc i32 %31 to i8
store i8 %32, i8* %7
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = xor i32 %36, -1
%38 = and i32 %34, %37
%39 = load i8*, i8** %4
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = load i8, i8* %5
%43 = zext i8 %42 to i32
%44 = and i32 %41, %43
%45 = or i32 %38, %44
%46 = trunc i32 %45 to i8
%47 = load i8*, i8** %4
store i8 %46, i8* %47
ret void
}

LLVM IR (-O2):
define void @rop3_227_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %2
%6 = or i8 %5, %1
%7 = xor i8 %6, %2
%8 = or i8 %7, %1
%9 = xor i8 %8, -1
%10 = and i8 %4, %1
%11 = or i8 %10, %9
store i8 %11, i8* %0
ret void
}
/* Variables and functions */
scalar_t__ _U_Qfcmp(long double, long double, int);
int _U_Qfunlt(long double a, long double b) {
  return (_U_Qfcmp(a, b, 1 | 2 | 8) != 0);
}


x86 assembly (clang, -O0):
<_U_Qfunlt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
mov    $0xb,%edi
call   1030 <_U_Qfcmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_U_Qfunlt>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fldt   0x40(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
mov    $0xb,%edi
call   1030 <_U_Qfcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @_U_Qfunlt(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = call i64 @_U_Qfcmp(x86_fp80 %5, x86_fp80 %6, i32 11)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @_U_Qfunlt(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i64 @_U_Qfcmp(x86_fp80 %0, x86_fp80 %1, i32 11)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ svga_writel_common(int /*<<< orphan*/, int /*<<< orphan*/,
                                      int, void *);
void svga_writel_linear(uint32_t addr, uint32_t val, void *p) {
  svga_writel_common(addr, val, 1, p);
}


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

x86 assembly (clang, -O2):
<svga_writel_linear>:
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <svga_writel_common@plt>

LLVM IR (-O0):
define void @svga_writel_linear(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @svga_writel_common(i32 %7, i32 %8, i32 1, i8* %9)
ret void
}

LLVM IR (-O2):
define void @svga_writel_linear(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @svga_writel_common(i32 %0, i32 %1, i32 1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BsiGenerateTables();
int main(void) {
  BsiGenerateTables();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @BsiGenerateTables()
ret i32 0
}
unsigned long b_string_to_int(unsigned char *str) {
  unsigned long tlong;
  asm volatile("call 0x001000E0" : "=a"(tlong) : "S"(str));
  return tlong;
}


x86 assembly (clang, -O0):
<b_string_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
call   1000e0 <completed.0+0xfc0c0>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_string_to_int>:
mov    %rdi,%rsi
call   1000e0 <completed.0+0xfc0c0>
ret

LLVM IR (-O0):
define i64 @b_string_to_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 asm sideeffect "call 0x001000E0", "={ax},{si},~{dirflag},~{fpsr},~{flags}"(i8* %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @b_string_to_int(i8* %0) {
%2 = tail call i64 asm sideeffect "call 0x001000E0", "={ax},{si},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i64 %2
}
/* Variables and functions */
int log(double);
double sqrt(int);
double tools_uniform(int, int);
double tools_rayleigh(double sigma) {
  double y = tools_uniform(0., 1.);
  return sigma * sqrt(-2 * log(y));
}


x86 assembly (clang, -O0):
<tools_rayleigh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <tools_uniform@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
imul   $0xfffffffe,%eax,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tools_rayleigh>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <tools_uniform@plt>
call   1040 <log@plt>
lea    (%rax,%rax,1),%edi
neg    %edi
call   1050 <sqrt@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @tools_rayleigh(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = call double @tools_uniform(i32 0, i32 1)
store double %4, double* %3
%5 = load double, double* %2
%6 = load double, double* %3
%7 = call i32 @log(double %6)
%8 = mul nsw i32 -2, %7
%9 = call double @sqrt(i32 %8)
%10 = fmul double %5, %9
ret double %10
}

LLVM IR (-O2):
define double @tools_rayleigh(double %0) {
%2 = tail call double @tools_uniform(i32 0, i32 1)
%3 = tail call i32 @log(double %2)
%4 = mul nsw i32 %3, -2
%5 = tail call double @sqrt(i32 %4)
%6 = fmul double %5, %0
ret double %6
}
long sound_ioctl(unsigned int cmd, unsigned long arg) {
  int len;
  int dtype;
  int dev;
  unsigned int tmp;
  long ret;
  void *p;
  unsigned long flag;
  unsigned long roksum;
  struct thread_info *tmp___0;
  long tmp___1;
  unsigned long flag___0;
  unsigned long roksum___0;
  struct thread_info *tmp___2;
  long tmp___3;
  int __pu_err;
  int tmp___4;
  int tmp___5;
  int tmp___6;
  int tmp___7;
  int tmp___8;
  int tmp___9;
  int tmp___10;
  int tmp___11;
  {
    len = 0;
    p = (void *)arg;
    if (cmd >> 30 != 0U && cmd >> 30 != 0U) {
      len = (int)(cmd >> 16) & 16383;
      if ((unsigned long)p == (unsigned long)((void *)0)) {
        return (-14L);
      } else {
        return 0;
      }
    }
  }
}


x86 assembly (clang, -O0):
<sound_ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x1e,%eax
cmp    $0x0,%eax
je     116d <sound_ioctl+0x6d>
mov    -0xc(%rbp),%eax
shr    $0x1e,%eax
cmp    $0x0,%eax
je     116d <sound_ioctl+0x6d>
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
and    $0x3fff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%rax
cmp    $0x0,%rax
jne    1165 <sound_ioctl+0x65>
movq   $0xfffffffffffffff2,-0x8(%rbp)
ff
jmp    116d <sound_ioctl+0x6d>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sound_ioctl>:
xor    %ecx,%ecx
test   %rsi,%rsi
mov    $0xfffffffffffffff2,%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
%struct.thread_info = type opaque
define i64 @sound_ioctl(i32 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
%14 = alloca %struct.thread_info*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca %struct.thread_info*
%19 = alloca i64
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 0, i32* %6
%29 = load i64, i64* %5
%30 = inttoptr i64 %29 to i8*
store i8* %30, i8** %11
%31 = load i32, i32* %4
%32 = lshr i32 %31, 30
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %47
34: ; preds = %2
%35 = load i32, i32* %4
%36 = lshr i32 %35, 30
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %47
38: ; preds = %34
%39 = load i32, i32* %4
%40 = lshr i32 %39, 16
%41 = and i32 %40, 16383
store i32 %41, i32* %6
%42 = load i8*, i8** %11
%43 = ptrtoint i8* %42 to i64
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %38
store i64 -14, i64* %3
br label %47
46: ; preds = %38
store i64 0, i64* %3
br label %47
47: ; preds = %45, %46, %34, %2
%48 = load i64, i64* %3
ret i64 %48
}

LLVM IR (-O2):
%struct.thread_info = type opaque
define i64 @sound_ioctl(i32 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
%4 = select i1 %3, i64 -14, i64 0
ret i64 %4
}
void simple_statfs(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<simple_statfs>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_statfs>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.simple_statfs = [14 x i8] c"simple_statfs\00"
define void @simple_statfs() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.simple_statfs, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.simple_statfs = [14 x i8] c"simple_statfs\00"
define void @simple_statfs() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.simple_statfs, i64 0, i64 0))
ret void
}
int audio_reset_parameters(struct audio_info_struct *ai) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.audio_info_struct = type opaque
define i32 @audio_reset_parameters(%struct.audio_info_struct* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p384_from_montgomery(uintptr_t, uintptr_t);
void fiat_p384_from_montgomery(uint32_t out1[12], const uint32_t arg1[12]) {
  internal_fiat_p384_from_montgomery((uintptr_t)out1, (uintptr_t)arg1);
}


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

x86 assembly (clang, -O2):
<fiat_p384_from_montgomery>:
jmp    1030 <internal_fiat_p384_from_montgomery@plt>

LLVM IR (-O0):
define void @fiat_p384_from_montgomery(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 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_p384_from_montgomery(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_p384_from_montgomery(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_p384_from_montgomery(i64 %3, i64 %4)
ret void
}
void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg,
                          struct net_bridge_vlan *vlan) {}


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

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

LLVM IR (-O0):
%struct.net_bridge_vlan_group = type opaque
%struct.net_bridge_vlan = type opaque
define void @vlan_tunnel_info_del(%struct.net_bridge_vlan_group* %0, %struct.net_bridge_vlan* %1) {
%3 = alloca %struct.net_bridge_vlan_group*
%4 = alloca %struct.net_bridge_vlan*
store %struct.net_bridge_vlan_group* %0, %struct.net_bridge_vlan_group** %3
store %struct.net_bridge_vlan* %1, %struct.net_bridge_vlan** %4
ret void
}

LLVM IR (-O2):
%struct.net_bridge_vlan_group = type opaque
%struct.net_bridge_vlan = type opaque
define void @vlan_tunnel_info_del(%struct.net_bridge_vlan_group* nocapture %0, %struct.net_bridge_vlan* nocapture %1) {
ret void
}
int main() {
  int a = 0;
  int b = 1;
  a = a + b;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int min(int x, int y) {
  if (x < y)
    return x;
  else if (x > y)
    return y;
  else
    return x;
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <min+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113e <min+0x3e>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1138 <min+0x38>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113e <min+0x3e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovle %edi,%eax
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = icmp sgt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = select i1 %3, i32 %0, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int chroot(const char *path) {
  fprintf(stderr, "WARNING: chroot() not implemented\n");
}


x86 assembly (clang, -O0):
<chroot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chroot>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"WARNING: chroot() not implemented\0A\00"
define i32 @chroot(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"WARNING: chroot() not implemented\0A\00"
define i32 @chroot(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ print_list(char *, char *);
int main() {
  char arr_a[4] = "ABC";
  char arr_b[4] = "XYZ";
  print_list(arr_a, arr_b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x434241,0x4(%rsp)
movl   $0x5a5958,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <print_list@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.arr_a = [4 x i8] c"ABC\00"
@__const.main.arr_b = [4 x i8] c"XYZ\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca [4 x i8]
store i32 0, i32* %1
%4 = bitcast [4 x i8]* %2 to i8*
%5 = bitcast [4 x i8]* %3 to i8*
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = call i32 @print_list(i8* %6, i8* %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 4407873, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 5921112, i32* %2
%5 = call i32 @print_list(i8* %3, i8* %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ int8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ WriteUint8Be(int /*<<< orphan*/, void *);
int32_t WriteInt8Be(int8_t value, void *out) {
  return WriteUint8Be((uint8_t)value, out);
}


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

x86 assembly (clang, -O2):
<WriteInt8Be>:
jmp    1030 <WriteUint8Be@plt>

LLVM IR (-O0):
define i32 @WriteInt8Be(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = load i64, i64* %3
%6 = trunc i64 %5 to i32
%7 = load i8*, i8** %4
%8 = call i32 @WriteUint8Be(i32 %6, i8* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @WriteInt8Be(i64 %0, i8* %1) {
%3 = trunc i64 %0 to i32
%4 = tail call i32 @WriteUint8Be(i32 %3, i8* %1)
ret i32 %4
}
void switch_test(int i) {
  switch (i) {
  case 1 ... 3:
    break;
  }
}


x86 assembly (clang, -O0):
<switch_test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x2,%eax
ja     1120 <switch_test+0x20>
jmp    111b <switch_test+0x1b>
jmp    1120 <switch_test+0x20>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @switch_test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %5 [
i32 1, label %4
i32 2, label %4
i32 3, label %4
]
4: ; preds = %1, %1, %1
br label %5
5: ; preds = %1, %4
ret void
}

LLVM IR (-O2):
define void @switch_test(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int writeBytes(int /*<<< orphan*/, int /*<<< orphan*/, int,
               int /*<<< orphan*/ *);
int writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data) {
  return writeBytes(devAddr, regAddr, 1, &data);
}


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

x86 assembly (clang, -O2):
<writeByte>:
push   %rax
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    $0x1,%edx
call   1030 <writeBytes@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @writeByte(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = call i32 @writeBytes(i32 %0, i32 %1, i32 1, i32* %4)
ret i32 %5
}
void foo_2_2_2_1_2_2_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_2_1_2_2_1_2_1() {
ret void
}
void test_cwde(int x) {
  volatile int a, newa;
  a = x;
  __asm__ __volatile__("mov %1, %%eax\n\t"
                       "cwtl\n\t"
                       "mov %%eax, %0\n\t"
                       : "=m"(newa)
                       : "m"(a)
                       : "eax");
  do {
    if (!(newa == (int)(short)a))
      asm volatile(".byte 0xd6" : : "a"(1));
  } while (0);
}


x86 assembly (clang, -O0):
<test_cwde>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cwtl
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
movswl %cx,%ecx
cmp    %ecx,%eax
je     112b <test_cwde+0x2b>
mov    $0x1,%eax
(bad)
jmp    1130 <test_cwde+0x30>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_cwde>:
mov    %edi,-0x8(%rsp)
mov    -0x8(%rsp),%eax
cwtl
mov    %eax,-0x4(%rsp)
mov    -0x4(%rsp),%eax
mov    -0x8(%rsp),%ecx
movswl %cx,%ecx
cmp    %ecx,%eax
je     1122 <test_cwde+0x22>
mov    $0x1,%eax
(bad)
ret

LLVM IR (-O0):
define void @test_cwde(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store volatile i32 %5, i32* %3
br label %6
6: ; preds = %1
%7 = load volatile i32, i32* %4
%8 = load volatile i32, i32* %3
%9 = trunc i32 %8 to i16
%10 = sext i16 %9 to i32
%11 = icmp eq i32 %7, %10
br i1 %11, label %13, label %12
12: ; preds = %6
br label %13
13: ; preds = %12, %6
br label %14
14: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @test_cwde(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store volatile i32 %0, i32* %2
%6 = load volatile i32, i32* %3
%7 = load volatile i32, i32* %2
%8 = shl i32 %7, 16
%9 = ashr exact i32 %8, 16
%10 = icmp eq i32 %6, %9
br i1 %10, label %12, label %11
11: ; preds = %1
br label %12
12: ; preds = %11, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void foobar(int i) { printf("Printing from mylib.so %d\n", i); }


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

x86 assembly (clang, -O2):
<foobar>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Printing from mylib.so %d\0A\00"
define void @foobar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Printing from mylib.so %d\0A\00"
define void @foobar(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
long f() { return 'k'; }


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

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

LLVM IR (-O0):
define i64 @f() {
ret i64 107
}

LLVM IR (-O2):
define i64 @f() {
ret i64 107
}
int test_imm_5Dint64_midword_reg(long long val) {
  return ((val >> 16) & (0x5D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_5Dint64_midword_reg(i64 %0) {
%2 = and i64 %0, 6094848
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int leftShift(int, int);
int encodeJFormat(int opcode, int instr_index) {
  return leftShift(opcode, 26) + instr_index;
}


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

x86 assembly (clang, -O2):
<encodeJFormat>:
push   %rbx
mov    %esi,%ebx
mov    $0x1a,%esi
call   1030 <leftShift@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @encodeJFormat(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 = call i32 @leftShift(i32 %5, i32 26)
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @encodeJFormat(i32 %0, i32 %1) {
%3 = tail call i32 @leftShift(i32 %0, i32 26)
%4 = add nsw i32 %3, %1
ret i32 %4
}
void swapValue(int arr[], int i, int j) {
  int t = arr[i];
  arr[i] = arr[j];
  arr[j] = t;
}


x86 assembly (clang, -O0):
<swapValue>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapValue>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swapValue(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swapValue(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}