xunge/DecIR huggingface dataset:
int assertion_cmp_ptr(const void *lhs, const void *rhs) {
  if (lhs == rhs) {
    return 0;
  } else if (lhs < rhs) {
    return -1;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<assertion_cmp_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <assertion_cmp_ptr+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1147 <assertion_cmp_ptr+0x47>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1140 <assertion_cmp_ptr+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1147 <assertion_cmp_ptr+0x47>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assertion_cmp_ptr>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %rsi,%rdi
setae  %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @assertion_cmp_ptr(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = icmp ult i8* %0, %1
%5 = select i1 %4, i32 -1, i32 1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Variables and functions */
int INT_MIN;
int test5(int x) { return (x - INT_MIN) ^ 0x1234; }


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ed7(%rip),%rcx
sub    (%rcx),%eax
xor    $0x1234,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
mov    %edi,%eax
mov    0x2edf(%rip),%rcx
sub    (%rcx),%eax
xor    $0x1234,%eax
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @test5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @INT_MIN
%5 = sub nsw i32 %3, %4
%6 = xor i32 %5, 4660
ret i32 %6
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @test5(i32 %0) {
%2 = load i32, i32* @INT_MIN
%3 = sub nsw i32 %0, %2
%4 = xor i32 %3, 4660
ret i32 %4
}
int _on_stepped(struct mb_interpreter_t *s, void **l, const char *f, int p,
                unsigned short row, unsigned short col) {
  ((void)(s));
  ((void)(l));
  ((void)(f));
  ((void)(p));
  ((void)(row));
  ((void)(col));
  return 0;
}


x86 assembly (clang, -O0):
<_on_stepped>:
push   %rbp
mov    %rsp,%rbp
mov    %r8d,-0x38(%rbp)
mov    %ecx,%eax
mov    -0x38(%rbp),%ecx
mov    %eax,-0x34(%rbp)
mov    %rdx,%rax
mov    -0x34(%rbp),%edx
mov    %rax,-0x30(%rbp)
mov    %rsi,%rax
mov    -0x30(%rbp),%rsi
mov    %rax,-0x28(%rbp)
mov    %rdi,%r8
mov    -0x28(%rbp),%rdi
mov    %r9w,%ax
mov    %r8,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %cx,-0x1e(%rbp)
mov    %ax,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mb_interpreter_t = type opaque
define i32 @_on_stepped(%struct.mb_interpreter_t* %0, i8** %1, i8* %2, i32 %3, i16 zeroext %4, i16 zeroext %5) {
%7 = alloca %struct.mb_interpreter_t*
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i16
%12 = alloca i16
store %struct.mb_interpreter_t* %0, %struct.mb_interpreter_t** %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i16 %4, i16* %11
store i16 %5, i16* %12
%13 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %7
%14 = load i8**, i8*** %8
%15 = load i8*, i8** %9
%16 = load i32, i32* %10
%17 = load i16, i16* %11
%18 = load i16, i16* %12
ret i32 0
}

LLVM IR (-O2):
%struct.mb_interpreter_t = type opaque
define i32 @_on_stepped(%struct.mb_interpreter_t* nocapture readnone %0, i8** nocapture readnone %1, i8* nocapture readnone %2, i32 %3, i16 zeroext %4, i16 zeroext %5) {
ret i32 0
}
int max_func2(int a, int b, int c) {
  return (((((((a) > (b)) ? (a) : (b)))) > ((c)))
              ? (((((a) > (b)) ? (a) : (b))))
              : ((c)));
}


x86 assembly (clang, -O0):
<max_func2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1124 <max_func2+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112a <max_func2+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    115e <max_func2+0x5e>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    114d <max_func2+0x4d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <max_func2+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <max_func2+0x64>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_func2>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
cmp    %edx,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @max_func2(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = select i1 %4, i32 %0, i32 %1
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %5, i32 %2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, int /*<<< orphan*/ *);
void init_user_section() { write("json-task.json", "\"user\": [\n", NULL); }


x86 assembly (clang, -O0):
<init_user_section>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_user_section>:
lea    0xee9(%rip),%rdi
lea    0xef1(%rip),%rsi
xor    %edx,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"json-task.json\00"
@.str.1 = [11 x i8] c"\22user\22: [\0A\00"
define void @init_user_section() {
%1 = call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"json-task.json\00"
@.str.1 = [11 x i8] c"\22user\22: [\0A\00"
define void @init_user_section() {
%1 = tail call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int main(int argc, const char *argv[]) {
  foo();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @foo()
ret i32 0
}
int set(struct node *head, int index, int value) { return 1; }


x86 assembly (clang, -O0):
<set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.node = type opaque
define i32 @set(%struct.node* %0, i32 %1, i32 %2) {
%4 = alloca %struct.node*
%5 = alloca i32
%6 = alloca i32
store %struct.node* %0, %struct.node** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i32 1
}

LLVM IR (-O2):
%struct.node = type opaque
define i32 @set(%struct.node* nocapture readnone %0, i32 %1, i32 %2) {
ret i32 1
}
void parse_args() { ; }


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

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

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

LLVM IR (-O2):
define void @parse_args() {
ret void
}
void SteamController_SetOverrideMode(const char *pchMode) {
  xlogf("%s(pchMode = %s)\n", __func__, pchMode);
}


x86 assembly (clang, -O0):
<SteamController_SetOverrideMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee4(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SteamController_SetOverrideMode>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xef1(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s(pchMode = %s)\0A\00"
@__func__.SteamController_SetOverrideMode = [32 x i8] c"SteamController_SetOverrideMode\00"
define void @SteamController_SetOverrideMode(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @__func__.SteamController_SetOverrideMode, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s(pchMode = %s)\0A\00"
@__func__.SteamController_SetOverrideMode = [32 x i8] c"SteamController_SetOverrideMode\00"
define void @SteamController_SetOverrideMode(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @__func__.SteamController_SetOverrideMode, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void printUsage() {
  printf("Usage : http_srv -d <path> [options]\n\nArguments :\n -d "
         "<path>\tspecifies pages directory path\n -p <port>\tspecifies server "
         "port (default port 80)\n -o <logFile>\tspecifies log file\n "
         "-v\t\tverbose mode\n -V\t\tdisplay programme version\n -h\t\tdisplay "
         "this help\n\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<printUsage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [250 x i8] c"Usage : http_srv -d <path> [options]\0A\0AArguments :\0A -d <path>\09specifies pages directory path\0A -p <port>\09specifies server port (default port 80)\0A -o <logFile>\09specifies log file\0A -v\09\09verbose mode\0A -V\09\09display programme version\0A -h\09\09display this help\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define void @printUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([250 x i8], [250 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [249 x i8] c"Usage : http_srv -d <path> [options]\0A\0AArguments :\0A -d <path>\09specifies pages directory path\0A -p <port>\09specifies server port (default port 80)\0A -o <logFile>\09specifies log file\0A -v\09\09verbose mode\0A -V\09\09display programme version\0A -h\09\09display this help\0A\00"
define void @printUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([249 x i8], [249 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
void av_xiphlacing() {}


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

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

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

LLVM IR (-O2):
define void @av_xiphlacing() {
ret void
}
int srint(double f) { return (short)(f + 0.5); }


x86 assembly (clang, -O0):
<srint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<srint>:
addsd  0xef8(%rip),%xmm0
cvttsd2si %xmm0,%eax
cwtl
ret

LLVM IR (-O0):
define i32 @srint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 5.000000e-01
%5 = fptosi double %4 to i16
%6 = sext i16 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @srint(double %0) {
%2 = fadd double %0, 5.000000e-01
%3 = fptosi double %2 to i16
%4 = sext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ malloc(int);
void *superlu_malloc(int size) {
  void *buf;
  buf = (void *)malloc(size);
  return (buf);
}


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

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

LLVM IR (-O0):
define i8* @superlu_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
define i8* @superlu_malloc(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Variables and functions */
extern void *TakeCArrayToInt8(int array[]) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @TakeCArrayToInt8(i32* nocapture readnone %0) {
ret i8* null
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct sockaddr_in {
  int dummy;
};

/* Variables and functions */
void emit_serverinfo(struct sockaddr_in *addr, uint8_t *info, int len) {}


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

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

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
define void @emit_serverinfo(%struct.sockaddr_in* %0, i32* %1, i32 %2) {
%4 = alloca %struct.sockaddr_in*
%5 = alloca i32*
%6 = alloca i32
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
define void @emit_serverinfo(%struct.sockaddr_in* nocapture %0, i32* nocapture %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, int, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror_r(int, char *, int);
void PANIC(int err, const char *layer, const char *where) {
  char error[512];
  strerror_r(err, error, 512);
  fprintf(stderr,
          "! ! ! GaVer panic [%s] in %s: [errno = %d] %s (EXIT) ! ! !\n", layer,
          where, err, error);
}


x86 assembly (clang, -O0):
<PANIC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x220(%rbp),%rsi
mov    $0x200,%edx
call   1040 <strerror_r@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%r8d
lea    -0x220(%rbp),%r9
lea    0xe93(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PANIC>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%r15
mov    %r15,%rsi
mov    $0x200,%edx
call   1040 <strerror_r@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %r15,%r9
call   1030 <fprintf@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"! ! ! GaVer panic [%s] in %s: [errno = %d] %s (EXIT) ! ! !\0A\00"
define void @PANIC(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [512 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i32, i32* %4
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%10 = call i32 @strerror_r(i32 %8, i8* %9, i32 512)
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = load i32, i32* %4
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%16 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13, i32 %14, i8* %15)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"! ! ! GaVer panic [%s] in %s: [errno = %d] %s (EXIT) ! ! !\0A\00"
define void @PANIC(i32 %0, i8* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @strerror_r(i32 %0, i8* %5, i32 512)
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i32 %0, i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void random_init(void) { srandom(time(NULL)); }


x86 assembly (clang, -O0):
<random_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_init>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srandom@plt>

LLVM IR (-O0):
define void @random_init() {
%1 = call i32 @time(i32* null)
%2 = call i32 @srandom(i32 %1)
ret void
}

LLVM IR (-O2):
define void @random_init() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srandom(i32 %1)
ret void
}
/* Type definitions */
struct fs_file {
  int dummy;
};
typedef int ssize_t;

/* Variables and functions */
ssize_t fs_http_write(struct fs_file *f, const void *buf, size_t count) {
  return -1;
}


x86 assembly (clang, -O0):
<fs_http_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.fs_file = type { i32 }
define i32 @fs_http_write(%struct.fs_file* %0, i8* %1, i64 %2) {
%4 = alloca %struct.fs_file*
%5 = alloca i8*
%6 = alloca i64
store %struct.fs_file* %0, %struct.fs_file** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
ret i32 -1
}

LLVM IR (-O2):
%struct.fs_file = type { i32 }
define i32 @fs_http_write(%struct.fs_file* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
ret i32 -1
}
int main() {
  int a = 1;
  int b = 1;
  while (a) {
    a *= b;
    b += 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113b <main+0x3b>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1119 <main+0x19>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: insertgrid <master grid file> <grid file> <i> <j> [-i "
         "{DD|CO|CE}] [-m] [-v]\n");
  printf("       insertgrid -h\n");
  printf("       insertgrid -v\n");
  printf("Try \"insertgrid -h\" for more information\n");
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1d(%rip),%rdi
call   1030 <printf@plt>
lea    0xf27(%rip),%rdi
call   1030 <printf@plt>
lea    0xf31(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf28(%rip),%rdi
call   1030 <puts@plt>
lea    0xf31(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [84 x i8] c"Usage: insertgrid <master grid file> <grid file> <i> <j> [-i {DD|CO|CE}] [-m] [-v]\0A\00"
@.str.1 = [22 x i8] c" insertgrid -h\0A\00"
@.str.2 = [22 x i8] c" insertgrid -v\0A\00"
@.str.3 = [42 x i8] c"Try \22insertgrid -h\22 for more information\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [83 x i8] c"Usage: insertgrid <master grid file> <grid file> <i> <j> [-i {DD|CO|CE}] [-m] [-v]\00"
@str.4 = [21 x i8] c" insertgrid -h\00"
@str.5 = [21 x i8] c" insertgrid -v\00"
@str.6 = [41 x i8] c"Try \22insertgrid -h\22 for more information\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ count_users();
int /*<<< orphan*/ read_cpu();
int /*<<< orphan*/ read_loadavg();
int /*<<< orphan*/ read_mem();
int /*<<< orphan*/ read_uptime();
int /*<<< orphan*/ read_vmem();
void read_summary(void) {
  read_uptime();
  count_users();
  read_loadavg();
  read_cpu();
  read_mem();
  read_vmem();
}


x86 assembly (clang, -O0):
<read_summary>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <read_uptime@plt>
mov    $0x0,%al
call   1040 <count_users@plt>
mov    $0x0,%al
call   1060 <read_loadavg@plt>
mov    $0x0,%al
call   1030 <read_cpu@plt>
mov    $0x0,%al
call   1070 <read_mem@plt>
mov    $0x0,%al
call   1050 <read_vmem@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_summary>:
push   %rax
xor    %eax,%eax
call   1080 <read_uptime@plt>
xor    %eax,%eax
call   1040 <count_users@plt>
xor    %eax,%eax
call   1060 <read_loadavg@plt>
xor    %eax,%eax
call   1030 <read_cpu@plt>
xor    %eax,%eax
call   1070 <read_mem@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <read_vmem@plt>

LLVM IR (-O0):
define void @read_summary() {
%1 = call i32 (...) @read_uptime()
%2 = call i32 (...) @count_users()
%3 = call i32 (...) @read_loadavg()
%4 = call i32 (...) @read_cpu()
%5 = call i32 (...) @read_mem()
%6 = call i32 (...) @read_vmem()
ret void
}

LLVM IR (-O2):
define void @read_summary() {
%1 = tail call i32 (...) @read_uptime()
%2 = tail call i32 (...) @count_users()
%3 = tail call i32 (...) @read_loadavg()
%4 = tail call i32 (...) @read_cpu()
%5 = tail call i32 (...) @read_mem()
%6 = tail call i32 (...) @read_vmem()
ret void
}
/* Type definitions */
typedef int socklen_t;
typedef int /*<<< orphan*/ accepting;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_ACCEPTCONN;
scalar_t__ getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *,
                      int *);
int socket_listening(int fd) {
  int accepting = 0;
  socklen_t len = sizeof(accepting);
  if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &len) < 0)
    return -1;
  return accepting;
}


x86 assembly (clang, -O0):
<socket_listening>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    0x2eb4(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <getsockopt@plt>
cmp    $0x0,%rax
jge    1161 <socket_listening+0x51>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <socket_listening+0x57>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_listening>:
push   %rax
movl   $0x0,(%rsp)
movl   $0x4,0x4(%rsp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
mov    0x2ec0(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
lea    0x4(%rsp),%r8
call   1030 <getsockopt@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
js     114f <socket_listening+0x3f>
mov    (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_ACCEPTCONN = global i32 0
define i32 @socket_listening(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_ACCEPTCONN
%8 = call i64 @getsockopt(i32 %0, i32 %6, i32 %7, i32* %2, i32* %3)
%9 = icmp slt i64 %8, 0
%10 = load i32, i32* %2
%11 = select i1 %9, i32 -1, i32 %10
ret i32 %11
}
/* Variables and functions */
void eat_ws(char **shand) {
  char *str;
  if (NULL == (str = *shand))
    return;
  while ((*str == ' ') || (*str == '\t'))
    str++;
  *shand = str;
}


x86 assembly (clang, -O0):
<eat_ws>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    1123 <eat_ws+0x23>
jmp    1179 <eat_ws+0x79>
jmp    1128 <eat_ws+0x28>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     114d <eat_ws+0x4d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115d <eat_ws+0x5d>
jmp    116e <eat_ws+0x6e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1128 <eat_ws+0x28>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<eat_ws>:
mov    (%rdi),%rax
test   %rax,%rax
jne    1114 <eat_ws+0x14>
ret
nopl   0x0(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <eat_ws+0x10>
cmp    $0x9,%cl
je     1110 <eat_ws+0x10>
mov    %rax,(%rdi)
ret

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

LLVM IR (-O2):
define void @eat_ws(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1, %7
%5 = phi i8* [ %8, %7 ], [ %2, %1 ]
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 32, label %7
i8 9, label %7
]
7: ; preds = %4, %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
9: ; preds = %4
store i8* %5, i8** %0
br label %10
10: ; preds = %1, %9
ret void
}
int zig_zag_unfix(unsigned int inp) {
  return ((int)(((inp)&1) ? (~((inp) >> 1)) : ((inp) >> 1)));
}


x86 assembly (clang, -O0):
<zig_zag_unfix>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1127 <zig_zag_unfix+0x27>
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <zig_zag_unfix+0x30>
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zig_zag_unfix>:
mov    %edi,%eax
shr    %eax
and    $0x1,%edi
neg    %edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @zig_zag_unfix(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = lshr i32 %7, 1
%9 = xor i32 %8, -1
br label %13
10: ; preds = %1
%11 = load i32, i32* %2
%12 = lshr i32 %11, 1
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ %9, %6 ], [ %12, %10 ]
ret i32 %14
}

LLVM IR (-O2):
define i32 @zig_zag_unfix(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %0, 1
%4 = sub nsw i32 0, %3
%5 = xor i32 %2, %4
ret i32 %5
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double get_time(void) {
  struct timeval tv;
  double d;
  gettimeofday(&tv, NULL);
  d = ((double)tv.tv_usec) / 1000000. + (unsigned long)tv.tv_sec;
  return d;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%esi
lea    -0x10(%rbp),%rdi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  0xecd(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps 0xed2(%rip),%xmm2
movq   -0x10(%rbp),%xmm1
punpckldq %xmm2,%xmm1
movapd 0xed1(%rip),%xmm2
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
divsd  0xed1(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
unpcklps 0xed4(%rip),%xmm2
subpd  0xedc(%rip),%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @get_time() {
%1 = alloca %struct.timeval
%2 = alloca double
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = fdiv double %6, 1.000000e+06
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%9 = load i64, i64* %8
%10 = uitofp i64 %9 to double
%11 = fadd double %7, %10
store double %11, double* %2
%12 = load double, double* %2
ret double %12
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @get_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = fdiv double %6, 1.000000e+06
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = uitofp i64 %9 to double
%11 = fadd double %7, %10
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
int strnlen(char *, int);
void strnlen_constant2(char x) {
  char a[] = "123";
  clang_analyzer_eval(strnlen(a, 10) == 3);
  a[0] = x;
  clang_analyzer_eval(strnlen(a, 10) == 3);
}


x86 assembly (clang, -O0):
<strnlen_constant2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x5(%rbp)
lea    -0x5(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strnlen@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    -0x1(%rbp),%al
mov    %al,-0x5(%rbp)
lea    -0x5(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strnlen@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen_constant2>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movl   $0x333231,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <strnlen@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <clang_analyzer_eval@plt>
mov    %bl,0x4(%rsp)
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <strnlen@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <clang_analyzer_eval@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.strnlen_constant2.a = [4 x i8] c"123\00"
define void @strnlen_constant2(i8 signext %0) {
%2 = alloca i8
%3 = alloca [4 x i8]
store i8 %0, i8* %2
%4 = bitcast [4 x i8]* %3 to i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = call i32 @strnlen(i8* %5, i32 10)
%7 = icmp eq i32 %6, 3
%8 = zext i1 %7 to i32
%9 = call i32 @clang_analyzer_eval(i32 %8)
%10 = load i8, i8* %2
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 %10, i8* %11
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%13 = call i32 @strnlen(i8* %12, i32 10)
%14 = icmp eq i32 %13, 3
%15 = zext i1 %14 to i32
%16 = call i32 @clang_analyzer_eval(i32 %15)
ret void
}

LLVM IR (-O2):
define void @strnlen_constant2(i8 signext %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 3355185, i32* %2
%4 = call i32 @strnlen(i8* %3, i32 10)
%5 = icmp eq i32 %4, 3
%6 = zext i1 %5 to i32
%7 = call i32 @clang_analyzer_eval(i32 %6)
store i8 %0, i8* %3
%8 = call i32 @strnlen(i8* %3, i32 10)
%9 = icmp eq i32 %8, 3
%10 = zext i1 %9 to i32
%11 = call i32 @clang_analyzer_eval(i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit_program();
void sigterm_handler(int signum) {
  {};
  exit_program();
  {};
}


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

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

LLVM IR (-O0):
define void @sigterm_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @exit_program()
ret void
}

LLVM IR (-O2):
define void @sigterm_handler(i32 %0) {
%2 = tail call i32 (...) @exit_program()
ret void
}
int compare_doubles(double a, double b) {
  double eps = 0.0001;
  double diff = (a - b);
  if (a > b) {
    return 1;
  } else if (diff >= eps) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<compare_doubles>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1146 <compare_doubles+0x46>
movl   $0x1,-0x4(%rbp)
jmp    116e <compare_doubles+0x6e>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1162 <compare_doubles+0x62>
movl   $0x1,-0x4(%rbp)
jmp    116e <compare_doubles+0x6e>
jmp    1167 <compare_doubles+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_doubles>:
ucomisd %xmm1,%xmm0
seta   %al
subsd  %xmm1,%xmm0
ucomisd 0xeed(%rip),%xmm0
setae  %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @compare_doubles(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double 1.000000e-04, double* %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fsub double %8, %9
store double %10, double* %7
%11 = load double, double* %4
%12 = load double, double* %5
%13 = fcmp ogt double %11, %12
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 1, i32* %3
br label %22
15: ; preds = %2
%16 = load double, double* %7
%17 = load double, double* %6
%18 = fcmp oge double %16, %17
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %3
br label %22
20: ; preds = %15
br label %21
21: ; preds = %20
store i32 0, i32* %3
br label %22
22: ; preds = %21, %19, %14
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @compare_doubles(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = fsub double %0, %1
%5 = fcmp oge double %4, 1.000000e-04
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void set_tweak_in_tweakey(uint8_t *tweakey, uint8_t *tweak) {
  memcpy(tweakey + 12, tweak, 12);
}


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

x86 assembly (clang, -O2):
<set_tweak_in_tweakey>:
add    $0x30,%rdi
mov    $0xc,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @set_tweak_in_tweakey(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 = getelementptr inbounds i32, i32* %5, i64 12
%7 = load i32*, i32** %4
%8 = call i32 @memcpy(i32* %6, i32* %7, i32 12)
ret void
}

LLVM IR (-O2):
define void @set_tweak_in_tweakey(i32* %0, i32* %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 12
%4 = tail call i32 @memcpy(i32* %3, i32* %1, i32 12)
ret void
}
void SimMainP$Boot$booted(void) { ORWNeighbourTestC$Boot$booted(); }


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

x86 assembly (clang, -O2):
<SimMainP$Boot$booted>:
xor    %eax,%eax
jmp    1030 <ORWNeighbourTestC$Boot$booted@plt>

LLVM IR (-O0):
define void @"SimMainP$Boot$booted"() {
%1 = call i32 (...) @"ORWNeighbourTestC$Boot$booted"()
ret void
}

LLVM IR (-O2):
define void @"SimMainP$Boot$booted"() {
%1 = tail call i32 (...) @"ORWNeighbourTestC$Boot$booted"()
ret void
}
void *ioremap(unsigned long offset, unsigned long size) {
  return (void *)(0xc000000000000000 | (offset));
}


x86 assembly (clang, -O0):
<ioremap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0xc000000000000000,%rax
or     -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioremap>:
movabs $0xc000000000000000,%rax
or     %rdi,%rax
ret

LLVM IR (-O0):
define i8* @ioremap(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = or i64 -4611686018427387904, %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @ioremap(i64 %0, i64 %1) {
%3 = or i64 %0, -4611686018427387904
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int foo(int a) { return a * a; }


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

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int open(const char *fname, int flags, ...) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<open>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @open(i8* %0, i32 %1, ...) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @open(i8* nocapture readnone %0, i32 %1, ...) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
char *_nl_find_language(name) const char *name;
{
  while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.')
    ++name;
  return (char *)name;
}


x86 assembly (clang, -O0):
<_nl_find_language>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1157 <_nl_find_language+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x5f,%ecx
mov    %al,-0x9(%rbp)
je     1157 <_nl_find_language+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x40,%ecx
mov    %al,-0x9(%rbp)
je     1157 <_nl_find_language+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1167 <_nl_find_language+0x67>
jmp    1178 <_nl_find_language+0x78>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <_nl_find_language+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nl_find_language>:
mov    %rdi,%rax
movabs $0x2000000040001,%rcx
nopl   (%rax)
movzbl (%rax),%edx
lea    -0x2e(%rdx),%esi
cmp    $0x31,%sil
ja     1126 <_nl_find_language+0x26>
movzbl %sil,%esi
bt     %rsi,%rcx
jb     1130 <_nl_find_language+0x30>
test   %dl,%dl
je     1130 <_nl_find_language+0x30>
add    $0x1,%rax
jmp    1110 <_nl_find_language+0x10>
ret

LLVM IR (-O0):
define i8* @_nl_find_language(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %29, %1
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 95
br i1 %14, label %15, label %27
15: ; preds = %9
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 64
br i1 %20, label %21, label %27
21: ; preds = %15
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 46
br label %27
27: ; preds = %21, %15, %9, %3
%28 = phi i1 [ false, %15 ], [ false, %9 ], [ false, %3 ], [ %26, %21 ]
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %2
br label %3
32: ; preds = %27
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
define i8* @_nl_find_language(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 95, label %7
i8 64, label %7
i8 46, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2, %2, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ add_output(char *);
void gtp_protocol_version(int gtp_argc, char gtp_argv[][20]) {
  add_output("2");
  return;
}


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"2\00"
define void @gtp_protocol_version(i32 %0, [20 x i8]* %1) {
%3 = alloca i32
%4 = alloca [20 x i8]*
store i32 %0, i32* %3
store [20 x i8]* %1, [20 x i8]** %4
%5 = call i32 @add_output(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"2\00"
define void @gtp_protocol_version(i32 %0, [20 x i8]* nocapture readnone %1) {
%3 = tail call i32 @add_output(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main() {
  char src[5];
  char dst[5];
  read(0, src, 5);
  strncpy(dst, src, 5 - 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x9(%rbp),%rsi
xor    %edi,%edi
mov    $0x5,%edx
call   1040 <read@plt>
lea    -0xe(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncpy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xb(%rsp),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <read@plt>
lea    0x6(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncpy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 5)
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%8 = call i32 @strncpy(i8* %6, i8* %7, i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %3, i32 5)
%6 = call i32 @strncpy(i8* %4, i8* %3, i32 3)
ret i32 0
}