xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t _sh(uint8_t *data, uint8_t i) { return (*data >> (8 - (i << 1))); }


x86 assembly (clang, -O0):
<_sh>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%edx
shl    $0x1,%edx
mov    $0x8,%ecx
sub    %edx,%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sh>:
mov    (%rdi),%eax
add    %sil,%sil
mov    $0x8,%cl
sub    %sil,%cl
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @_sh(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = load i32, i32* %4
%8 = shl i32 %7, 1
%9 = sub nsw i32 8, %8
%10 = ashr i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @_sh(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = mul i32 %1, -2
%5 = add i32 %4, 8
%6 = ashr i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(int);
int /*<<< orphan*/ perror(char *);
void *check_malloc(int size) {
  void *p = malloc(size);
  if (p == NULL) {
    perror("malloc failed");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<check_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)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <check_malloc+0x38>
lea    0xea7(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_malloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <check_malloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"malloc failed\00"
define noalias i8* @check_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int read(int, void *, size_t);
int fastio_read(int fd, void *buf, size_t count) {
  return read(fd, buf, count);
}


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

x86 assembly (clang, -O2):
<fastio_read>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @fastio_read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ initBBOpTable();
int /*<<< orphan*/ initDither8Lookup();
int initialiseModule(void) {
  initBBOpTable();
  initDither8Lookup();
  return 1;
}


x86 assembly (clang, -O0):
<initialiseModule>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <initBBOpTable@plt>
mov    $0x0,%al
call   1040 <initDither8Lookup@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialiseModule>:
push   %rax
xor    %eax,%eax
call   1030 <initBBOpTable@plt>
xor    %eax,%eax
call   1040 <initDither8Lookup@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @initialiseModule() {
%1 = call i32 (...) @initBBOpTable()
%2 = call i32 (...) @initDither8Lookup()
ret i32 1
}

LLVM IR (-O2):
define i32 @initialiseModule() {
%1 = tail call i32 (...) @initBBOpTable()
%2 = tail call i32 (...) @initDither8Lookup()
ret i32 1
}
void dcookie_unregister(struct dcookie_user *user) { return; }


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

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

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

LLVM IR (-O2):
%struct.dcookie_user = type opaque
define void @dcookie_unregister(%struct.dcookie_user* nocapture %0) {
ret void
}
int _kt_is_emacs_meta(const char *string) {
  return *string++ == 'M' && *string++ == '-' && *string;
}


x86 assembly (clang, -O0):
<_kt_is_emacs_meta>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x4d,%ecx
mov    %al,-0x9(%rbp)
jne    1158 <_kt_is_emacs_meta+0x58>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x9(%rbp)
jne    1158 <_kt_is_emacs_meta+0x58>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_kt_is_emacs_meta>:
xor    %eax,%eax
cmpb   $0x4d,(%rdi)
jne    1116 <_kt_is_emacs_meta+0x16>
cmpb   $0x2d,0x1(%rdi)
jne    1116 <_kt_is_emacs_meta+0x16>
xor    %eax,%eax
cmpb   $0x0,0x2(%rdi)
setne  %al
ret

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

LLVM IR (-O2):
define i32 @_kt_is_emacs_meta(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 77
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 45
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %8, %4, %1
%14 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %12, %8 ]
ret i32 %14
}
/* Variables and functions */
uintptr_t round_down(uintptr_t value, uintptr_t size) { return value & -size; }


x86 assembly (clang, -O0):
<round_down>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_down>:
mov    %rsi,%rax
neg    %rax
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @round_down(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 = load i64, i64* %4
%7 = sub i64 0, %6
%8 = and i64 %5, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @round_down(i64 %0, i64 %1) {
%3 = sub i64 0, %1
%4 = and i64 %3, %0
ret i64 %4
}
void foo_2_1_2_1_1_1_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_2_1_1_1_2_1_2() {
ret void
}
/* Variables and functions */
int WNOHANG;
int WUNTRACED;
int waitpid(int, int *, int);
void reapchild(int notused) {
  int state, pid;
  while ((pid = waitpid(-1, &state, WNOHANG | WUNTRACED)) > 0)
    ;
}


x86 assembly (clang, -O0):
<reapchild>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    0x2ead(%rip),%rax
or     (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <waitpid@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jle    114c <reapchild+0x3c>
jmp    111b <reapchild+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reapchild>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2ec8(%rip),%r14
mov    0x2eb1(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    (%r15),%edx
or     (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %eax,%eax
jg     1130 <reapchild+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
@WUNTRACED = global i32 0
define void @reapchild(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
br label %5
5: ; preds = %11, %1
%6 = load i32, i32* @WNOHANG
%7 = load i32, i32* @WUNTRACED
%8 = or i32 %6, %7
%9 = call i32 @waitpid(i32 -1, i32* %3, i32 %8)
store i32 %9, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %5
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
@WUNTRACED = global i32 0
define void @reapchild(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = load i32, i32* @WNOHANG
%6 = load i32, i32* @WUNTRACED
%7 = or i32 %6, %5
%8 = call i32 @waitpid(i32 -1, i32* %2, i32 %7)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %4, label %10
10: ; preds = %4
ret void
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ printf(char *);
void sig_handler(int signo) {
  if (signo == SIGINT)
    printf("received SIGINT\n");
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ec3(%rip),%rcx
cmp    (%rcx),%eax
jne    1139 <sig_handler+0x29>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jne    1127 <sig_handler+0x17>
lea    0xede(%rip),%rdi
jmp    1030 <puts@plt>
ret

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [17 x i8] c"received SIGINT\0A\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@str = [16 x i8] c"received SIGINT\00"
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ height;
};
typedef TYPE_1__ XExposeEvent;

/* Variables and functions */
int get_XExposeEvent_height(void *_p) {
  return (int)((XExposeEvent *)_p)->height;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XExposeEvent_height(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XExposeEvent_height(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ robust_close(int);
int /*<<< orphan*/ unlink(char const *);
void pid_file_release(const char *filename, int fd) {
  unlink(filename);
  robust_close(fd);
}


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

x86 assembly (clang, -O2):
<pid_file_release>:
push   %rbx
mov    %esi,%ebx
call   1030 <unlink@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <robust_close@plt>

LLVM IR (-O0):
define void @pid_file_release(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @unlink(i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @robust_close(i32 %7)
ret void
}

LLVM IR (-O2):
define void @pid_file_release(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @unlink(i8* %0)
%4 = tail call i32 @robust_close(i32 %1)
ret void
}
/* Variables and functions */
int disk_image_fsimage_create(char const *, unsigned int);
int tape_image_create(char const *, unsigned int);
int cbmimage_create_image(const char *name, unsigned int type) {
  switch (type) {
  case 1531:
    return tape_image_create(name, type);
  default:
    break;
  }
  return disk_image_fsimage_create(name, type);
}


x86 assembly (clang, -O0):
<cbmimage_create_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x5fb,%eax
jne    1156 <cbmimage_create_image+0x36>
jmp    1142 <cbmimage_create_image+0x22>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <tape_image_create@plt>
mov    %eax,-0x4(%rbp)
jmp    116a <cbmimage_create_image+0x4a>
jmp    115b <cbmimage_create_image+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <disk_image_fsimage_create@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbmimage_create_image>:
cmp    $0x5fb,%esi
jne    1132 <cbmimage_create_image+0x12>
mov    $0x5fb,%esi
jmp    1030 <tape_image_create@plt>
jmp    1040 <disk_image_fsimage_create@plt>

LLVM IR (-O0):
define i32 @cbmimage_create_image(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %11 [
i32 1531, label %7
]
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call i32 @tape_image_create(i8* %8, i32 %9)
store i32 %10, i32* %3
br label %16
11: ; preds = %2
br label %12
12: ; preds = %11
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = call i32 @disk_image_fsimage_create(i8* %13, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %7
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @cbmimage_create_image(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 1531
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @tape_image_create(i8* %0, i32 1531)
br label %8
6: ; preds = %2
%7 = tail call i32 @disk_image_fsimage_create(i8* %0, i32 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
int includeP2PWithIndexAny() { return 0; }


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

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

LLVM IR (-O0):
define i32 @includeP2PWithIndexAny() {
ret i32 0
}

LLVM IR (-O2):
define i32 @includeP2PWithIndexAny() {
ret i32 0
}
int main() {
  int test = 0;
start:
  if (test) {
    goto start;
  } else {
    goto end;
  }
end:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1121 <main+0x21>
jmp    1112 <main+0x12>
jmp    1126 <main+0x26>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void loop2() {
  volatile int i;
  for (i = 0; i < 10000; i++)
    ;
  return;
}


x86 assembly (clang, -O0):
<loop2>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x2710,%eax
jge    112c <loop2+0x2c>
jmp    111e <loop2+0x1e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <loop2+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop2>:
movl   $0x0,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x270f,%eax
jg     1130 <loop2+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x2710,%eax
jl     1120 <loop2+0x20>
ret

LLVM IR (-O0):
define void @loop2() {
%1 = alloca i32
store volatile i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load volatile i32, i32* %1
%4 = icmp slt i32 %3, 10000
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load volatile i32, i32* %1
%8 = add nsw i32 %7, 1
store volatile i32 %8, i32* %1
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @loop2() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%3 = load volatile i32, i32* %1
%4 = icmp slt i32 %3, 10000
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = load volatile i32, i32* %1
%7 = add nsw i32 %6, 1
store volatile i32 %7, i32* %1
%8 = load volatile i32, i32* %1
%9 = icmp slt i32 %8, 10000
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret void
}
/* Variables and functions */
double fmod(double, double);
double swi_mod2PI(double x) {
  double y;
  y = fmod(x, (2.0 * 3.14159265358979323846));
  if (y < 0.0)
    y += (2.0 * 3.14159265358979323846);
  return (y);
}


x86 assembly (clang, -O0):
<swi_mod2PI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1154 <swi_mod2PI+0x44>
movsd  0xeb6(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swi_mod2PI>:
push   %rax
movsd  0xee7(%rip),%xmm1
call   1030 <fmod@plt>
movsd  0xeda(%rip),%xmm3
addsd  %xmm0,%xmm3
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm1
cmpltsd %xmm2,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm0,%xmm1
orpd   %xmm3,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @swi_mod2PI(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @fmod(double %4, double 0x401921FB54442D18)
store double %5, double* %3
%6 = load double, double* %3
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load double, double* %3
%10 = fadd double %9, 0x401921FB54442D18
store double %10, double* %3
br label %11
11: ; preds = %8, %1
%12 = load double, double* %3
ret double %12
}

LLVM IR (-O2):
define double @swi_mod2PI(double %0) {
%2 = tail call double @fmod(double %0, double 0x401921FB54442D18)
%3 = fcmp olt double %2, 0.000000e+00
%4 = fadd double %2, 0x401921FB54442D18
%5 = select i1 %3, double %4, double %2
ret double %5
}
/* Type definitions */
struct jx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(char const *);
struct jx *jx_string_nocopy(int /*<<< orphan*/);
int /*<<< orphan*/ strdup(char const *);
struct jx *jx_string(const char *string_value) {
  assert(string_value);
  return jx_string_nocopy(strdup(string_value));
}


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

x86 assembly (clang, -O2):
<jx_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1050 <strdup@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <jx_string_nocopy@plt>

LLVM IR (-O0):
%struct.jx = type { i32 }
define %struct.jx* @jx_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @assert(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @strdup(i8* %5)
%7 = call %struct.jx* @jx_string_nocopy(i32 %6)
ret %struct.jx* %7
}

LLVM IR (-O2):
%struct.jx = type { i32 }
define %struct.jx* @jx_string(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @strdup(i8* %0)
%4 = tail call %struct.jx* @jx_string_nocopy(i32 %3)
ret %struct.jx* %4
}
void rdp_sec_buf_out_uint32(char *buffer, int value) {
  buffer[0] = value & 0xff;
  buffer[1] = (value >> 8) & 0xff;
  buffer[2] = (value >> 16) & 0xff;
  buffer[3] = (value >> 24) & 0xff;
}


x86 assembly (clang, -O0):
<rdp_sec_buf_out_uint32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdp_sec_buf_out_uint32>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @rdp_sec_buf_out_uint32(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 255
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i32, i32* %4
%11 = ashr i32 %10, 8
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
%16 = load i32, i32* %4
%17 = ashr i32 %16, 16
%18 = and i32 %17, 255
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 %19, i8* %21
%22 = load i32, i32* %4
%23 = ashr i32 %22, 24
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
ret void
}

LLVM IR (-O2):
define void @rdp_sec_buf_out_uint32(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ writememw(int, int, int);
void writememl(uint32_t s, uint32_t a, uint32_t v) {
  writememw(s, a, v & 0xffff);
  writememw(s, a + 2, v >> 16);
}


x86 assembly (clang, -O0):
<writememl>:
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    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
and    $0xffff,%edx
call   1030 <writememw@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x2,%esi
mov    -0xc(%rbp),%edx
sar    $0x10,%edx
call   1030 <writememw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writememl>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
movzwl %bx,%edx
call   1030 <writememw@plt>
add    $0x2,%ebp
sar    $0x10,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <writememw@plt>

LLVM IR (-O0):
define void @writememl(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 = load i32, i32* %6
%10 = and i32 %9, 65535
%11 = call i32 @writememw(i32 %7, i32 %8, i32 %10)
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 2
%15 = load i32, i32* %6
%16 = ashr i32 %15, 16
%17 = call i32 @writememw(i32 %12, i32 %14, i32 %16)
ret void
}

LLVM IR (-O2):
define void @writememl(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 65535
%5 = tail call i32 @writememw(i32 %0, i32 %1, i32 %4)
%6 = add nsw i32 %1, 2
%7 = ashr i32 %2, 16
%8 = tail call i32 @writememw(i32 %0, i32 %6, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void show_help(void) {
  fprintf(stderr, "Usage:\n\n"
                  "  --create   create the empty net namespace\n"
                  "  --destroy  destroy the empty namespace\n"
                  "  --status   show the status of the empty namespace\n"
                  "  --help     print this help\n");
}


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

x86 assembly (clang, -O2):
<show_help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [175 x i8] c"Usage:\0A\0A --create create the empty net namespace\0A --destroy destroy the empty namespace\0A --status show the status of the empty namespace\0A --help print this help\0A\00"
define void @show_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [175 x i8] c"Usage:\0A\0A --create create the empty net namespace\0A --destroy destroy the empty namespace\0A --status show the status of the empty namespace\0A --help print this help\0A\00"
define void @show_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str, i64 0, i64 0))
ret void
}
double GPS_Math_Rad_To_Deg(double v) {
  return v * (double)((double)180. / (double)3.141592653589);
}


x86 assembly (clang, -O0):
<GPS_Math_Rad_To_Deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPS_Math_Rad_To_Deg>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @GPS_Math_Rad_To_Deg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x404CA5DC1A63C9EC
ret double %4
}

LLVM IR (-O2):
define double @GPS_Math_Rad_To_Deg(double %0) {
%2 = fmul double %0, 0x404CA5DC1A63C9EC
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ fun(int *, int);
int main() {
  int a[7] = {3, 5, 46, 7, 3, 5, 6};
  int len = 7;
  fun(&*a, len);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed9(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x7,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <fun@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xef1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <fun@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [7 x i32] [i32 3, i32 5, i32 46, i32 7, i32 3, i32 5, i32 6]
define i32 @main() {
%1 = alloca [7 x i32]
%2 = alloca i32
%3 = bitcast [7 x i32]* %1 to i8*
store i32 7, i32* %2
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @fun(i32* %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [7 x i32] [i32 3, i32 5, i32 46, i32 7, i32 3, i32 5, i32 6]
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @fun(i32* %3, i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
void eq_ne(unsigned a) {
  char *b = ((void *)0);
  if (a == -1U)
    b = malloc(1);
  if (a + 1 != 0)
    return;
  if (a - 1 != -1U - 1)
    return;
  free(b);
}


x86 assembly (clang, -O0):
<eq_ne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    114b <eq_ne+0x2b>
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0x0,%eax
je     115f <eq_ne+0x3f>
jmp    117c <eq_ne+0x5c>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cmp    $0xfffffffe,%eax
je     1173 <eq_ne+0x53>
jmp    117c <eq_ne+0x5c>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq_ne>:
cmp    $0xffffffff,%edi
je     1126 <eq_ne+0x6>
ret
push   %rax
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @eq_ne(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%5 = tail call i32 @free(i8* %4)
br label %6
6: ; preds = %1, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int d = 1;
  while (1) {
    scanf("%d", &d);
    d = d * 2;
    printf("%d\n", d);
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
lea    0xec8(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xebf(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
add    %esi,%esi
mov    %esi,0xc(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1150 <main+0x30>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
br label %3
3: ; preds = %3, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl nsw i32 %5, 1
store i32 %6, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ dlsym(void *, char *);
uintptr_t dlsym4029(uintptr_t handle, char *name) {
  return (uintptr_t)(dlsym((void *)(handle), name));
}


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

x86 assembly (clang, -O2):
<dlsym4029>:
push   %rax
call   1030 <dlsym@plt>
cltq
pop    %rcx
ret

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

LLVM IR (-O2):
define i64 @dlsym4029(i64 %0, i8* %1) {
%3 = inttoptr i64 %0 to i8*
%4 = tail call i32 @dlsym(i8* %3, i8* %1)
%5 = sext i32 %4 to i64
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
double gammp(double const, double const);
double pgamma(const double x, const double alpha, const double beta) {
  if (x < 0.)
    error("bad x in pgamma");
  return gammp(alpha, beta * x);
}


x86 assembly (clang, -O0):
<pgamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1151 <pgamma+0x31>
lea    0xeb4(%rip),%rdi
call   1040 <error@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
call   1030 <gammp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pgamma>:
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm0
jbe    1164 <pgamma+0x44>
sub    $0x18,%rsp
lea    0xec7(%rip),%rdi
movsd  %xmm1,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm3,(%rsp)
call   1040 <error@plt>
movsd  (%rsp),%xmm3
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
add    $0x18,%rsp
mulsd  %xmm2,%xmm3
movaps %xmm1,%xmm0
movapd %xmm3,%xmm1
jmp    1030 <gammp@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"bad x in pgamma\00"
define double @pgamma(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %3
%12 = load double, double* %5
%13 = load double, double* %6
%14 = load double, double* %4
%15 = fmul double %13, %14
%16 = call double @gammp(double %12, double %15)
ret double %16
}

LLVM IR (-O2):
@.str = [16 x i8] c"bad x in pgamma\00"
define double @pgamma(double %0, double %1, double %2) {
%4 = fcmp olt double %0, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = fmul double %0, %2
%9 = tail call double @gammp(double %1, double %8)
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ floyd_warshall(int **);
void main() {
  int graph[4][4] = {{0, 5, 1000, 10},
                     {1000, 0, 3, 1000},
                     {1000, 1000, 0, 1},
                     {1000, 1000, 1000, 0}};
  floyd_warshall(graph);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x40(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x40,%edx
call   1030 <memcpy@plt>
lea    -0x40(%rbp),%rdi
call   1040 <floyd_warshall@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf15(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <floyd_warshall@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.graph = [4 x [4 x i32]] [[4 x i32] [i32 0, i32 5, i32 1000, i32 10], [4 x i32] [i32 1000, i32 0, i32 3, i32 1000], [4 x i32] [i32 1000, i32 1000, i32 0, i32 1], [4 x i32] [i32 1000, i32 1000, i32 1000, i32 0]]
define void @main() {
%1 = alloca [4 x [4 x i32]]
%2 = bitcast [4 x [4 x i32]]* %1 to i8*
%3 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0
%4 = bitcast [4 x i32]* %3 to i32**
%5 = call i32 @floyd_warshall(i32** %4)
ret void
}

LLVM IR (-O2):
@__const.main.graph = [4 x [4 x i32]] [[4 x i32] [i32 0, i32 5, i32 1000, i32 10], [4 x i32] [i32 1000, i32 0, i32 3, i32 1000], [4 x i32] [i32 1000, i32 1000, i32 0, i32 1], [4 x i32] [i32 1000, i32 1000, i32 1000, i32 0]]
define void @main() {
%1 = alloca [4 x [4 x i32]]
%2 = bitcast [4 x [4 x i32]]* %1 to i8*
%3 = bitcast [4 x [4 x i32]]* %1 to i32**
%4 = call i32 @floyd_warshall(i32** %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int /*<<< orphan*/);
void t_isalnum_0x00() {
  Assert_real((isalnum(0) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalnum.c",
              5, ("isalnum should be 0 for 0x00"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0x00\00"
define void @t_isalnum_0x00() {
%1 = tail call i64 @isalnum(i32 0)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
__attribute__((no, noclone)) int l1(int A, int B) {
  volatile int C = A & ~B;
  return ~C;
}


x86 assembly (clang, -O0):
<l1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<l1>:
not    %esi
and    %edi,%esi
mov    %esi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @l1(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 = xor i32 %7, -1
%9 = and i32 %6, %8
store volatile i32 %9, i32* %5
%10 = load volatile i32, i32* %5
%11 = xor i32 %10, -1
ret i32 %11
}

LLVM IR (-O2):
define i32 @l1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = xor i32 %1, -1
%6 = and i32 %5, %0
store volatile i32 %6, i32* %3
%7 = load volatile i32, i32* %3
%8 = xor i32 %7, -1
ret i32 %8
}
void glcont_(feed_no, actualpoints, maxpoints, record, return_code) int *feed_no
    ,
    *actualpoints, *maxpoints;
float *record;
int *return_code;
{}


x86 assembly (clang, -O0):
<glcont_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @glcont_(i32* %0, i32* %1, i32* %2, float* %3, i32* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca float*
%10 = alloca i32*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store float* %3, float** %9
store i32* %4, i32** %10
ret void
}

LLVM IR (-O2):
define void @glcont_(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, float* nocapture %3, i32* nocapture %4) {
ret void
}
void arch_decomp_puts(const char *ptr) {
  char c;
  while ((c = *ptr++) != '\0') {
    if (c == '\n')
      ;
    ;
  }
}


x86 assembly (clang, -O0):
<arch_decomp_puts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     113f <arch_decomp_puts+0x3f>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jne    113a <arch_decomp_puts+0x3a>
jmp    113a <arch_decomp_puts+0x3a>
jmp    1108 <arch_decomp_puts+0x8>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @arch_decomp_puts(i8* nocapture %0) {
ret void
}
long DigitsInt(x)
long x;
{
  if (x < 10)
    return 1;
  else if (x >= 10 && x < 100)
    return 2;
  else
    return 3;
}


x86 assembly (clang, -O0):
<DigitsInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0xa,-0x10(%rbp)
jge    1120 <DigitsInt+0x20>
movq   $0x1,-0x8(%rbp)
jmp    114b <DigitsInt+0x4b>
cmpq   $0xa,-0x10(%rbp)
jl     1143 <DigitsInt+0x43>
cmpq   $0x64,-0x10(%rbp)
jge    1143 <DigitsInt+0x43>
movq   $0x2,-0x8(%rbp)
jmp    114b <DigitsInt+0x4b>
movq   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DigitsInt>:
xor    %ecx,%ecx
cmp    $0x64,%rdi
setl   %cl
xor    $0x3,%rcx
cmp    $0xa,%rdi
mov    $0x1,%eax
cmovge %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @DigitsInt(i64 %0) {
%2 = icmp slt i64 %0, 10
%3 = icmp slt i64 %0, 100
%4 = select i1 %3, i64 2, i64 3
%5 = select i1 %2, i64 1, i64 %4
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void function2(int a) {
  printf("You entered %d so function2 was called.\n\n", a);
}


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

x86 assembly (clang, -O2):
<function2>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"You entered %d so function2 was called.\0A\0A\00"
define void @function2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"You entered %d so function2 was called.\0A\0A\00"
define void @function2(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
bar(a) {
  if (foo(a, 10) & 0x80000000)
    printf("y");
  else
    printf("n");
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <foo@plt>
and    $0x80000000,%eax
cmp    $0x0,%eax
je     115b <bar+0x3b>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1169 <bar+0x49>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <foo@plt>
test   %eax,%eax
mov    $0x6e,%eax
mov    $0x79,%edi
cmovns %eax,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"y\00"
@.str.1 = [2 x i8] c"n\00"
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i32, i32, ...) bitcast (i32 (...)* @foo to i32 (i32, i32, ...)*)(i32 %4, i32 10)
%6 = and i32 %5, -2147483648
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @foo to i32 (i32, i32, ...)*)(i32 %0, i32 10)
%3 = icmp sgt i32 %2, -1
%4 = select i1 %3, i32 110, i32 121
%5 = tail call i32 @putchar(i32 %4)
ret i32 undef
}
/* Variables and functions */
int _jenkins_hash(char const *, size_t);
int jenkins_hash(const char *key, size_t len) {
  return _jenkins_hash(key, len) % 5;
}


x86 assembly (clang, -O0):
<jenkins_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <_jenkins_hash@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jenkins_hash>:
push   %rax
call   1030 <_jenkins_hash@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @jenkins_hash(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @_jenkins_hash(i8* %5, i64 %6)
%8 = srem i32 %7, 5
ret i32 %8
}

LLVM IR (-O2):
define i32 @jenkins_hash(i8* %0, i64 %1) {
%3 = tail call i32 @_jenkins_hash(i8* %0, i64 %1)
%4 = srem i32 %3, 5
ret i32 %4
}