xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ set_lock(int, int, int /*<<< orphan*/, unsigned long long);
set_lock_start(int fd, int type, long long unsigned len) {
  set_lock(fd, type, 0, len);
}


x86 assembly (clang, -O0):
<set_lock_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
xor    %edx,%edx
call   1030 <set_lock@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_lock_start>:
mov    %rdx,%rcx
xor    %edx,%edx
jmp    1030 <set_lock@plt>

LLVM IR (-O0):
define i32 @set_lock_start(i32 %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32 %0, i32* %5
store i32 %1, i32* %6
store i64 %2, i64* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load i64, i64* %7
%11 = call i32 @set_lock(i32 %8, i32 %9, i32 0, i64 %10)
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
define i32 @set_lock_start(i32 %0, i32 %1, i64 %2) {
%4 = tail call i32 @set_lock(i32 %0, i32 %1, i32 0, i64 %2)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ hexDump(int /*<<< orphan*/ *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ perror(char *);
int main(void) {
  FILE *f = fopen("a.out", "r");
  if (f == NULL) {
    perror("a.out");
    exit(1);
  }
  hexDump(f, 0, 100, 16);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1187 <main+0x47>
lea    0xe88(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
mov    $0x10,%ecx
call   1030 <hexDump@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1171 <main+0x31>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x64,%edx
mov    $0x10,%ecx
call   1030 <hexDump@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe88(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"a.out\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = load i32*, i32** %2
%11 = call i32 @hexDump(i32* %10, i32 0, i32 100, i32 16)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"a.out\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
%7 = tail call i32 @hexDump(i32* %1, i32 0, i32 100, i32 16)
ret i32 0
}
int is_prime(int num) {
  if (num < 1) {
    return -1;
  }
  int i;
  for (i = 2; i < num; i++) {
    if (num % i == 0) {
      if (num == 2) {
        return 1;
      } else {
        return 0;
      }
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    111d <is_prime+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <is_prime+0x7c>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1175 <is_prime+0x75>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1162 <is_prime+0x62>
cmpl   $0x2,-0x8(%rbp)
jne    1156 <is_prime+0x56>
movl   $0x1,-0x4(%rbp)
jmp    117c <is_prime+0x7c>
movl   $0x0,-0x4(%rbp)
jmp    117c <is_prime+0x7c>
jmp    1167 <is_prime+0x67>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <is_prime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
test   %edi,%edi
jle    1133 <is_prime+0x33>
mov    $0x1,%ecx
cmp    $0x3,%edi
jb     1130 <is_prime+0x30>
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1139 <is_prime+0x39>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <is_prime+0x20>
mov    %ecx,%eax
ret
mov    $0xffffffff,%eax
ret
xor    %ecx,%ecx
cmp    $0x2,%edi
sete   %cl
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 2
br i1 %4, label %7, label %15
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %15, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7
%13 = icmp eq i32 %0, 2
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %5, %3, %12, %1
%16 = phi i32 [ -1, %1 ], [ %14, %12 ], [ 1, %3 ], [ 1, %5 ]
ret i32 %16
}
__int128_t __attribute__((no)) shift_53_ll(long long data) {
  return (__int128_t)data << 53;
}


x86 assembly (clang, -O0):
<shift_53_ll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,%rax
sar    $0x3f,%rax
shld   $0x35,%rcx,%rax
shl    $0x35,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_53_ll>:
mov    %rdi,%rax
mov    %rdi,%rdx
sar    $0x3f,%rdx
shld   $0x35,%rdi,%rdx
shl    $0x35,%rax
ret

LLVM IR (-O0):
define { i64, i64 } @shift_53_ll(i64 %0) {
%2 = alloca i128
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = sext i64 %4 to i128
%6 = shl i128 %5, 53
store i128 %6, i128* %2
%7 = bitcast i128* %2 to { i64, i64 }*
%8 = load { i64, i64 }, { i64, i64 }* %7
ret { i64, i64 } %8
}

LLVM IR (-O2):
define { i64, i64 } @shift_53_ll(i64 %0) {
%2 = sext i64 %0 to i128
%3 = shl nsw i128 %2, 53
%4 = trunc i128 %3 to i64
%5 = lshr i128 %3, 64
%6 = trunc i128 %5 to i64
%7 = insertvalue { i64, i64 } poison, i64 %4, 0
%8 = insertvalue { i64, i64 } %7, i64 %6, 1
ret { i64, i64 } %8
}
/* Variables and functions */
int f348(int *);
int f349(int *p) { return f348(p); }


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

x86 assembly (clang, -O2):
<f349>:
jmp    1030 <f348@plt>

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

LLVM IR (-O2):
define i32 @f349(i32* %0) {
%2 = tail call i32 @f348(i32* %0)
ret i32 %2
}
int hex2long() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @hex2long() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ expundefined();
void experror(char *err_str) {
  error(err_str);
  expundefined();
}


x86 assembly (clang, -O0):
<experror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <error@plt>
mov    $0x0,%al
call   1040 <expundefined@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<experror>:
push   %rax
call   1030 <error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <expundefined@plt>

LLVM IR (-O0):
define void @experror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @error(i8* %3)
%5 = call i32 (...) @expundefined()
ret void
}

LLVM IR (-O2):
define void @experror(i8* %0) {
%2 = tail call i32 @error(i8* %0)
%3 = tail call i32 (...) @expundefined()
ret void
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
int16_t PQCLEAN_KYBER512_CLEAN_montgomery_reduce(int32_t a) {
  int32_t t;
  int16_t u;
  u = (int16_t)(a * (int64_t)62209);
  t = (int32_t)u * 3329;
  t = a - t;
  t >>= 16;
  return (int16_t)t;
}


x86 assembly (clang, -O0):
<PQCLEAN_KYBER512_CLEAN_montgomery_reduce>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0xf301,-0x4(%rbp),%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
imul   $0xd01,%eax,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PQCLEAN_KYBER512_CLEAN_montgomery_reduce>:
imul   $0xf3a80000,%edi,%eax
sar    $0x10,%eax
cltq
ret

LLVM IR (-O0):
define i64 @PQCLEAN_KYBER512_CLEAN_montgomery_reduce(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 62209
%7 = sext i32 %6 to i64
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = trunc i64 %8 to i32
%10 = mul nsw i32 %9, 3329
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = sub nsw i32 %11, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = ashr i32 %14, 16
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
ret i64 %17
}

LLVM IR (-O2):
define i64 @PQCLEAN_KYBER512_CLEAN_montgomery_reduce(i32 %0) {
%2 = mul i32 %0, -207093760
%3 = ashr exact i32 %2, 16
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  for (int i = 0; i < (12 - 1); i += (3)) {
    printf("I can count to %d!\n", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jge    1154 <main+0x44>
mov    -0x14(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"I can count to %d!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %13, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 11
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 3
store i32 %15, i32* %6
br label %7
16: ; preds = %7
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [20 x i8] c"I can count to %d!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 6)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 9)
ret i32 0
}
int gcd(int a, int b) {
  int temp;
  if (a > b) {
    temp = a;
    a = b;
    b = temp;
  }
  while (a > 0) {
    temp = b % a;
    b = a;
    a = temp;
  }
  return b;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1128 <gcd+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    112d <gcd+0x2d>
cmpl   $0x0,-0x4(%rbp)
jle    1152 <gcd+0x52>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112d <gcd+0x2d>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %esi,%eax
cmp    %esi,%edi
mov    %edi,%edx
cmovg  %esi,%edx
cmovg  %edi,%eax
test   %edx,%edx
jle    111d <gcd+0x1d>
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jg     1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
%5 = select i1 %3, i32 %0, i32 %1
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %12
7: ; preds = %2, %7
%8 = phi i32 [ %9, %7 ], [ %5, %2 ]
%9 = phi i32 [ %10, %7 ], [ %4, %2 ]
%10 = srem i32 %8, %9
%11 = icmp sgt i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7, %2
%13 = phi i32 [ %5, %2 ], [ %9, %7 ]
ret i32 %13
}
void RTAvlroIOPortDestroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlroIOPortDestroy() {
ret void
}
void foo_1_2_2_1_2_2_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_2_1_2_2_2_2_2() {
ret void
}
__attribute__((no, noclone)) void bar(int x) {
  if (x != -1)
    __builtin_abort();
}


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

x86 assembly (clang, -O2):
<bar>:
cmp    $0xffffffff,%edi
jne    1116 <bar+0x6>
ret
push   %rax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @bar(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %4, label %3
3: ; preds = %1
tail call void @abort()
unreachable
4: ; preds = %1
ret void
}
/* Type definitions */
struct game {
  int dummy;
};

/* Variables and functions */
char const winner(struct game const *);
int evaluate(const struct game *game, const char player) {
  return player * winner(game);
}


x86 assembly (clang, -O0):
<evaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <winner@plt>
mov    %al,%cl
mov    -0x10(%rbp),%eax
movsbl %cl,%ecx
imul   %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate>:
push   %rbx
mov    %esi,%ebx
call   1030 <winner@plt>
movsbl %al,%eax
imul   %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.game = type { i32 }
define i32 @evaluate(%struct.game* %0, i8 signext %1) {
%3 = alloca %struct.game*
%4 = alloca i8
store %struct.game* %0, %struct.game** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = load %struct.game*, %struct.game** %3
%8 = call signext i8 @winner(%struct.game* %7)
%9 = sext i8 %8 to i32
%10 = mul nsw i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
%struct.game = type { i32 }
define i32 @evaluate(%struct.game* %0, i8 signext %1) {
%3 = sext i8 %1 to i32
%4 = tail call signext i8 @winner(%struct.game* %0)
%5 = sext i8 %4 to i32
%6 = mul nsw i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ screen_init();
void console_init(void) { screen_init(); }


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

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

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

LLVM IR (-O2):
define void @console_init() {
%1 = tail call i32 (...) @screen_init()
ret void
}
void zeroVector(int dimensions, double *components) {
  for (int i = 0; i < dimensions; i++) {
    components[i] = 0.0;
  }
}


x86 assembly (clang, -O0):
<zeroVector>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    113c <zeroVector+0x3c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1112 <zeroVector+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeroVector>:
test   %edi,%edi
jle    1129 <zeroVector+0x19>
push   %rax
mov    %edi,%edx
shl    $0x3,%rdx
mov    %rsi,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @zeroVector(i32 %0, double* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast double* %1 to i8*
%6 = zext i32 %0 to i64
%7 = shl nuw nsw i64 %6, 3
br label %8
8: ; preds = %4, %2
ret void
}
double vec3_dot(double *a, double *b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}


x86 assembly (clang, -O0):
<vec3_dot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_dot>:
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @vec3_dot(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Type definitions */
typedef int /*<<< orphan*/ height;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int trap(int *, int);
int main(int argc, char *argv[]) {
  int height[] = {6, 4, 2, 0, 3, 2, 0, 3, 1, 4, 5, 3, 2, 7};
  int ret = trap(height, sizeof(height) / 4);
  printf("%d\n", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0xe,%esi
call   1050 <trap@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    0xf05(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xe,%esi
call   1040 <trap@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
@__const.main.height = [14 x i32] [i32 6, i32 4, i32 2, i32 0, i32 3, i32 2, i32 0, i32 3, i32 1, i32 4, i32 5, i32 3, i32 2, i32 7]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [14 x i32]
%4 = bitcast [14 x i32]* %3 to i8*
%5 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 0
%6 = call i32 @trap(i32* %5, i32 14)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int __builtin_nyuzi_read_control_reg(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char, int);
void tlb_miss_handler() {
  printf("%cTLB miss %08x\n",
         __builtin_nyuzi_read_control_reg(3) == 5 ? 'I' : 'D',
         __builtin_nyuzi_read_control_reg(5));
  exit(0);
}


x86 assembly (clang, -O0):
<tlb_miss_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,%edx
mov    $0x44,%eax
mov    $0x49,%ecx
cmp    $0x5,%edx
cmove  %ecx,%eax
mov    %al,-0x1(%rbp)
mov    $0x5,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,%edx
mov    -0x1(%rbp),%al
lea    0xe93(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<tlb_miss_handler>:
push   %rbx
mov    $0x3,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
xor    %ebx,%ebx
cmp    $0x5,%eax
sete   %bl
mov    $0x5,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
lea    (%rbx,%rbx,4),%esi
add    $0x44,%esi
lea    0xea6(%rip),%rdi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"%cTLB miss %08x\0A\00"
define void @tlb_miss_handler() {
%1 = call i32 @__builtin_nyuzi_read_control_reg(i32 3)
%2 = icmp eq i32 %1, 5
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 73, i32 68
%5 = trunc i32 %4 to i8
%6 = call i32 @__builtin_nyuzi_read_control_reg(i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %5, i32 %6)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"%cTLB miss %08x\0A\00"
define void @tlb_miss_handler() {
%1 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 3)
%2 = icmp eq i32 %1, 5
%3 = select i1 %2, i8 73, i8 68
%4 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 5)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %3, i32 %4)
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ generate_crc64_table();
int /*<<< orphan*/ print_crc64_table();
int main(int argc, char *argv[]) {
  generate_crc64_table();
  print_crc64_table();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @generate_crc64_table()
%7 = call i32 (...) @print_crc64_table()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @generate_crc64_table()
%4 = tail call i32 (...) @print_crc64_table()
ret i32 0
}
int isdecr(unsigned int num) {
  int prev = 0;
  while (num) {
    unsigned int digit = num % 10;
    num /= 10;
    if (digit < prev)
      return 0;
    prev = digit;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isdecr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1159 <isdecr+0x59>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    114e <isdecr+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1160 <isdecr+0x60>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110e <isdecr+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdecr>:
xor    %ecx,%ecx
mov    $0xcccccccd,%eax
nopw   0x0(%rax,%rax,1)
test   %edi,%edi
je     1131 <isdecr+0x31>
mov    %edi,%edx
imul   %rax,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edi
cmp    %ecx,%edi
mov    %edi,%ecx
mov    %edx,%edi
jae    1110 <isdecr+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @isdecr(i32 %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i32 [ %0, %1 ], [ %8, %6 ]
%4 = phi i32 [ 0, %1 ], [ %7, %6 ]
%5 = icmp eq i32 %3, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = urem i32 %3, 10
%8 = udiv i32 %3, 10
%9 = icmp ult i32 %7, %4
br i1 %9, label %10, label %2
10: ; preds = %2, %6
%11 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %11
}
int isprint(int c) { return (31 < c && c < 127); }


x86 assembly (clang, -O0):
<isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    $0x1f,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x5(%rbp)
jge    1124 <isprint+0x24>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
void mdp4_dtv_vsync_ctrl(struct fb_info *info, int enable) {}


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

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

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

LLVM IR (-O2):
%struct.fb_info = type opaque
define void @mdp4_dtv_vsync_ctrl(%struct.fb_info* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ get_rs(int /*<<< orphan*/);
int32_t get_base(int32_t instruction) { return get_rs(instruction); }


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

x86 assembly (clang, -O2):
<get_base>:
jmp    1030 <get_rs@plt>

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

LLVM IR (-O2):
define i32 @get_base(i32 %0) {
%2 = tail call i32 @get_rs(i32 %0)
ret i32 %2
}
unsigned long isset(unsigned long field, unsigned long flag) {
  if ((field & flag) == flag)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    -0x18(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    112b <isset+0x2b>
movq   $0x1,-0x8(%rbp)
jmp    1133 <isset+0x33>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isset>:
not    %rdi
xor    %eax,%eax
test   %rdi,%rsi
sete   %al
ret

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

LLVM IR (-O2):
define i64 @isset(i64 %0, i64 %1) {
%3 = and i64 %1, %0
%4 = icmp eq i64 %3, %1
%5 = zext i1 %4 to i64
ret i64 %5
}
int MinhaFuncMaiorValor(int a, int b) {
  if (a >= b)
    return a;
  else
    return b;
}


x86 assembly (clang, -O0):
<MinhaFuncMaiorValor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1121 <MinhaFuncMaiorValor+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <MinhaFuncMaiorValor+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @MinhaFuncMaiorValor(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 sge 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 %13
11: ; preds = %2
%12 = load i32, i32* %5
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @MinhaFuncMaiorValor(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
unsigned xrop3_158_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  unsigned stk4;
  stk4 = D & S;
  stk3 = T | stk4;
  stk2 = S ^ stk3;
  stk1 = D ^ stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_158_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_158_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
store i32 %17, i32* %6
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
store i32 %23, i32* %7
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = and i32 %24, %25
store i32 %26, i32* %11
%27 = load i32, i32* %7
%28 = load i32, i32* %11
%29 = or i32 %27, %28
store i32 %29, i32* %10
%30 = load i32, i32* %6
%31 = load i32, i32* %10
%32 = xor i32 %30, %31
store i32 %32, i32* %9
%33 = load i32, i32* %5
%34 = load i32, i32* %9
%35 = xor i32 %33, %34
store i32 %35, i32* %8
%36 = load i32, i32* %8
ret i32 %36
}

LLVM IR (-O2):
define i32 @xrop3_158_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %3, -1
%8 = xor i32 %6, %4
%9 = and i32 %8, %7
%10 = xor i32 %9, 255
ret i32 %10
}
void words(const char *sentence, void (*walker)(const char *, void *),
           void *memo) {
  (*walker)(sentence, memo);
}


x86 assembly (clang, -O0):
<words>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<words>:
mov    %rsi,%rax
mov    %rdx,%rsi
jmp    *%rax

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

LLVM IR (-O2):
define void @words(i8* %0, void (i8*, i8*)* nocapture %1, i8* %2) {
tail call void %1(i8* %0, i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef scalar_t__ gid_t;

/* Variables and functions */
int uid_is_dynamic(int /*<<< orphan*/);
bool gid_is_dynamic(gid_t gid) { return uid_is_dynamic((uid_t)gid); }


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

x86 assembly (clang, -O2):
<gid_is_dynamic>:
jmp    1030 <uid_is_dynamic@plt>

LLVM IR (-O0):
define i32 @gid_is_dynamic(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = call i32 @uid_is_dynamic(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @gid_is_dynamic(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @uid_is_dynamic(i32 %2)
ret i32 %3
}
/* Variables and functions */
bool contains(long value, long *byte_indices, long length) {
  long i;
  for (i = 0L; i < length; i++) {
    if (byte_indices[i] == value) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<contains>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    115e <contains+0x5e>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x10(%rbp),%rax
jne    1148 <contains+0x48>
movl   $0x1,-0x4(%rbp)
jmp    1165 <contains+0x65>
jmp    114d <contains+0x4d>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1118 <contains+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<contains>:
test   %rdx,%rdx
jle    111f <contains+0x1f>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmp    %rdi,(%rsi,%rax,8)
je     1122 <contains+0x22>
add    $0x1,%rax
cmp    %rax,%rdx
jne    1110 <contains+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @contains(i64 %0, i64* nocapture %1, i64 %2) {
%4 = icmp sgt i64 %2, 0
br i1 %4, label %7, label %13
5: ; preds = %7
%6 = icmp eq i64 %12, %2
br i1 %6, label %13, label %7
7: ; preds = %3, %5
%8 = phi i64 [ %12, %5 ], [ 0, %3 ]
%9 = getelementptr inbounds i64, i64* %1, i64 %8
%10 = load i64, i64* %9
%11 = icmp eq i64 %10, %0
%12 = add nuw nsw i64 %8, 1
br i1 %11, label %13, label %5
13: ; preds = %7, %5, %3
%14 = phi i32 [ 0, %3 ], [ 0, %5 ], [ 1, %7 ]
ret i32 %14
}
void ctl_total_time(int tt) {}


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

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

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

LLVM IR (-O2):
define void @ctl_total_time(i32 %0) {
ret void
}
/* Type definitions */
typedef void *malloc;

/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ memcpy(void *, void *, size_t);
void *realloc(void *, size_t);
void *(incmem)(void *m, size_t x, size_t nx) {
  void *nm;
  if (!(nm = realloc(m, nx))) {
    if (x > nx)
      x = nx;
    nm = (malloc)(nx);
    memcpy(nm, m, x);
    free(m);
  }
  return nm;
}


x86 assembly (clang, -O0):
<incmem>:
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    -0x18(%rbp),%rsi
call   1050 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1197 <incmem+0x67>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1175 <incmem+0x45>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<incmem>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rdx,%rsi
call   1050 <realloc@plt>
test   %rax,%rax
jne    116b <incmem+0x3b>
cmp    %rbx,%r15
cmova  %rbx,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @incmem(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = call i8* @realloc(i8* %8, i64 %9)
store i8* %10, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %27, label %12
12: ; preds = %3
%13 = load i64, i64* %5
%14 = load i64, i64* %6
%15 = icmp ugt i64 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i64, i64* %6
store i64 %17, i64* %5
br label %18
18: ; preds = %16, %12
%19 = load i64, i64* %6
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = load i8*, i8** %4
%23 = load i64, i64* %5
%24 = call i32 @memcpy(i8* %21, i8* %22, i64 %23)
%25 = load i8*, i8** %4
%26 = call i32 @free(i8* %25)
br label %27
27: ; preds = %18, %3
%28 = load i8*, i8** %7
ret i8* %28
}

LLVM IR (-O2):
define i8* @incmem(i8* %0, i64 %1, i64 %2) {
%4 = tail call i8* @realloc(i8* %0, i64 %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = icmp ugt i64 %1, %2
%8 = select i1 %7, i64 %2, i64 %1
%9 = inttoptr i64 %2 to i8*
%10 = tail call i32 @memcpy(i8* %9, i8* %0, i64 %8)
%11 = tail call i32 @free(i8* %0)
br label %12
12: ; preds = %6, %3
%13 = phi i8* [ %4, %3 ], [ %9, %6 ]
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ ATOMIC_ADD_EXCHANGE_int(int volatile *, int, int);
int atomic_add_exchange_int(volatile int *var, int value) {
  int temp;
  ATOMIC_ADD_EXCHANGE_int(var, value, temp);
  return (temp + value);
}


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

x86 assembly (clang, -O2):
<atomic_add_exchange_int>:
jmp    1030 <ATOMIC_ADD_EXCHANGE_int@plt>

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

LLVM IR (-O2):
define i32 @atomic_add_exchange_int(i32* %0, i32 %1) {
%3 = tail call i32 @ATOMIC_ADD_EXCHANGE_int(i32* %0, i32 %1, i32 undef)
ret i32 undef
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *GO_strdup(const char *cs) {
  char *t = malloc(strlen(cs) + 1);
  if (t)
    strcpy(t, cs);
  return t;
}


x86 assembly (clang, -O0):
<GO_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <GO_strdup+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GO_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <GO_strdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @GO_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = call i32 @strcpy(i8* %11, i8* %12)
br label %14
14: ; preds = %10, %1
%15 = load i8*, i8** %3
ret i8* %15
}

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