xunge/DecIR huggingface dataset:
int gt(x, y) { return x > y; }


x86 assembly (clang, -O0):
<gt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gt>:
xor    %eax,%eax
cmp    %esi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @gt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @gt(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
double sin(foo)
int foo __attribute__((unused));
{ return strtod("nan", 0); }


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

x86 assembly (clang, -O2):
<sin>:
lea    0xee9(%rip),%rdi
xor    %esi,%esi
jmp    1030 <strtod@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"nan\00"
define double @sin(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call double @strtod(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** null)
ret double %3
}

LLVM IR (-O2):
@.str = [4 x i8] c"nan\00"
define double @sin(i32 %0) {
%2 = tail call double @strtod(i8* nocapture getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** null)
ret double %2
}
/* Variables and functions */
int irnd();
int /*<<< orphan*/ printf(char *, ...);
void uniform_random_number() {
  int j;
  for (j = 0; j < 100; j++) {
    printf("%8d", irnd());
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<uniform_random_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    115e <uniform_random_number+0x3e>
mov    $0x0,%al
call   1040 <irnd@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <uniform_random_number+0xf>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uniform_random_number>:
push   %rbp
push   %rbx
push   %rax
mov    $0x64,%ebp
lea    0xec1(%rip),%rbx
nop
xor    %eax,%eax
call   1050 <irnd@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1140 <uniform_random_number+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%8d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @uniform_random_number() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %8, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 100
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = call i32 (...) @irnd()
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
br label %2
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%8d\00"
define void @uniform_random_number() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 (...) @irnd()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 100
br i1 %6, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int setlogmask(int);
void raiseVerbosity() { setlogmask((setlogmask(0) << 1) + 1); }


x86 assembly (clang, -O0):
<raiseVerbosity>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <setlogmask@plt>
mov    %eax,%edi
shl    $0x1,%edi
add    $0x1,%edi
call   1030 <setlogmask@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<raiseVerbosity>:
push   %rax
xor    %edi,%edi
call   1030 <setlogmask@plt>
lea    (%rax,%rax,1),%edi
add    $0x1,%edi
pop    %rax
jmp    1030 <setlogmask@plt>

LLVM IR (-O0):
define void @raiseVerbosity() {
%1 = call i32 @setlogmask(i32 0)
%2 = shl i32 %1, 1
%3 = add nsw i32 %2, 1
%4 = call i32 @setlogmask(i32 %3)
ret void
}

LLVM IR (-O2):
define void @raiseVerbosity() {
%1 = tail call i32 @setlogmask(i32 0)
%2 = shl i32 %1, 1
%3 = or i32 %2, 1
%4 = tail call i32 @setlogmask(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void die(char *file) {
  fprintf(stderr, "%s: %s\n", file, strerror(errno));
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
lea    0xe91(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeac(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i32, i32* @errno
%6 = call i8* @strerror(i32 %5)
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
}
/* Type definitions */
struct srcu_struct {
  int dummy;
};

/* Variables and functions */
int __srcu_read_lock(struct srcu_struct *);
__attribute__((always_)) int srcu_read_lock(struct srcu_struct *sp) {
  int retval = __srcu_read_lock(sp);
  do {
  } while (0);
  return retval;
}


x86 assembly (clang, -O0):
<srcu_read_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__srcu_read_lock@plt>
mov    %eax,-0xc(%rbp)
jmp    112d <srcu_read_lock+0x1d>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srcu_read_lock>:
jmp    1030 <__srcu_read_lock@plt>

LLVM IR (-O0):
%struct.srcu_struct = type { i32 }
define i32 @srcu_read_lock(%struct.srcu_struct* %0) {
%2 = alloca %struct.srcu_struct*
%3 = alloca i32
store %struct.srcu_struct* %0, %struct.srcu_struct** %2
%4 = load %struct.srcu_struct*, %struct.srcu_struct** %2
%5 = call i32 @__srcu_read_lock(%struct.srcu_struct* %4)
store i32 %5, i32* %3
br label %6
6: ; preds = %1
br label %7
7: ; preds = %6
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
%struct.srcu_struct = type { i32 }
define i32 @srcu_read_lock(%struct.srcu_struct* %0) {
%2 = tail call i32 @__srcu_read_lock(%struct.srcu_struct* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ foo2(int);
int /*<<< orphan*/ getWakeLock(int);
void foo1(int i) {
  if (i % 2 != 0)
    getWakeLock(1);
  else
    getWakeLock(0);
  foo2(i - 1);
}


x86 assembly (clang, -O0):
<foo1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     114e <foo1+0x2e>
mov    $0x1,%edi
call   1030 <getWakeLock@plt>
jmp    1155 <foo1+0x35>
xor    %edi,%edi
call   1030 <getWakeLock@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <foo2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo1>:
push   %rbx
mov    %edi,%ebx
and    $0x1,%edi
call   1030 <getWakeLock@plt>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <foo2@plt>

LLVM IR (-O0):
define void @foo1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @getWakeLock(i32 1)
br label %10
8: ; preds = %1
%9 = call i32 @getWakeLock(i32 0)
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 1
%13 = call i32 @foo2(i32 %12)
ret void
}

LLVM IR (-O2):
define void @foo1(i32 %0) {
%2 = and i32 %0, 1
%3 = tail call i32 @getWakeLock(i32 %2)
%4 = add nsw i32 %0, -1
%5 = tail call i32 @foo2(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ptoo(char *, char *, char *, char *);
void main(int argc, char *argv[]) { ptoo(argv[1], argv[2], argv[3], argv[4]); }


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

x86 assembly (clang, -O2):
<main>:
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rax
mov    0x18(%rsi),%rdx
mov    0x20(%rsi),%rcx
mov    %rax,%rsi
jmp    1030 <ptoo@plt>

LLVM IR (-O0):
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 2
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 3
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 4
%16 = load i8*, i8** %15
%17 = call i32 @ptoo(i8* %7, i8* %10, i8* %13, i8* %16)
ret void
}

LLVM IR (-O2):
define void @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 3
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 4
%10 = load i8*, i8** %9
%11 = tail call i32 @ptoo(i8* %4, i8* %6, i8* %8, i8* %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_MAKE_POT_POWER_OUTPUT() { set_io_bit(0x72, 7); }


x86 assembly (clang, -O0):
<TOSH_MAKE_POT_POWER_OUTPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x72,%edi
mov    $0x7,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_POT_POWER_OUTPUT>:
mov    $0x72,%edi
mov    $0x7,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_POT_POWER_OUTPUT() {
%1 = call i32 @set_io_bit(i32 114, i32 7)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_POT_POWER_OUTPUT() {
%1 = tail call i32 @set_io_bit(i32 114, i32 7)
ret void
}
int test_imm_37uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x37 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_37uint64_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, 55
%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_37uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 55
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
vdtext(length, char_array) int *length, char_array[];
{ vitext(length, char_array); }


x86 assembly (clang, -O0):
<vdtext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <vitext@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @vdtext(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 = call i32 (i32*, i32*, ...) bitcast (i32 (...)* @vitext to i32 (i32*, i32*, ...)*)(i32* %6, i32* %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @vdtext(i32* %0, i32* %1) {
%3 = tail call i32 (i32*, i32*, ...) bitcast (i32 (...)* @vitext to i32 (i32*, i32*, ...)*)(i32* %0, i32* %1)
ret i32 undef
}
/* Type definitions */
struct tiff_tag {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct tiff_tag *);
void tiff_free_tag(struct tiff_tag *tag) { free(tag); }


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

x86 assembly (clang, -O2):
<tiff_free_tag>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.tiff_tag = type { i32 }
define void @tiff_free_tag(%struct.tiff_tag* %0) {
%2 = alloca %struct.tiff_tag*
store %struct.tiff_tag* %0, %struct.tiff_tag** %2
%3 = load %struct.tiff_tag*, %struct.tiff_tag** %2
%4 = call i32 @free(%struct.tiff_tag* %3)
ret void
}

LLVM IR (-O2):
%struct.tiff_tag = type { i32 }
define void @tiff_free_tag(%struct.tiff_tag* nocapture %0) {
%2 = tail call i32 @free(%struct.tiff_tag* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int ad_set_token_bound(int, int, int /*<<< orphan*/);
int ad_reset_token_bound(int q, int gp_dst) {
  return ad_set_token_bound(q, gp_dst, (uint16_t)0x00C0);
}


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

x86 assembly (clang, -O2):
<ad_reset_token_bound>:
mov    $0xc0,%edx
jmp    1030 <ad_set_token_bound@plt>

LLVM IR (-O0):
define i32 @ad_reset_token_bound(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @ad_set_token_bound(i32 %5, i32 %6, i32 192)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ad_reset_token_bound(i32 %0, i32 %1) {
%3 = tail call i32 @ad_set_token_bound(i32 %0, i32 %1, i32 192)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ ssgl_log(int, char *, char *, int);
void ssgl_exit(char *reason, int code) {
  ssgl_log(2, "ssgl_server exiting, reason: %s, exit code = %d\n", reason,
           code);
  exit(code);
}


x86 assembly (clang, -O0):
<ssgl_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    $0x2,%edi
lea    0xebe(%rip),%rsi
call   1030 <ssgl_log@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ssgl_exit>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
lea    0xed3(%rip),%rsi
mov    $0x2,%edi
mov    %ebx,%ecx
call   1030 <ssgl_log@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"ssgl_server exiting, reason: %s, exit code = %d\0A\00"
define void @ssgl_exit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @ssgl_log(i32 2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@.str = [49 x i8] c"ssgl_server exiting, reason: %s, exit code = %d\0A\00"
define void @ssgl_exit(i8* %0, i32 %1) {
%3 = tail call i32 @ssgl_log(i32 2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%4 = tail call i32 @exit(i32 %1)
unreachable
}
/* Type definitions */
typedef unsigned int uint64_t;

/* Variables and functions */
__attribute__((always_)) uint64_t rotr64(const uint64_t w, const unsigned c) {
  return (w >> c) | (w << (64 - c));
}


x86 assembly (clang, -O0):
<rotr64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x40,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotr64>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
neg    %cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rotr64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub i32 64, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rotr64(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub i32 64, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
void EC_POINT_copy(void) {}


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

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

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

LLVM IR (-O2):
define void @EC_POINT_copy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ g();
main() {
  int local = 5;
  abort();
  int local2 = 3;
  g();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%4 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @abort()
unreachable
}
int isatty(int fd) {
  if (fd == 0 || fd == 1 || fd == 2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isatty>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1125 <isatty+0x25>
cmpl   $0x1,-0x8(%rbp)
je     1125 <isatty+0x25>
cmpl   $0x2,-0x8(%rbp)
jne    1131 <isatty+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <isatty+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isatty>:
xor    %eax,%eax
cmp    $0x3,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @isatty(i32 %0) {
%2 = icmp ult i32 %0, 3
%3 = zext i1 %2 to i32
ret i32 %3
}
int realone(int var) { return var + 1; }


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

x86 assembly (clang, -O2):
<realone>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @realone(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void print_string_id(double id) { printf("%.20f\n", id); }


x86 assembly (clang, -O0):
<print_string_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"%.20f\0A\00"
define void @print_string_id(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %3)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.20f\0A\00"
define void @print_string_id(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EOVERFLOW;
int /*<<< orphan*/ errno;
int nat_add(unsigned long *result, unsigned long arg) {
  unsigned long tmp = *result + arg;
  if (tmp < arg) {
    errno = EOVERFLOW;
    return 1;
  }
  *result = tmp;
  return 0;
}


x86 assembly (clang, -O0):
<nat_add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1147 <nat_add+0x47>
mov    0x2ec0(%rip),%rax
mov    (%rax),%ecx
mov    0x2e9f(%rip),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1159 <nat_add+0x59>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nat_add>:
add    (%rdi),%rsi
jae    111d <nat_add+0x1d>
mov    0x2ee4(%rip),%rax
mov    (%rax),%eax
mov    0x2ec3(%rip),%rcx
mov    %eax,(%rcx)
mov    $0x1,%eax
ret
mov    %rsi,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@EOVERFLOW = global i32 0
@errno = global i32 0
define i32 @nat_add(i64* nocapture %0, i64 %1) {
%3 = load i64, i64* %0
%4 = add i64 %3, %1
%5 = icmp ult i64 %4, %1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = load i32, i32* @EOVERFLOW
store i32 %7, i32* @errno
br label %9
8: ; preds = %2
store i64 %4, i64* %0
br label %9
9: ; preds = %8, %6
%10 = phi i32 [ 1, %6 ], [ 0, %8 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *cmd) {
  fprintf(
      stderr,
      "Usage: %s [ -d delay ] [ -n iterations ] [ -p pid [ -t tid ] ] [ -h ]\n"
      "    -d delay       Time to sleep between updates.\n"
      "    -n iterations  Number of updates to show (0 = infinite).\n"
      "    -p pid         Process to monitor (default is all).\n"
      "    -t tid         Thread (within specified process) to monitor "
      "(default is all).\n"
      "    -h             Display this help screen.\n",
      cmd);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [365 x i8] c"Usage: %s [ -d delay ] [ -n iterations ] [ -p pid [ -t tid ] ] [ -h ]\0A -d delay Time to sleep between updates.\0A -n iterations Number of updates to show (0 = infinite).\0A -p pid Process to monitor (default is all).\0A -t tid Thread (within specified process) to monitor (default is all).\0A -h Display this help screen.\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([365 x i8], [365 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [365 x i8] c"Usage: %s [ -d delay ] [ -n iterations ] [ -p pid [ -t tid ] ] [ -h ]\0A -d delay Time to sleep between updates.\0A -n iterations Number of updates to show (0 = infinite).\0A -p pid Process to monitor (default is all).\0A -t tid Thread (within specified process) to monitor (default is all).\0A -h Display this help screen.\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([365 x i8], [365 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ outerr(char *);
void outfatal(char *tmp) {
  outerr(tmp);
  exit(1);
}


x86 assembly (clang, -O0):
<outfatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <outerr@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<outfatal>:
push   %rax
call   1040 <outerr@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @outfatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @outerr(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @outfatal(i8* %0) {
%2 = tail call i32 @outerr(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello, ");
  printf("\p");
  printf("world");
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"Hello, \00"
@.str.1 = [2 x i8] c"p\00"
@.str.2 = [6 x i8] c"world\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Hello, \00"
@.str.2 = [6 x i8] c"world\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 112)
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void signalhandler(int signum) {
  printf("received signal number is %d\n", signum);
  exit(signum);
}


x86 assembly (clang, -O0):
<signalhandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<signalhandler>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"received signal number is %d\0A\00"
define void @signalhandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [30 x i8] c"received signal number is %d\0A\00"
define void @signalhandler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
struct aiocb64 {
  int dummy;
};
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
ssize_t aio_return64(struct aiocb64 *cb) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<aio_return64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aio_return64>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.aiocb64 = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @aio_return64(%struct.aiocb64* %0) {
%2 = alloca %struct.aiocb64*
store %struct.aiocb64* %0, %struct.aiocb64** %2
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.aiocb64 = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @aio_return64(%struct.aiocb64* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int random();
float randRange(float min, float max) {
  float scale = max - min;
  return min + (float)(random() % 1000001) / 1000000.0f * scale;
}


x86 assembly (clang, -O0):
<randRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
movss  -0x10(%rbp),%xmm1
mov    $0xf4241,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movss  0xea5(%rip),%xmm2
divss  %xmm2,%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randRange>:
push   %rax
movss  %xmm0,0x4(%rsp)
subss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
xor    %eax,%eax
call   1030 <random@plt>
cltq
imul   $0x431bda1d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
imul   $0xf4241,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0xeac(%rip),%xmm0
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @randRange(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %4
%7 = load float, float* %3
%8 = fsub float %6, %7
store float %8, float* %5
%9 = load float, float* %3
%10 = call i32 (...) @random()
%11 = srem i32 %10, 1000001
%12 = sitofp i32 %11 to float
%13 = fdiv float %12, 1.000000e+06
%14 = load float, float* %5
%15 = call float @llvm.fmuladd.f32(float %13, float %14, float %9)
ret float %15
}

LLVM IR (-O2):
define float @randRange(float %0, float %1) {
%3 = fsub float %1, %0
%4 = tail call i32 (...) @random()
%5 = srem i32 %4, 1000001
%6 = sitofp i32 %5 to float
%7 = fdiv float %6, 1.000000e+06
%8 = tail call float @llvm.fmuladd.f32(float %7, float %3, float %0)
ret float %8
}
/* Variables and functions */
int /*<<< orphan*/ gpu_send_control_gp1(int);
void gpu_crtc_range(int x1, int y1, int w, int h) {
  gpu_send_control_gp1(0x06000000 | (x1 & 0xFFF) | (((x1 + w) & 0xFFF) << 12));
  gpu_send_control_gp1(0x07000000 | (y1 & 0x3FF) | (((y1 + h) & 0x3FF) << 10));
}


x86 assembly (clang, -O0):
<gpu_crtc_range>:
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
and    $0xfff,%edi
or     $0x6000000,%edi
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
and    $0xfff,%eax
shl    $0xc,%eax
or     %eax,%edi
call   1030 <gpu_send_control_gp1@plt>
mov    -0x8(%rbp),%edi
and    $0x3ff,%edi
or     $0x7000000,%edi
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
and    $0x3ff,%eax
shl    $0xa,%eax
or     %eax,%edi
call   1030 <gpu_send_control_gp1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpu_crtc_range>:
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %esi,%r14d
add    %edi,%edx
and    $0xfff,%edi
shl    $0xc,%edx
and    $0xfff000,%edx
add    %edx,%edi
add    $0x6000000,%edi
call   1030 <gpu_send_control_gp1@plt>
add    %r14d,%ebx
and    $0x3ff,%r14d
shl    $0xa,%ebx
and    $0xffc00,%ebx
lea    (%r14,%rbx,1),%edi
add    $0x7000000,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <gpu_send_control_gp1@plt>

LLVM IR (-O0):
define void @gpu_crtc_range(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 = and i32 %9, 4095
%11 = or i32 100663296, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = add nsw i32 %12, %13
%15 = and i32 %14, 4095
%16 = shl i32 %15, 12
%17 = or i32 %11, %16
%18 = call i32 @gpu_send_control_gp1(i32 %17)
%19 = load i32, i32* %6
%20 = and i32 %19, 1023
%21 = or i32 117440512, %20
%22 = load i32, i32* %6
%23 = load i32, i32* %8
%24 = add nsw i32 %22, %23
%25 = and i32 %24, 1023
%26 = shl i32 %25, 10
%27 = or i32 %21, %26
%28 = call i32 @gpu_send_control_gp1(i32 %27)
ret void
}

LLVM IR (-O2):
define void @gpu_crtc_range(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %0, 4095
%6 = add nsw i32 %2, %0
%7 = shl i32 %6, 12
%8 = and i32 %7, 16773120
%9 = or i32 %5, %8
%10 = or i32 %9, 100663296
%11 = tail call i32 @gpu_send_control_gp1(i32 %10)
%12 = and i32 %1, 1023
%13 = add nsw i32 %3, %1
%14 = shl i32 %13, 10
%15 = and i32 %14, 1047552
%16 = or i32 %12, %15
%17 = or i32 %16, 117440512
%18 = tail call i32 @gpu_send_control_gp1(i32 %17)
ret void
}
/* Type definitions */
struct shell_data {
  int dummy;
};

/* Variables and functions */
int shellGetInteger(struct shell_data *, int *);
int shellGetUnsignedInteger(struct shell_data *sd, unsigned int *result) {
  return shellGetInteger(sd, (int *)result);
}


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

x86 assembly (clang, -O2):
<shellGetUnsignedInteger>:
jmp    1030 <shellGetInteger@plt>

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

LLVM IR (-O2):
%struct.shell_data = type { i32 }
define i32 @shellGetUnsignedInteger(%struct.shell_data* %0, i32* %1) {
%3 = tail call i32 @shellGetInteger(%struct.shell_data* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int type;
  while (1) {
    scanf("%d", &type);
    if (type == 0) {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    113e <main+0x2e>
jmp    1143 <main+0x33>
jmp    111f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
lea    0x4(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() {
  printf("sleep - sleeps for n time units, where they may be a suffix 's'"
         "for seconds, 'm' for minutes, 'h' for hours and 'd' for days\n");
  printf("The default time unit is seconds.\n");
}


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

x86 assembly (clang, -O2):
<print_help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf58(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [125 x i8] c"sleep - sleeps for n time units, where they may be a suffix 's'for seconds, 'm' for minutes, 'h' for hours and 'd' for days\0A\00"
@.str.1 = [35 x i8] c"The default time unit is seconds.\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [124 x i8] c"sleep - sleeps for n time units, where they may be a suffix 's'for seconds, 'm' for minutes, 'h' for hours and 'd' for days\00"
@str.2 = [34 x i8] c"The default time unit is seconds.\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([124 x i8], [124 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ scanf(char *, char *);
void readline(char *input) {
  scanf("%[^\n]", input);
  getchar();
}


x86 assembly (clang, -O0):
<readline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <scanf@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readline>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <scanf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <getchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%[^\0A]\00"
define void @readline(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%[^\0A]\00"
define void @readline(i8* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @getchar()
ret void
}
/* Type definitions */
typedef scalar_t__ uid_t;

/* Variables and functions */
int /*<<< orphan*/ EPERM;
int /*<<< orphan*/ errno;
scalar_t__ getuid();
int setuid(uid_t uid) {
  if (uid == getuid())
    return 0;
  errno = EPERM;
  return -1;
}


x86 assembly (clang, -O0):
<setuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jne    1147 <setuid+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1160 <setuid+0x50>
mov    0x2e82(%rip),%rax
mov    (%rax),%ecx
mov    0x2e89(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setuid>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getuid@plt>
cmp    %r14,%rax
je     113c <setuid+0x2c>
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
mov    0x2eab(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EPERM = global i32 0
@errno = global i32 0
define i32 @setuid(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = call i64 (...) @getuid()
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %10
8: ; preds = %1
%9 = load i32, i32* @EPERM
store i32 %9, i32* @errno
store i32 -1, i32* %2
br label %10
10: ; preds = %8, %7
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@EPERM = global i32 0
@errno = global i32 0
define i32 @setuid(i64 %0) {
%2 = tail call i64 (...) @getuid()
%3 = icmp eq i64 %2, %0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = load i32, i32* @EPERM
store i32 %5, i32* @errno
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: tstat aname path1 path2\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Usage: tstat aname path1 path2\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Usage: tstat aname path1 path2\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
f(x) {
  x &= 010000;
  x &= 007777;
  x ^= 017777;
  x &= 017770;
  return x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x1fff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1ff8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 4096
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, 4095
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = xor i32 %7, 8191
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = and i32 %9, 8184
store i32 %10, i32* %2
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 8184
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0xed() {
  Assert_real((isalnum(237) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalnum.c",
              1190, ("isalnum should be 0 for 0xed"));
}


x86 assembly (clang, -O0):
<t_isalnum_0xed>:
push   %rbp
mov    %rsp,%rbp
mov    $0xed,%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4a6,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalnum_0xed>:
push   %rax
mov    $0xed,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4a6,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xed\00"
define void @t_isalnum_0xed() {
%1 = call i64 @isalnum(i32 237)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1190, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xed\00"
define void @t_isalnum_0xed() {
%1 = tail call i64 @isalnum(i32 237)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1190, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}