xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ strlen(char *);
int sum_length(int argc, char **argv) {
  int sum = 0, i;
  for (i = 0; i < argc; ++i)
    sum += strlen(argv[i]);
  return sum;
}


x86 assembly (clang, -O0):
<sum_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1165 <sum_length+0x55>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112d <sum_length+0x1d>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_length>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1146 <sum_length+0x36>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <strlen@plt>
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <sum_length+0x20>
jmp    1148 <sum_length+0x38>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @sum_length(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %14, %6 ]
%8 = phi i32 [ 0, %4 ], [ %13, %6 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i64 @strlen(i8* dereferenceable(1) %10)
%12 = trunc i64 %11 to i32
%13 = add i32 %8, %12
%14 = add nuw nsw i64 %7, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %16, label %6
16: ; preds = %6, %2
%17 = phi i32 [ 0, %2 ], [ %13, %6 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
void colorStr(char *str, char *color) {
  fprintf(stderr, "%s%s%s", color, str, "\033[0m");
}


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

x86 assembly (clang, -O2):
<colorStr>:
mov    %rsi,%rdx
mov    %rdi,%rcx
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
lea    0xeda(%rip),%rsi
lea    0xeda(%rip),%r8
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [5 x i8] c"\1B[0m\00"
define void @colorStr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [5 x i8] c"\1B[0m\00"
define void @colorStr(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct dirent {
  char *d_name;
};

/* Variables and functions */
int no_dots(const struct dirent *d) {
  if (d->d_name[0] == '.')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<no_dots>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1127 <no_dots+0x27>
movl   $0x0,-0x4(%rbp)
jmp    112e <no_dots+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_dots>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmpb   $0x2e,(%rcx)
setne  %al
ret

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

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @no_dots(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 46
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int port_byte_in(int);
int /*<<< orphan*/ port_byte_out(int, int);
int get_cursor_offset() {
  int cursor_loc = 0;
  port_byte_out(0x3D4, 14);
  cursor_loc = port_byte_in(0x3D5) << 8;
  port_byte_out(0x3D4, 15);
  cursor_loc += port_byte_in(0x3D5);
  return cursor_loc;
}


x86 assembly (clang, -O0):
<get_cursor_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <port_byte_out@plt>
mov    $0x3d5,%edi
call   1040 <port_byte_in@plt>
shl    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <port_byte_out@plt>
mov    $0x3d5,%edi
call   1040 <port_byte_in@plt>
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cursor_offset>:
push   %rbx
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <port_byte_out@plt>
mov    $0x3d5,%edi
call   1040 <port_byte_in@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <port_byte_out@plt>
mov    $0x3d5,%edi
call   1040 <port_byte_in@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_cursor_offset() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @port_byte_out(i32 980, i32 14)
%3 = call i32 @port_byte_in(i32 981)
%4 = shl i32 %3, 8
store i32 %4, i32* %1
%5 = call i32 @port_byte_out(i32 980, i32 15)
%6 = call i32 @port_byte_in(i32 981)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, %6
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_cursor_offset() {
%1 = tail call i32 @port_byte_out(i32 980, i32 14)
%2 = tail call i32 @port_byte_in(i32 981)
%3 = shl i32 %2, 8
%4 = tail call i32 @port_byte_out(i32 980, i32 15)
%5 = tail call i32 @port_byte_in(i32 981)
%6 = add nsw i32 %5, %3
ret i32 %6
}
unsigned long http_parser_version(void) {
  return 2 * 0x10000 | 6 * 0x00100 | 0 * 0x00001;
}


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

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

LLVM IR (-O0):
define i64 @http_parser_version() {
ret i64 132608
}

LLVM IR (-O2):
define i64 @http_parser_version() {
ret i64 132608
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void ADCSequenceEnable(uint32_t ui32Base, uint32_t ui32SequenceNum) {
  ;
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) |= 1 << ui32SequenceNum;
}


x86 assembly (clang, -O0):
<ADCSequenceEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCSequenceEnable>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %edi,%rcx
or     %eax,(%rcx)
ret

LLVM IR (-O0):
define void @ADCSequenceEnable(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 0
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = or i32 %11, %6
store volatile i32 %12, i32* %10
ret void
}

LLVM IR (-O2):
define void @ADCSequenceEnable(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = sext i32 %0 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = or i32 %6, %3
store volatile i32 %7, i32* %5
ret void
}
void foo3(int *a, int *b) {
  for (; a < b; a++)
    ;
}


x86 assembly (clang, -O0):
<foo3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1130 <foo3+0x30>
jmp    111f <foo3+0x1f>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <foo3+0xc>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo3(i32* nocapture %0, i32* nocapture %1) {
ret void
}
int swap_4byte(word4)
int word4;
{
  union {
    unsigned char character[4];
    long integer;
  } swap4byte;
  char temp0;
  char temp1;
  swap4byte.integer = word4;
  temp0 = swap4byte.character[0];
  temp1 = swap4byte.character[1];
  swap4byte.character[0] = swap4byte.character[2];
  swap4byte.character[1] = swap4byte.character[3];
  swap4byte.character[2] = temp0;
  swap4byte.character[3] = temp1;
  return (swap4byte.integer);
}


x86 assembly (clang, -O0):
<swap_4byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0xf(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0xe(%rbp),%al
mov    %al,-0x10(%rbp)
mov    -0xd(%rbp),%al
mov    %al,-0xf(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0xe(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0xd(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_4byte>:
mov    %edi,%eax
rol    $0x10,%edi
shr    $0x10,%eax
and    $0xffffff00,%edi
movzbl %al,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
%union.anon = type { i64 }
define i32 @swap_4byte(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
%4 = alloca i8
%5 = alloca i8
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = bitcast %union.anon* %3 to i64*
store i64 %7, i64* %8
%9 = bitcast %union.anon* %3 to [4 x i8]*
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%11 = load i8, i8* %10
store i8 %11, i8* %4
%12 = bitcast %union.anon* %3 to [4 x i8]*
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
%14 = load i8, i8* %13
store i8 %14, i8* %5
%15 = bitcast %union.anon* %3 to [4 x i8]*
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 2
%17 = load i8, i8* %16
%18 = bitcast %union.anon* %3 to [4 x i8]*
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %18, i64 0, i64 0
store i8 %17, i8* %19
%20 = bitcast %union.anon* %3 to [4 x i8]*
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %20, i64 0, i64 3
%22 = load i8, i8* %21
%23 = bitcast %union.anon* %3 to [4 x i8]*
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %23, i64 0, i64 1
store i8 %22, i8* %24
%25 = load i8, i8* %4
%26 = bitcast %union.anon* %3 to [4 x i8]*
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %26, i64 0, i64 2
store i8 %25, i8* %27
%28 = load i8, i8* %5
%29 = bitcast %union.anon* %3 to [4 x i8]*
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %29, i64 0, i64 3
store i8 %28, i8* %30
%31 = bitcast %union.anon* %3 to i64*
%32 = load i64, i64* %31
%33 = trunc i64 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
define i32 @swap_4byte(i32 %0) {
%2 = lshr i32 %0, 16
%3 = shl i32 %0, 16
%4 = and i32 %2, 65280
%5 = or i32 %4, %3
%6 = and i32 %2, 255
%7 = or i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int do_test(void) {
  fprintf(stdout, "hello\n");
  return 0;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"hello\0A\00"
define i32 @do_test() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int call(int, int);
int call2(int fun, int arg1, int arg2) { return call(call(fun, arg2), arg1); }


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

x86 assembly (clang, -O2):
<call2>:
push   %rbx
mov    %esi,%ebx
mov    %edx,%esi
call   1030 <call@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <call@plt>

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

LLVM IR (-O2):
define i32 @call2(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @call(i32 %0, i32 %2)
%5 = tail call i32 @call(i32 %4, i32 %1)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
int /*<<< orphan*/ msdiff(struct timeval *, struct timeval *);
uint64_t current_ms(struct timeval *tvbase) {
  struct timeval tvnow;
  (void)gettimeofday(&tvnow, 0);
  return (msdiff(&tvnow, tvbase));
}


x86 assembly (clang, -O0):
<current_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1030 <msdiff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_ms>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <msdiff@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @current_ms(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
%3 = alloca %struct.timeval
store %struct.timeval* %0, %struct.timeval** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32 0)
%5 = load %struct.timeval*, %struct.timeval** %2
%6 = call i32 @msdiff(%struct.timeval* %3, %struct.timeval* %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @current_ms(%struct.timeval* %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32 0)
%5 = call i32 @msdiff(%struct.timeval* %2, %struct.timeval* %0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ beep();
void term_beep(void) { beep(); }


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

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

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

LLVM IR (-O2):
define void @term_beep() {
%1 = tail call i32 (...) @beep()
ret void
}
void __DELETE_java_nio_charset_spi_CharsetProvider(void *me,
                                                   void *client_data) {}


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

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

LLVM IR (-O0):
define void @__DELETE_java_nio_charset_spi_CharsetProvider(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @__DELETE_java_nio_charset_spi_CharsetProvider(i8* nocapture %0, i8* nocapture %1) {
ret void
}
int compare_ints(const void *a, const void *b) {
  int int_a = *(int *)a;
  int int_b = *(int *)b;
  if (int_a < int_b) {
    return -1;
  } else if (int_a == int_b) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<compare_ints>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <compare_ints+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <compare_ints+0x5a>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    114e <compare_ints+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    115a <compare_ints+0x5a>
jmp    1153 <compare_ints+0x53>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_ints>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_ints(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ INR_MDIO_read_b(int /*<<< orphan*/ *);
int /*<<< orphan*/ INR_MDIO_write_b(int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/, int /*<<< orphan*/);
uint16_t INR_MDIO_read(uint8_t PHY_addr, uint8_t REG_addr) {
  uint16_t data;
  INR_MDIO_write_b(0, PHY_addr, REG_addr, 0);
  INR_MDIO_read_b(&data);
  return data;
}


x86 assembly (clang, -O0):
<INR_MDIO_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
xor    %ecx,%ecx
mov    %ecx,%edi
call   1030 <INR_MDIO_write_b@plt>
lea    -0xc(%rbp),%rdi
call   1040 <INR_MDIO_read_b@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<INR_MDIO_read>:
push   %rax
mov    %esi,%edx
mov    %edi,%esi
xor    %edi,%edi
xor    %ecx,%ecx
call   1030 <INR_MDIO_write_b@plt>
lea    0x4(%rsp),%rdi
call   1040 <INR_MDIO_read_b@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @INR_MDIO_read(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 = call i32 @INR_MDIO_write_b(i32 0, i32 %6, i32 %7, i32 0)
%9 = call i32 @INR_MDIO_read_b(i32* %5)
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @INR_MDIO_read(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @INR_MDIO_write_b(i32 0, i32 %0, i32 %1, i32 0)
%6 = call i32 @INR_MDIO_read_b(i32* %3)
%7 = load i32, i32* %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ _delay_us(int);
void tayus(unsigned int tt) {
  switch (tt) {
  case 142:
    _delay_us(142 - 2);
    return;
  case 167:
    _delay_us(167 - 3);
    return;
  case 200:
    _delay_us(200 - 4);
    return;
  }
}


x86 assembly (clang, -O0):
<tayus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x8e,%eax
je     1157 <tayus+0x47>
jmp    1131 <tayus+0x21>
mov    -0x8(%rbp),%eax
sub    $0xa7,%eax
je     1166 <tayus+0x56>
jmp    1144 <tayus+0x34>
mov    -0x8(%rbp),%eax
sub    $0xc8,%eax
je     1175 <tayus+0x65>
jmp    117f <tayus+0x6f>
mov    $0x8c,%edi
call   1030 <_delay_us@plt>
jmp    117f <tayus+0x6f>
mov    $0xa4,%edi
call   1030 <_delay_us@plt>
jmp    117f <tayus+0x6f>
mov    $0xc4,%edi
call   1030 <_delay_us@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tayus>:
cmp    $0x8e,%edi
je     1132 <tayus+0x22>
cmp    $0xc8,%edi
je     113c <tayus+0x2c>
cmp    $0xa7,%edi
jne    1146 <tayus+0x36>
mov    $0xa4,%edi
jmp    1030 <_delay_us@plt>
mov    $0x8c,%edi
jmp    1030 <_delay_us@plt>
mov    $0xc4,%edi
jmp    1030 <_delay_us@plt>
ret

LLVM IR (-O0):
define void @tayus(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 142, label %4
i32 167, label %6
i32 200, label %8
]
4: ; preds = %1
%5 = call i32 @_delay_us(i32 140)
br label %10
6: ; preds = %1
%7 = call i32 @_delay_us(i32 164)
br label %10
8: ; preds = %1
%9 = call i32 @_delay_us(i32 196)
br label %10
10: ; preds = %4, %6, %8, %1
ret void
}

LLVM IR (-O2):
define void @tayus(i32 %0) {
switch i32 %0, label %7 [
i32 142, label %4
i32 167, label %2
i32 200, label %3
]
2: ; preds = %1
br label %4
3: ; preds = %1
br label %4
4: ; preds = %1, %3, %2
%5 = phi i32 [ 164, %2 ], [ 196, %3 ], [ 140, %1 ]
%6 = tail call i32 @_delay_us(i32 %5)
br label %7
7: ; preds = %4, %1
ret void
}
/* Variables and functions */
char *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ path_max(char const *);
char *alloc_path(const char *dirpath) { return malloc(path_max(dirpath)); }


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

x86 assembly (clang, -O2):
<alloc_path>:
push   %rax
call   1030 <path_max@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @alloc_path(i8* %0) {
%2 = tail call i32 @path_max(i8* %0)
%3 = tail call i8* @malloc(i32 %2)
ret i8* %3
}
/* Variables and functions */
void *realloc(void *, size_t);
int /*<<< orphan*/ safeExitErr(char *);
void *safeRealloc(void *ptr, size_t size) {
  void *mem = realloc(ptr, size);
  if (size && !mem)
    safeExitErr("Not enough memory");
  return mem;
}


x86 assembly (clang, -O0):
<safeRealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1163 <safeRealloc+0x43>
cmpq   $0x0,-0x18(%rbp)
jne    1163 <safeRealloc+0x43>
lea    0xea2(%rip),%rdi
call   1030 <safeExitErr@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safeRealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1145 <safeRealloc+0x25>
test   %r14,%r14
jne    1145 <safeRealloc+0x25>
lea    0xec0(%rip),%rdi
call   1030 <safeExitErr@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Not enough memory\00"
define i8* @safeRealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i64, i64* %4
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @safeExitErr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %11, %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@.str = [18 x i8] c"Not enough memory\00"
define noalias i8* @safeRealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i64 %1, 0
%5 = icmp ne i8* %3, null
%6 = or i1 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @safeExitErr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
ret i8* %3
}
void _ZTVN5javax8security4auth5login12LoginContextE(void) {}


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

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

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

LLVM IR (-O2):
define void @_ZTVN5javax8security4auth5login12LoginContextE() {
ret void
}
void write_le_int16(struct _IO_FILE$link44 *dfile, signed int num) {
  fputc(num & 255, dfile);
  fputc(num >> 8 & 255, dfile);
}


x86 assembly (clang, -O0):
<write_le_int16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <fputc@plt>
mov    -0xc(%rbp),%edi
sar    $0x8,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_le_int16>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzbl %bl,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fputc@plt>
movzbl %bh,%edi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
%"struct._IO_FILE$link44" = type opaque
define void @write_le_int16(%"struct._IO_FILE$link44"* %0, i32 %1) {
%3 = alloca %"struct._IO_FILE$link44"*
%4 = alloca i32
store %"struct._IO_FILE$link44"* %0, %"struct._IO_FILE$link44"** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 255
%7 = load %"struct._IO_FILE$link44"*, %"struct._IO_FILE$link44"** %3
%8 = call i32 (i32, %"struct._IO_FILE$link44"*, ...) bitcast (i32 (...)* @fputc to i32 (i32, %"struct._IO_FILE$link44"*, ...)*)(i32 %6, %"struct._IO_FILE$link44"* %7)
%9 = load i32, i32* %4
%10 = ashr i32 %9, 8
%11 = and i32 %10, 255
%12 = load %"struct._IO_FILE$link44"*, %"struct._IO_FILE$link44"** %3
%13 = call i32 (i32, %"struct._IO_FILE$link44"*, ...) bitcast (i32 (...)* @fputc to i32 (i32, %"struct._IO_FILE$link44"*, ...)*)(i32 %11, %"struct._IO_FILE$link44"* %12)
ret void
}

LLVM IR (-O2):
%"struct._IO_FILE$link44" = type opaque
define void @write_le_int16(%"struct._IO_FILE$link44"* %0, i32 %1) {
%3 = and i32 %1, 255
%4 = tail call i32 (i32, %"struct._IO_FILE$link44"*, ...) bitcast (i32 (...)* @fputc to i32 (i32, %"struct._IO_FILE$link44"*, ...)*)(i32 %3, %"struct._IO_FILE$link44"* %0)
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = tail call i32 (i32, %"struct._IO_FILE$link44"*, ...) bitcast (i32 (...)* @fputc to i32 (i32, %"struct._IO_FILE$link44"*, ...)*)(i32 %6, %"struct._IO_FILE$link44"* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ result;

/* Variables and functions */
int /*<<< orphan*/ read_exact_bytes(long *, int);
long get_long() {
  long result = -1;
  read_exact_bytes(&result, sizeof(result));
  return result;
}


x86 assembly (clang, -O0):
<get_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
lea    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <read_exact_bytes@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_long>:
push   %rax
movq   $0xffffffffffffffff,(%rsp)
ff
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <read_exact_bytes@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @get_long() {
%1 = alloca i64
store i64 -1, i64* %1
%2 = call i32 @read_exact_bytes(i64* %1, i32 8)
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @get_long() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 -1, i64* %1
%3 = call i32 @read_exact_bytes(i64* %1, i32 8)
%4 = load i64, i64* %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ hoic_sw(int, int);
int hdoip_cli_loop(int fd, int fdr, char **argv, int argc) {
  hoic_sw(fd, (0x31000004));
  return 0;
}


x86 assembly (clang, -O0):
<hdoip_cli_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x31000004,%esi
call   1030 <hoic_sw@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdoip_cli_loop>:
push   %rax
mov    $0x31000004,%esi
call   1030 <hoic_sw@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hdoip_cli_loop(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = call i32 @hoic_sw(i32 %9, i32 822083588)
ret i32 0
}

LLVM IR (-O2):
define i32 @hdoip_cli_loop(i32 %0, i32 %1, i8** nocapture readnone %2, i32 %3) {
%5 = tail call i32 @hoic_sw(i32 %0, i32 822083588)
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t roundup64(uint64_t x) {
  return (--x, x |= x >> 1, x |= x >> 2, x |= x >> 4, x |= x >> 8, x |= x >> 16,
          x |= x >> 32, ++x);
}


x86 assembly (clang, -O0):
<roundup64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @roundup64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = ashr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = ashr i32 %25, 32
%27 = load i32, i32* %2
%28 = or i32 %27, %26
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @roundup64(i32 %0) {
ret i32 poison
}
void g_byte_array_free() {}


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

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

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

LLVM IR (-O2):
define void @g_byte_array_free() {
ret void
}
int side_corner(int side) {
  switch (side) {
  case 1:
    return (0);
  case 2:
    return (6);
  case 3:
    return (8);
  case 4:
    return (2);
  }
}


x86 assembly (clang, -O0):
<side_corner>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     115b <side_corner+0x5b>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    115b <side_corner+0x5b>
movl   $0x6,-0x4(%rbp)
jmp    115b <side_corner+0x5b>
movl   $0x8,-0x4(%rbp)
jmp    115b <side_corner+0x5b>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<side_corner>:
add    $0xfffffffe,%edi
xor    %eax,%eax
cmp    $0x2,%edi
ja     1117 <side_corner+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table.side_corner = [3 x i32] [i32 6, i32 8, i32 2]
define i32 @side_corner(i32 %0) {
%2 = add i32 %0, -2
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.side_corner, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void end_window(void) { endwin(); }


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

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

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

LLVM IR (-O2):
define void @end_window() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ panic4();
int /*<<< orphan*/ puts(char *);
void __data_abort() {
  puts("[ FAIL ]");
  puts("Data Abort Exception\r\n");
  panic4();
}


x86 assembly (clang, -O0):
<__data_abort>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <panic4@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__data_abort>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <panic4@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"[ FAIL ]\00"
@.str.1 = [23 x i8] c"Data Abort Exception\0D\0A\00"
define void @__data_abort() {
%1 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @panic4()
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"[ FAIL ]\00"
@.str.1 = [23 x i8] c"Data Abort Exception\0D\0A\00"
define void @__data_abort() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @panic4()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int main() {
  FILE *readableFile = fopen("this file should not exist", "r");
  if (readableFile == NULL) {
    printf("error opening file!\n");
    exit(0);
  } else {
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xece(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1174 <main+0x44>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
jne    115c <main+0x2c>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"this file should not exist\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"error opening file!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([27 x i8], [27 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 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %0
%10 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"this file should not exist\00"
@.str.1 = [2 x i8] c"r\00"
@str = [20 x i8] c"error opening file!\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([27 x i8], [27 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %0
%7 = tail call i32 @exit(i32 -1)
unreachable
}
int p_IsWhiteSpace(char cValue) {
  return ((cValue == ' ') || (cValue == '\t') || (cValue == 0) ||
          (cValue == '\r') || (cValue == '\n'));
}


x86 assembly (clang, -O0):
<p_IsWhiteSpace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     115f <p_IsWhiteSpace+0x5f>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2(%rbp)
je     115f <p_IsWhiteSpace+0x5f>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
je     115f <p_IsWhiteSpace+0x5f>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x2(%rbp)
je     115f <p_IsWhiteSpace+0x5f>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_IsWhiteSpace>:
cmp    $0x20,%dil
ja     1120 <p_IsWhiteSpace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100002201,%rdx
bt     %rcx,%rdx
jae    1120 <p_IsWhiteSpace+0x20>
ret
xor    %eax,%eax
cmp    $0xa,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @p_IsWhiteSpace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %22, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 9
br i1 %9, label %22, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %22, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 13
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 10
br label %22
22: ; preds = %18, %14, %10, %6, %1
%23 = phi i1 [ true, %14 ], [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %21, %18 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @p_IsWhiteSpace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 13, label %5
i8 9, label %5
i8 0, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 10
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ assert(int);
scalar_t__ open(char *, int /*<<< orphan*/);
void testassert() { assert(open("/tmp/noexist", O_RDONLY) >= 0); }


x86 assembly (clang, -O0):
<testassert>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1040 <open@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testassert>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <open@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
mov    %eax,%edi
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"/tmp/noexist\00"
@O_RDONLY = global i32 0
define void @testassert() {
%1 = load i32, i32* @O_RDONLY
%2 = call i64 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp sge i64 %2, 0
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"/tmp/noexist\00"
@O_RDONLY = global i32 0
define void @testassert() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i64 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = lshr i64 %2, 63
%4 = trunc i64 %3 to i32
%5 = xor i32 %4, 1
%6 = tail call i32 @assert(i32 %5)
ret void
}
unsigned xrop3_106_1_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;
  stk2 = T & S;
  stk1 = D ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_106_1_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    -0x10(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @xrop3_106_1_0(i8 zeroext %0, i8 zeroext %1) {
ret i32 255
}
/* Variables and functions */
int getuid();
int /*<<< orphan*/ printf(char *, int);
main() { printf("Identificador de usuario: %d\n", getuid()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [30 x i8] c"Identificador de usuario: %d\0A\00"
define i32 @main() {
%1 = call i32 (...) @getuid()
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Identificador de usuario: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getuid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int do_328() { return 328; }


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

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

LLVM IR (-O0):
define i32 @do_328() {
ret i32 328
}

LLVM IR (-O2):
define i32 @do_328() {
ret i32 328
}