xunge/DecIR huggingface dataset:
void f2(int *xp, int *yp) { *xp = *xp + (2 * (*yp)); }


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

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

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

LLVM IR (-O2):
define void @f2(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = shl nsw i32 %4, 1
%6 = add nsw i32 %5, %3
store i32 %6, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int bar(int a, int b) {
  printf("barC\n");
  return a - b - 42;
}


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

x86 assembly (clang, -O2):
<bar>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
sub    %ebx,%ebp
add    $0xffffffd6,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"barC\0A\00"
define i32 @bar(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = sub nsw i32 %6, %7
%9 = sub nsw i32 %8, 42
ret i32 %9
}

LLVM IR (-O2):
@str = [5 x i8] c"barC\00"
define i32 @bar(i32 %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%4 = add i32 %0, -42
%5 = sub i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int DoMatchCaseInsensitive(char const *, char const *);
int wildmatcase(const char *text, const char *p) {
  if (p[0] == '*' && p[1] == '\0')
    return 1;
  return DoMatchCaseInsensitive(text, p) == 1;
}


x86 assembly (clang, -O0):
<wildmatcase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    114d <wildmatcase+0x3d>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    114d <wildmatcase+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1168 <wildmatcase+0x58>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <DoMatchCaseInsensitive@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wildmatcase>:
push   %rax
cmpb   $0x2a,(%rsi)
jne    111c <wildmatcase+0xc>
cmpb   $0x0,0x1(%rsi)
je     112d <wildmatcase+0x1d>
call   1030 <DoMatchCaseInsensitive@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @wildmatcase(i8* %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 42
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %1, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %5, %2
%10 = tail call i32 @DoMatchCaseInsensitive(i8* %0, i8* %1)
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %5, %9
%14 = phi i32 [ %12, %9 ], [ 1, %5 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void C2Mod2Function2() { printf("Expected message: C2Mod2Function2.\n"); }


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

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

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

LLVM IR (-O2):
@str = [35 x i8] c"Expected message: C2Mod2Function2.\00"
define void @C2Mod2Function2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ glTexCoord4d(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/);
void TexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q) {
  glTexCoord4d(s, t, r, q);
}


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

x86 assembly (clang, -O2):
<TexCoord4d>:
jmp    1030 <glTexCoord4d@plt>

LLVM IR (-O0):
define void @TexCoord4d(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @glTexCoord4d(i32 %9, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @TexCoord4d(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @glTexCoord4d(i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
void smosc_destroy(struct smosc *osc __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
%struct.smosc = type opaque
define void @smosc_destroy(%struct.smosc* nocapture %0) {
ret void
}
int foo(int argc, char **argv) {
  int x;
#pragma omp parallel for reduction(mymin : x)
  for (int i = 0; i < 1000; i++)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    1132 <foo+0x32>
jmp    1124 <foo+0x24>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <foo+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int test_imm_73uint8_mem(unsigned char *val) {
  return ((*val) & (-0x73 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_73uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -115
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_67uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x67 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_67uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 103
%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_67uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 103
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ alphabet(char);
int /*<<< orphan*/ printf(char *);
void alphabet_test() {
  printf("---------alphabet_test---------");
  printf("Uppercase: ");
  alphabet('A');
  printf("Lowercase: ");
  alphabet('a');
  printf("---------alphabet_test---------");
}


x86 assembly (clang, -O0):
<alphabet_test>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x41,%edi
call   1040 <alphabet@plt>
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x61,%edi
call   1040 <alphabet@plt>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<alphabet_test>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x41,%edi
call   1040 <alphabet@plt>
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x61,%edi
call   1040 <alphabet@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"---------alphabet_test---------\00"
@.str.1 = [12 x i8] c"Uppercase: \00"
@.str.2 = [12 x i8] c"Lowercase: \00"
define void @alphabet_test() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @alphabet(i8 signext 65)
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @alphabet(i8 signext 97)
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"---------alphabet_test---------\00"
@.str.1 = [12 x i8] c"Uppercase: \00"
@.str.2 = [12 x i8] c"Lowercase: \00"
define void @alphabet_test() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @alphabet(i8 signext 65)
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @alphabet(i8 signext 97)
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sumar_valor(int);
int main(void) {
  int numero = 57;
  sumar_valor(numero);
  printf("Valor de numero dentro de main() es: %d\n", numero);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [41 x i8] c"Valor de numero dentro de main() es: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 57, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sumar_valor(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Valor de numero dentro de main() es: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @sumar_valor(i32 57)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 57)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hey\tworld!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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 = [12 x i8] c"Hey\09world!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"Hey\09world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void print(char *str) {
  int i;
  i = 0;
  while (str[i])
    write(1, &str[i++], 1);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115a <print+0x4a>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
add    %rax,%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
jmp    1123 <print+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbx
cmpb   $0x0,(%rdi)
je     113c <print+0x2c>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <print+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @print(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, 0
br i1 %10, label %11, label %18
11: ; preds = %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = call i32 @write(i32 1, i8* %16, i32 1)
br label %4
18: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @print(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = add nuw i64 %5, 1
%8 = tail call i32 @write(i32 1, i8* %6, i32 1)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
struct rb_tree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rb_insert(struct rb_tree *, int);
struct rb_tree *rb_mktree();
struct rb_tree *inc_tree(int max) {
  int i;
  struct rb_tree *t = rb_mktree();
  for (i = 0; i < max; i++) {
    rb_insert(t, i);
  }
  return t;
}


x86 assembly (clang, -O0):
<inc_tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rb_mktree@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1163 <inc_tree+0x43>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <rb_insert@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <inc_tree+0x1d>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc_tree>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <rb_mktree@plt>
mov    %rax,%rbx
test   %r14d,%r14d
jle    1152 <inc_tree+0x32>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <rb_insert@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1140 <inc_tree+0x20>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.rb_tree = type { i32 }
define %struct.rb_tree* @inc_tree(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.rb_tree*
store i32 %0, i32* %2
%5 = call %struct.rb_tree* (...) @rb_mktree()
store %struct.rb_tree* %5, %struct.rb_tree** %4
store i32 0, i32* %3
br label %6
6: ; preds = %14, %1
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load %struct.rb_tree*, %struct.rb_tree** %4
%12 = load i32, i32* %3
%13 = call i32 @rb_insert(%struct.rb_tree* %11, i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
%18 = load %struct.rb_tree*, %struct.rb_tree** %4
ret %struct.rb_tree* %18
}

LLVM IR (-O2):
%struct.rb_tree = type { i32 }
define %struct.rb_tree* @inc_tree(i32 %0) {
%2 = tail call %struct.rb_tree* (...) @rb_mktree()
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %9
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @rb_insert(%struct.rb_tree* %2, i32 %5)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret %struct.rb_tree* %2
}
/* Variables and functions */
int ___pskb_trim();
__attribute__((always_)) int __pskb_trim(void) { return ___pskb_trim(); }


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

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

LLVM IR (-O0):
define i32 @__pskb_trim() {
%1 = call i32 (...) @___pskb_trim()
ret i32 %1
}

LLVM IR (-O2):
define i32 @__pskb_trim() {
%1 = tail call i32 (...) @___pskb_trim()
ret i32 %1
}
void ata_acpi_associate(struct ata_host *host) {}


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

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

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

LLVM IR (-O2):
%struct.ata_host = type opaque
define void @ata_acpi_associate(%struct.ata_host* nocapture %0) {
ret void
}
void rop3_62_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  unsigned char stk4;
  stk4 = ~S;
  stk3 = *D & stk4;
  stk2 = T | stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_62_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)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xe(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xe(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%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_62_1_0>:
mov    (%rdi),%r8b
mov    %r8d,%ecx
and    %sil,%r8b
mov    %esi,%eax
not    %al
and    %al,%cl
or     %dl,%cl
and    %al,%cl
or     %r8b,%cl
mov    %cl,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_62_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = load i8, i8* %0
%6 = and i8 %5, %4
%7 = or i8 %6, %2
%8 = and i8 %5, %1
%9 = and i8 %7, %4
%10 = or i8 %9, %8
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int day_of_year(int, int, int);
int /*<<< orphan*/ printf(char *, int);
main() { printf("%d\n", day_of_year(2015, 8, 20)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7df,%edi
mov    $0x8,%esi
mov    $0x14,%edx
call   1040 <day_of_year@plt>
mov    %eax,%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @day_of_year(i32 2015, i32 8, i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void foo(void) {
  char *x = (char *)0x10;
  free(x);
}


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

x86 assembly (clang, -O2):
<foo>:
mov    $0x10,%edi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @foo() {
%1 = alloca i8*
store i8* inttoptr (i64 16 to i8*), i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @free(i8* %2)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 @free(i8* inttoptr (i64 16 to i8*))
ret void
}
int naive_isspace(char c) {
  switch (c) {
  case ' ':
  case '\f':
  case '\n':
  case '\r':
  case '\t':
  case '\v':
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<naive_isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffff7,%eax
sub    $0x5,%eax
jb     1133 <naive_isspace+0x33>
jmp    1122 <naive_isspace+0x22>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
jne    113f <naive_isspace+0x3f>
jmp    1133 <naive_isspace+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1146 <naive_isspace+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<naive_isspace>:
mov    $0x1,%eax
lea    -0x9(%rdi),%ecx
cmp    $0x5,%ecx
jae    110e <naive_isspace+0xe>
ret
cmp    $0x20,%edi
je     110d <naive_isspace+0xd>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @naive_isspace(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 32, label %6
i32 12, label %6
i32 10, label %6
i32 13, label %6
i32 9, label %6
i32 11, label %6
]
6: ; preds = %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @naive_isspace(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %3 [
i32 32, label %4
i32 12, label %4
i32 10, label %4
i32 13, label %4
i32 9, label %4
i32 11, label %4
]
3: ; preds = %1
br label %4
4: ; preds = %1, %1, %1, %1, %1, %1, %3
%5 = phi i32 [ 0, %3 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %5
}
void ularith_sub_ul_ul_ge(unsigned long *r, const unsigned long a) {
  unsigned long t = *r;
  t -= a;
  if (*r >= a)
    *r = t;
}


x86 assembly (clang, -O0):
<ularith_sub_ul_ul_ge>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jb     1142 <ularith_sub_ul_ul_ge+0x42>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ularith_sub_ul_ul_ge>:
mov    (%rdi),%rax
sub    %rsi,%rax
jb     110b <ularith_sub_ul_ul_ge+0xb>
mov    %rax,(%rdi)
ret

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

LLVM IR (-O2):
define void @ularith_sub_ul_ul_ge(i64* nocapture %0, i64 %1) {
%3 = load i64, i64* %0
%4 = icmp ult i64 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = sub i64 %3, %1
store i64 %6, i64* %0
br label %7
7: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ u_char;

/* Variables and functions */
int __dn_comp(char const *, int /*<<< orphan*/ *, int, int /*<<< orphan*/ **,
              int /*<<< orphan*/ **);
int dn_comp(const char *exp_dn, u_char *comp_dn, int length, u_char **dnptrs,
            u_char **lastdnptr) {
  return __dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr);
}


x86 assembly (clang, -O0):
<dn_comp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <__dn_comp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dn_comp>:
jmp    1030 <__dn_comp@plt>

LLVM IR (-O0):
define i32 @dn_comp(i8* %0, i32* %1, i32 %2, i32** %3, i32** %4) {
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32**
%10 = alloca i32**
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32** %3, i32*** %9
store i32** %4, i32*** %10
%11 = load i8*, i8** %6
%12 = load i32*, i32** %7
%13 = load i32, i32* %8
%14 = load i32**, i32*** %9
%15 = load i32**, i32*** %10
%16 = call i32 @__dn_comp(i8* %11, i32* %12, i32 %13, i32** %14, i32** %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @dn_comp(i8* %0, i32* %1, i32 %2, i32** %3, i32** %4) {
%6 = tail call i32 @__dn_comp(i8* %0, i32* %1, i32 %2, i32** %3, i32** %4)
ret i32 %6
}
void sunxi_serial_init(int uart_port, void *gpio_cfg, int gpio_max) {}


x86 assembly (clang, -O0):
<sunxi_serial_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @sunxi_serial_init(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @sunxi_serial_init(i32 %0, i8* nocapture %1, i32 %2) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
uint32_t EMACPowerManagementControlGet(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x400EC000);
  return ((*((volatile uint32_t *)(ui32Base + 0x0000002C))) &
          (0x00000200 | 0x00000004 | 0x00000002 | 0x00000001));
}


x86 assembly (clang, -O0):
<EMACPowerManagementControlGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x2c,%eax
cltq
mov    (%rax),%eax
and    $0x207,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACPowerManagementControlGet>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x400ec000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rcx
mov    $0x207,%eax
and    0x2c(%rcx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @EMACPowerManagementControlGet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1074708480
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 44
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = and i32 %11, 519
ret i32 %12
}

LLVM IR (-O2):
define i32 @EMACPowerManagementControlGet(i32 %0) {
%2 = icmp eq i32 %0, 1074708480
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 44
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, 519
ret i32 %9
}
/* Variables and functions */
scalar_t__ isdigit(unsigned char);
int isstrdigit(const char *s) {
  for (; *s != '\0'; s++) {
    if (isdigit((unsigned char)*s) == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isstrdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1164 <isstrdigit+0x54>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    114e <isstrdigit+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    116b <isstrdigit+0x5b>
jmp    1153 <isstrdigit+0x43>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <isstrdigit+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @isstrdigit(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i64 @isdigit(i8 zeroext %8)
%11 = icmp eq i64 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
unsigned long long mult_sum(unsigned long long mult, unsigned long long max) {
  unsigned long long div;
  div = max / mult;
  return mult * (div * div + div) / 2;
}


x86 assembly (clang, -O0):
<mult_sum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x8(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
imul   -0x18(%rbp),%rcx
add    -0x18(%rbp),%rcx
imul   %rcx,%rax
shr    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mult_sum>:
mov    %rsi,%rax
mov    %rsi,%rcx
or     %rdi,%rcx
shr    $0x20,%rcx
je     1116 <mult_sum+0x16>
xor    %edx,%edx
div    %rdi
jmp    111a <mult_sum+0x1a>
xor    %edx,%edx
div    %edi
mov    %rax,%rcx
imul   %rax,%rcx
add    %rax,%rcx
imul   %rdi,%rcx
shr    %rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @mult_sum(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = udiv i64 %6, %7
store i64 %8, i64* %5
%9 = load i64, i64* %3
%10 = load i64, i64* %5
%11 = load i64, i64* %5
%12 = mul i64 %10, %11
%13 = load i64, i64* %5
%14 = add i64 %12, %13
%15 = mul i64 %9, %14
%16 = udiv i64 %15, 2
ret i64 %16
}

LLVM IR (-O2):
define i64 @mult_sum(i64 %0, i64 %1) {
%3 = udiv i64 %1, %0
%4 = mul i64 %3, %3
%5 = add i64 %4, %3
%6 = mul i64 %5, %0
%7 = lshr i64 %6, 1
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
DESTRUCTOR() { printf("In DESTRUCTOR\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"In DESTRUCTOR\00"
define i32 @DESTRUCTOR() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int test_imm_86int64_highword_reg(long long val) {
  return ((val >> 32) & (0x86 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_86int64_highword_reg>:
movabs $0x8600000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_86int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 134
%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_86int64_highword_reg(i64 %0) {
%2 = and i64 %0, 575525617664
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ malloc(unsigned int);
uint32_t *co_create_(unsigned size, uintptr_t entry) {
  (void)entry;
  uint32_t *t = (uint32_t *)malloc(size);
  return t;
}


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

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

LLVM IR (-O0):
define i32* @co_create_(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32*
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i32, i32* %3
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
%10 = load i32*, i32** %5
ret i32* %10
}

LLVM IR (-O2):
define i32* @co_create_(i32 %0, i64 %1) {
%3 = tail call i64 @malloc(i32 %0)
%4 = inttoptr i64 %3 to i32*
ret i32* %4
}
int seq_search(int array[], int n, int key) {
  int i;
  for (i = 0; i < n; i++)
    if (array[i] == key)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<seq_search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <seq_search+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1140 <seq_search+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <seq_search+0x5a>
jmp    1145 <seq_search+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <seq_search+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_search>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <seq_search+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <seq_search+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <seq_search+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @seq_search(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ yarn_suspend_on_tokens(unsigned long *, int);
void yarn_suspend_on_token(unsigned long token) {
  yarn_suspend_on_tokens(&token, 1);
}


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

x86 assembly (clang, -O2):
<yarn_suspend_on_token>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
mov    $0x1,%esi
call   1030 <yarn_suspend_on_tokens@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @yarn_suspend_on_token(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @yarn_suspend_on_tokens(i64* %2, i32 1)
ret void
}

LLVM IR (-O2):
define void @yarn_suspend_on_token(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @yarn_suspend_on_tokens(i64* %2, i32 1)
ret void
}
int x86_cleanup(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @x86_cleanup() {
ret i32 1
}
/* Type definitions */
struct VFile {
  int dummy;
};

/* Variables and functions */
struct VFile *VFileOpenFD(char const *, int);
struct VFile *VFileOpen(const char *path, int flags) {
  return VFileOpenFD(path, flags);
}


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

x86 assembly (clang, -O2):
<VFileOpen>:
jmp    1030 <VFileOpenFD@plt>

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

LLVM IR (-O2):
%struct.VFile = type { i32 }
define %struct.VFile* @VFileOpen(i8* %0, i32 %1) {
%3 = tail call %struct.VFile* @VFileOpenFD(i8* %0, i32 %1)
ret %struct.VFile* %3
}
int os_set_fdlimit(unsigned int max_descriptors) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @os_set_fdlimit(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ F_DUPFD;
int fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int dup(int fildes) { return fcntl(fildes, F_DUPFD, 0); }


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

x86 assembly (clang, -O2):
<dup>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <fcntl@plt>

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

LLVM IR (-O2):
@F_DUPFD = global i32 0
define i32 @dup(i32 %0) {
%2 = load i32, i32* @F_DUPFD
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
ret i32 %3
}
long map(long x, long in_min, long in_max, long out_min, long out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}


x86 assembly (clang, -O0):
<map>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    -0x18(%rbp),%rcx
sub    -0x10(%rbp),%rcx
cqto
idiv   %rcx
add    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<map>:
mov    %r8,%rax
mov    %rdx,%r8
sub    %rsi,%rdi
sub    %rcx,%rax
imul   %rdi,%rax
sub    %rsi,%r8
mov    %rax,%rdx
or     %r8,%rdx
shr    $0x20,%rdx
je     1128 <map+0x28>
cqto
idiv   %r8
add    %rcx,%rax
ret
xor    %edx,%edx
div    %r8d
add    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @map(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = sub nsw i64 %11, %12
%14 = load i64, i64* %10
%15 = load i64, i64* %9
%16 = sub nsw i64 %14, %15
%17 = mul nsw i64 %13, %16
%18 = load i64, i64* %8
%19 = load i64, i64* %7
%20 = sub nsw i64 %18, %19
%21 = sdiv i64 %17, %20
%22 = load i64, i64* %9
%23 = add nsw i64 %21, %22
ret i64 %23
}

LLVM IR (-O2):
define i64 @map(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = sub nsw i64 %0, %1
%7 = sub nsw i64 %4, %3
%8 = mul nsw i64 %7, %6
%9 = sub nsw i64 %2, %1
%10 = sdiv i64 %8, %9
%11 = add nsw i64 %10, %3
ret i64 %11
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void *memdup(const void *data, size_t size) {
  void *m = malloc(size);
  if (m == NULL) {
    return NULL;
  }
  memcpy(m, data, size);
  return m;
}


x86 assembly (clang, -O0):
<memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1155 <memdup+0x35>
movq   $0x0,-0x8(%rbp)
jmp    116e <memdup+0x4e>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memdup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1149 <memdup+0x29>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @memdup(i8* %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memcpy(i8* %3, i8* %0, i64 %1)
br label %7
7: ; preds = %2, %5
ret i8* %3
}