xunge/DecIR huggingface dataset:
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strlen(char *);
int system(char *);
int executls_execute_program(char *progpath, char *args) {
  char *fullquery = malloc(2048 * 2);
  memcpy(fullquery, progpath, strlen(progpath));
  strcat(fullquery, " ");
  strcat(fullquery, args);
  return system(fullquery);
}


x86 assembly (clang, -O0):
<executls_execute_program>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<executls_execute_program>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x1000,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1050 <memcpy@plt>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <system@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define i32 @executls_execute_program(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i8* @malloc(i32 4096)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @memcpy(i8* %7, i8* %8, i32 %10)
%12 = load i8*, i8** %5
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %5
%15 = load i8*, i8** %4
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = load i8*, i8** %5
%18 = call i32 @system(i8* %17)
ret i32 %18
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @executls_execute_program(i8* %0, i8* %1) {
%3 = tail call dereferenceable_or_null(4096) i8* @malloc(i32 4096)
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @memcpy(i8* %3, i8* %0, i32 %4)
%6 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @strcat(i8* %3, i8* %1)
%8 = tail call i32 @system(i8* %3)
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_mutex_destroy(int /*<<< orphan*/ *);
void kl_pthread_mutex_destroy(void *data) {
  pthread_mutex_destroy((pthread_mutex_t *)data);
}


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

x86 assembly (clang, -O2):
<kl_pthread_mutex_destroy>:
jmp    1030 <pthread_mutex_destroy@plt>

LLVM IR (-O0):
define void @kl_pthread_mutex_destroy(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @pthread_mutex_destroy(i32* %4)
ret void
}

LLVM IR (-O2):
define void @kl_pthread_mutex_destroy(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @pthread_mutex_destroy(i32* %2)
ret void
}
struct ATTRIB *attr_from_name(struct ATTR_FILE_NAME *fname) {
  return (struct ATTRIB *)((char *)fname - 0x18);
}


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

x86 assembly (clang, -O2):
<attr_from_name>:
lea    -0x18(%rdi),%rax
ret

LLVM IR (-O0):
%struct.ATTRIB = type opaque
%struct.ATTR_FILE_NAME = type opaque
define %struct.ATTRIB* @attr_from_name(%struct.ATTR_FILE_NAME* %0) {
%2 = alloca %struct.ATTR_FILE_NAME*
store %struct.ATTR_FILE_NAME* %0, %struct.ATTR_FILE_NAME** %2
%3 = load %struct.ATTR_FILE_NAME*, %struct.ATTR_FILE_NAME** %2
%4 = bitcast %struct.ATTR_FILE_NAME* %3 to i8*
%5 = getelementptr inbounds i8, i8* %4, i64 -24
%6 = bitcast i8* %5 to %struct.ATTRIB*
ret %struct.ATTRIB* %6
}

LLVM IR (-O2):
%struct.ATTRIB = type opaque
%struct.ATTR_FILE_NAME = type opaque
define %struct.ATTRIB* @attr_from_name(%struct.ATTR_FILE_NAME* readnone %0) {
%2 = bitcast %struct.ATTR_FILE_NAME* %0 to i8*
%3 = getelementptr inbounds i8, i8* %2, i64 -24
%4 = bitcast i8* %3 to %struct.ATTRIB*
ret %struct.ATTRIB* %4
}
/* Variables and functions */
void putc(char c) { *((char *)0xffffffff) = c; }


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%cl
mov    $0xffffffff,%eax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @putc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
store i8 %3, i8* inttoptr (i64 4294967295 to i8*)
ret void
}

LLVM IR (-O2):
define void @putc(i8 signext %0) {
store i8 %0, i8* inttoptr (i64 4294967295 to i8*)
ret void
}
long long test_and(long long x) { return x & 0x77ffffffffULL; }


x86 assembly (clang, -O0):
<test_and>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0x77ffffffff,%rax
and    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_and>:
movabs $0x77ffffffff,%rax
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @test_and(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 515396075519
ret i64 %4
}

LLVM IR (-O2):
define i64 @test_and(i64 %0) {
%2 = and i64 %0, 515396075519
ret i64 %2
}
void changeToX2(char *const str) { *str = 'X'; }


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

x86 assembly (clang, -O2):
<changeToX2>:
movb   $0x58,(%rdi)
ret

LLVM IR (-O0):
define void @changeToX2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
store i8 88, i8* %3
ret void
}

LLVM IR (-O2):
define void @changeToX2(i8* nocapture writeonly %0) {
store i8 88, i8* %0
ret void
}
/* Type definitions */
struct timespec {
  int tv_sec;
  long tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
void fast_nanosleep(int secs, long nsecs) {
  struct timespec sleeptimer;
  sleeptimer.tv_sec = secs;
  sleeptimer.tv_nsec = nsecs;
  nanosleep(&sleeptimer, NULL);
}


x86 assembly (clang, -O0):
<fast_nanosleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_nanosleep>:
sub    $0x18,%rsp
mov    %edi,0x8(%rsp)
mov    %rsi,0x10(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define void @fast_nanosleep(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca %struct.timespec
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i32, i32* %3
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
store i32 %6, i32* %7
%8 = load i64, i64* %4
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
store i64 %8, i64* %9
%10 = call i32 @nanosleep(%struct.timespec* %5, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define void @fast_nanosleep(i32 %0, i64 %1) {
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %3 to i8*
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
store i32 %0, i32* %5
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
store i64 %1, i64* %6
%7 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret void
}
int value_at(int *board, int row, int column) {
  return board[(10 * row) + column];
}


x86 assembly (clang, -O0):
<value_at>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xa,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<value_at>:
lea    (%rsi,%rsi,4),%eax
lea    (%rdx,%rax,2),%eax
cltq
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @value_at(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 = mul nsw i32 10, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %7, i64 %12
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @value_at(i32* nocapture %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, 10
%5 = add nsw i32 %4, %2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
ret i32 %8
}
int test_imm_C9uint32_mem(unsigned int *val) {
  return ((*val) & (0xC9 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_C9uint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 201
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_C9uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 201
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int f(struct A *p, const struct A *q) {
  p = q;
  return 3;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    $0x3,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.A = type opaque
define i32 @f(%struct.A* %0, %struct.A* %1) {
%3 = alloca %struct.A*
%4 = alloca %struct.A*
store %struct.A* %0, %struct.A** %3
store %struct.A* %1, %struct.A** %4
%5 = load %struct.A*, %struct.A** %4
store %struct.A* %5, %struct.A** %3
ret i32 3
}

LLVM IR (-O2):
%struct.A = type opaque
define i32 @f(%struct.A* nocapture readnone %0, %struct.A* nocapture readnone %1) {
ret i32 3
}
int test_imm_9Buint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x9B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_9Buint64_highword_reg>:
movabs $0x9b00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_9Buint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 155
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_9Buint64_highword_reg(i64 %0) {
%2 = and i64 %0, 665719930880
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ board_left();
int /*<<< orphan*/ write(int, char *, int);
void event_handler_client_in_left(int fd) {
  write(fd, "\0", 1);
  board_left();
}


x86 assembly (clang, -O0):
<event_handler_client_in_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xecb(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    $0x0,%al
call   1040 <board_left@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_handler_client_in_left>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <board_left@plt>

LLVM IR (-O0):
@.str = [2 x i8] zeroinitializer
define void @event_handler_client_in_left(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @write(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = call i32 (...) @board_left()
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] zeroinitializer
define void @event_handler_client_in_left(i32 %0) {
%2 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 (...) @board_left()
ret void
}
void gtk_rc_get_module_dir() {}


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

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

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

LLVM IR (-O2):
define void @gtk_rc_get_module_dir() {
ret void
}
int *hop(int *elem) { return (elem + *elem); }


x86 assembly (clang, -O0):
<hop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hop>:
movslq (%rdi),%rax
lea    (%rdi,%rax,4),%rax
ret

LLVM IR (-O0):
define i32* @hop(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %3, i64 %6
ret i32* %7
}

LLVM IR (-O2):
define i32* @hop(i32* %0) {
%2 = load i32, i32* %0
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int main(void) {
  system("ls -l -a");
  printf("---------------\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <system@plt>
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"ls -l -a\00"
@.str.1 = [17 x i8] c"---------------\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"ls -l -a\00"
@str = [16 x i8] c"---------------\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void exceptionHandler(int tt, unsigned long routine) {
  unsigned long *tb = (unsigned long *)0x00000040;
  tb[tt] = (0xff000000 | ((routine - (unsigned long)(&tb[tt])) >> 2));
}


x86 assembly (clang, -O0):
<exceptionHandler>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
sub    %rax,%rdx
shr    $0x2,%rdx
movabs $0xff000000,%rax
or     %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<exceptionHandler>:
movslq %edi,%rax
lea    0x40(,%rax,8),%rcx
sub    %rcx,%rsi
shr    $0x2,%rsi
mov    $0xff000000,%ecx
or     %rsi,%rcx
mov    %rcx,0x40(,%rax,8)
ret

LLVM IR (-O0):
define void @exceptionHandler(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64*
store i32 %0, i32* %3
store i64 %1, i64* %4
store i64* inttoptr (i64 64 to i64*), i64** %5
%6 = load i64, i64* %4
%7 = load i64*, i64** %5
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i64, i64* %7, i64 %9
%11 = ptrtoint i64* %10 to i64
%12 = sub i64 %6, %11
%13 = lshr i64 %12, 2
%14 = or i64 4278190080, %13
%15 = load i64*, i64** %5
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i64, i64* %15, i64 %17
store i64 %14, i64* %18
ret void
}

LLVM IR (-O2):
define void @exceptionHandler(i32 %0, i64 %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i64, i64* inttoptr (i64 64 to i64*), i64 %3
%5 = ptrtoint i64* %4 to i64
%6 = sub i64 %1, %5
%7 = lshr i64 %6, 2
%8 = or i64 %7, 4278190080
store i64 %8, i64* %4
ret void
}
int lognot_funktion(int var1, int var2) { return (!(var1 < var2)); }


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

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

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

LLVM IR (-O2):
define i32 @lognot_funktion(i32 %0, i32 %1) {
%3 = icmp sge i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
volatile void _fake_start() { asm(".align 4\n.int 0x1337D00D\njmp _start"); }


x86 assembly (clang, -O0):
<_fake_start>:
push   %rbp
mov    %rsp,%rbp
or     $0xe91337d0,%eax
adc    %edi,%edi
(bad)
lcall  *-0x3d(%rbp)

x86 assembly (clang, -O2):
<_fake_start>:
or     $0xe91337d0,%eax
(bad)
(bad)
(bad)
inc    %ebx

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

LLVM IR (-O2):
define void @_fake_start() {
tail call void asm sideeffect ".align 4\0A.int 0x1337D00D\0Ajmp _start", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, int /*<<< orphan*/ *);
void end_user_section() { write("json-task.json", "]\n", NULL); }


x86 assembly (clang, -O0):
<end_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):
<end_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 = [3 x i8] c"]\0A\00"
define void @end_user_section() {
%1 = call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 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 = [3 x i8] c"]\0A\00"
define void @end_user_section() {
%1 = tail call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
void keyboard() { asm volatile("int $33"); }


x86 assembly (clang, -O0):
<keyboard>:
push   %rbp
mov    %rsp,%rbp
int    $0x21
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboard>:
int    $0x21
ret

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

LLVM IR (-O2):
define void @keyboard() {
tail call void asm sideeffect "int $$33", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
__float128 from_sign_short(short a) { return (__float128)a; }


x86 assembly (clang, -O0):
<from_sign_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movswl %ax,%edi
call   1130 <__floatsitf>
add    $0x10,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<from_sign_short>:
push   %rax
call   1110 <__floatsitf>
pop    %rax
ret
nopl   0x0(%rax,%rax,1)

LLVM IR (-O0):
define fp128 @from_sign_short(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sitofp i16 %3 to fp128
ret fp128 %4
}

LLVM IR (-O2):
define fp128 @from_sign_short(i16 signext %0) {
%2 = sitofp i16 %0 to fp128
ret fp128 %2
}
int getExponent(int x, int n) {
  int y = 1;
  int z = 1;
  while (n != 0) {
    if (n % 2 == 1) {
      y = x * n;
    }
    n = n / 2;
    x = x * x;
    z++;
  }
  return y;
}


x86 assembly (clang, -O0):
<getExponent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1166 <getExponent+0x66>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1140 <getExponent+0x40>
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1118 <getExponent+0x18>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getExponent>:
mov    $0x1,%eax
test   %esi,%esi
je     113e <getExponent+0x3e>
mov    %esi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %esi,%r8d
imul   %edi,%r8d
shr    $0x1f,%ecx
add    %esi,%ecx
mov    %ecx,%r9d
and    $0xfffffffe,%r9d
mov    %esi,%edx
sub    %r9d,%edx
cmp    $0x1,%edx
cmove  %r8d,%eax
sar    %ecx
imul   %edi,%edi
add    $0x1,%esi
cmp    $0x2,%esi
mov    %ecx,%esi
ja     1110 <getExponent+0x10>
ret

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

LLVM IR (-O2):
define i32 @getExponent(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %16, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 1, %2 ]
%6 = phi i32 [ %12, %4 ], [ %1, %2 ]
%7 = phi i32 [ %13, %4 ], [ %0, %2 ]
%8 = srem i32 %6, 2
%9 = icmp eq i32 %8, 1
%10 = mul nsw i32 %6, %7
%11 = select i1 %9, i32 %10, i32 %5
%12 = sdiv i32 %6, 2
%13 = mul nsw i32 %7, %7
%14 = add i32 %6, 1
%15 = icmp ult i32 %14, 3
br i1 %15, label %16, label %4
16: ; preds = %4, %2
%17 = phi i32 [ 1, %2 ], [ %11, %4 ]
ret i32 %17
}
void RTMsgInfoV(void) {}


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

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

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

LLVM IR (-O2):
define void @RTMsgInfoV() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *getenv(char *);
int /*<<< orphan*/ stderr;
void check_ld_bind() {
  const char *bind = getenv("LD_BIND_NOW");
  if (bind) {
    fprintf(stderr, "Found LD_BIND_NOW, existing...\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check_ld_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1172 <check_ld_bind+0x42>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_ld_bind>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
jne    1144 <check_ld_bind+0x14>
pop    %rax
ret
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"LD_BIND_NOW\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Found LD_BIND_NOW, existing...\0A\00"
define void @check_ld_bind() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"LD_BIND_NOW\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Found LD_BIND_NOW, existing...\0A\00"
define void @check_ld_bind() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
ret void
}
void mips_mem_config_default(struct config_t *config) {}


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

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

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

LLVM IR (-O2):
%struct.config_t = type opaque
define void @mips_mem_config_default(%struct.config_t* nocapture %0) {
ret void
}
void null_gfx_free(void *data) { (void)data; }


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

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

LLVM IR (-O0):
define void @null_gfx_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @null_gfx_free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_outb(unsigned char, int);
void spd_set_drb(void) {
  unsigned char ch;
  char *str;
  str = "test_string";
  ch = *str;
  __builtin_outb(ch, 0xab);
}


x86 assembly (clang, -O0):
<spd_set_drb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
mov    $0xab,%esi
movzbl -0x1(%rbp),%edi
call   1030 <__builtin_outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spd_set_drb>:
mov    $0x74,%edi
mov    $0xab,%esi
jmp    1030 <__builtin_outb@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"test_string\00"
define void @spd_set_drb() {
%1 = alloca i8
%2 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
store i8 %4, i8* %1
%5 = load i8, i8* %1
%6 = call i32 @__builtin_outb(i8 zeroext %5, i32 171)
ret void
}

LLVM IR (-O2):
define void @spd_set_drb() {
%1 = tail call i32 @__builtin_outb(i8 zeroext 116, i32 171)
ret void
}
unsigned xrop3_206_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~T;
  stk2 = D & stk3;
  stk1 = S | stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


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

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

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

LLVM IR (-O2):
define i32 @xrop3_206_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = xor i8 %1, -1
%6 = zext i8 %5 to i32
%7 = xor i32 %4, -1
%8 = and i32 %6, %7
%9 = or i8 %1, %0
%10 = zext i8 %9 to i32
%11 = or i32 %8, %10
ret i32 %11
}
void SSIIntClear(unsigned long ulBase, unsigned long ulIntFlags) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000020))) = ulIntFlags;
}


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

x86 assembly (clang, -O2):
<SSIIntClear>:
mov    %rsi,0x20(%rdi)
ret

LLVM IR (-O0):
define void @SSIIntClear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 32
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @SSIIntClear(i64 %0, i64 %1) {
%3 = add i64 %0, 32
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __cpuid(int *, int);
int CPUSupportsSSE4() {
  int info[4];
  __cpuid(info, 1);
  return (info[2] & (1 << 19));
}


x86 assembly (clang, -O0):
<CPUSupportsSSE4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <__cpuid@plt>
mov    -0x8(%rbp),%eax
and    $0x80000,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CPUSupportsSSE4>:
sub    $0x18,%rsp
mov    %rsp,%rdi
mov    $0x1,%esi
call   1030 <__cpuid@plt>
mov    $0x80000,%eax
and    0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @CPUSupportsSSE4() {
%1 = alloca [4 x i32]
%2 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%3 = call i32 @__cpuid(i32* %2, i32 1)
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%5 = load i32, i32* %4
%6 = and i32 %5, 524288
ret i32 %6
}

LLVM IR (-O2):
define i32 @CPUSupportsSSE4() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @__cpuid(i32* %3, i32 1)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%6 = load i32, i32* %5
%7 = and i32 %6, 524288
ret i32 %7
}
/* Type definitions */
struct shl_htable {
  int dummy;
};

/* Variables and functions */
size_t shl_htable_hash_str(struct shl_htable *, char *, size_t *);
int shl_htable_insert(struct shl_htable *, void const *, size_t);
int shl_htable_insert_str(struct shl_htable *htable, char **str, size_t *hash) {
  size_t h;
  h = shl_htable_hash_str(htable, *str, hash);
  return shl_htable_insert(htable, (const void *)str, h);
}


x86 assembly (clang, -O0):
<shl_htable_insert_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <shl_htable_hash_str@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <shl_htable_insert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shl_htable_insert_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%rsi
call   1040 <shl_htable_hash_str@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <shl_htable_insert@plt>

LLVM IR (-O0):
%struct.shl_htable = type { i32 }
define i32 @shl_htable_insert_str(%struct.shl_htable* %0, i8** %1, i64* %2) {
%4 = alloca %struct.shl_htable*
%5 = alloca i8**
%6 = alloca i64*
%7 = alloca i64
store %struct.shl_htable* %0, %struct.shl_htable** %4
store i8** %1, i8*** %5
store i64* %2, i64** %6
%8 = load %struct.shl_htable*, %struct.shl_htable** %4
%9 = load i8**, i8*** %5
%10 = load i8*, i8** %9
%11 = load i64*, i64** %6
%12 = call i64 @shl_htable_hash_str(%struct.shl_htable* %8, i8* %10, i64* %11)
store i64 %12, i64* %7
%13 = load %struct.shl_htable*, %struct.shl_htable** %4
%14 = load i8**, i8*** %5
%15 = bitcast i8** %14 to i8*
%16 = load i64, i64* %7
%17 = call i32 @shl_htable_insert(%struct.shl_htable* %13, i8* %15, i64 %16)
ret i32 %17
}

LLVM IR (-O2):
%struct.shl_htable = type { i32 }
define i32 @shl_htable_insert_str(%struct.shl_htable* %0, i8** %1, i64* %2) {
%4 = load i8*, i8** %1
%5 = tail call i64 @shl_htable_hash_str(%struct.shl_htable* %0, i8* %4, i64* %2)
%6 = bitcast i8** %1 to i8*
%7 = tail call i32 @shl_htable_insert(%struct.shl_htable* %0, i8* %6, i64 %5)
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int getpid();
void touch_pid(const char *pid_file) {
  pid_t pid;
  FILE *pid_f = NULL;
  if ((pid_f = fopen(pid_file, "wb")) != NULL) {
    fprintf(pid_f, "%d", getpid());
    fclose(pid_f);
    pid_f = NULL;
  }
}


x86 assembly (clang, -O0):
<touch_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11a4 <touch_pid+0x64>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xe75(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movq   $0x0,-0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch_pid>:
push   %rbx
lea    0xeb8(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1176 <touch_pid+0x36>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fclose@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
@.str.1 = [3 x i8] c"%d\00"
define void @touch_pid(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
store i8* %0, i8** %2
store i32* null, i32** %4
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32*, i32** %4
%10 = call i32 (...) @getpid()
%11 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32*, i32** %4
%13 = call i32 @fclose(i32* %12)
store i32* null, i32** %4
br label %14
14: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
@.str.1 = [3 x i8] c"%d\00"
define void @touch_pid(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @fclose(i32* %2)
br label %8
8: ; preds = %4, %1
ret void
}
double max_double(double a, double b) { return (a < b) ? b : a; }


x86 assembly (clang, -O0):
<max_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <max_double+0x31>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <max_double+0x3b>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_double>:
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @max_double(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %4
br label %12
10: ; preds = %2
%11 = load double, double* %3
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @max_double(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %1, double %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(int exit_status) {
  fprintf(stderr, "USAGE: utf8-script [--count-ascii | --skip-ascii]\n");
  exit(exit_status);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"USAGE: utf8-script [--count-ascii | --skip-ascii]\0A\00"
define void @usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"USAGE: utf8-script [--count-ascii | --skip-ascii]\0A\00"
define void @usage(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_banner(void) {
  printf("b43-fwcutter version "
         "FWCUTTER_VERSION_"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"b43-fwcutter version FWCUTTER_VERSION_\0A\00"
define void @print_banner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"b43-fwcutter version FWCUTTER_VERSION_\00"
define void @print_banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret void
}
void local_irq_save(unsigned long flags __attribute__((unused))) {
  __asm__ __volatile__("" : : : "memory");
}


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

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

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

LLVM IR (-O2):
define void @local_irq_save(i64 %0) {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
struct in_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int inet_pton(int /*<<< orphan*/, char const *, struct in_addr *);
int verify_ipv4(const char *addr) {
  int result = -1;
  if (addr != NULL) {
    struct in_addr a;
    result = inet_pton(AF_INET, addr, &a);
  }
  return (result > 0) ? 1 : 0;
}


x86 assembly (clang, -O0):
<verify_ipv4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1147 <verify_ipv4+0x37>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1030 <inet_pton@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovg  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_ipv4>:
test   %rdi,%rdi
je     1138 <verify_ipv4+0x28>
push   %rax
mov    %rdi,%rsi
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rdx
call   1030 <inet_pton@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setg   %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@AF_INET = global i32 0
define i32 @verify_ipv4(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.in_addr
store i8* %0, i8** %2
store i32 -1, i32* %3
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @AF_INET
%9 = load i8*, i8** %2
%10 = call i32 @inet_pton(i32 %8, i8* %9, %struct.in_addr* %4)
store i32 %10, i32* %3
br label %11
11: ; preds = %7, %1
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 1, i32 0
ret i32 %15
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@AF_INET = global i32 0
define i32 @verify_ipv4(i8* %0) {
%2 = alloca %struct.in_addr
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = bitcast %struct.in_addr* %2 to i8*
%6 = load i32, i32* @AF_INET
%7 = call i32 @inet_pton(i32 %6, i8* %0, %struct.in_addr* %2)
%8 = icmp sgt i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %4, %1
%11 = phi i32 [ %9, %4 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
unsigned int *returnUnsignedPointer();
void nonnegative_int_ptr() {
  unsigned int *x = returnUnsignedPointer();
  if (*x < 0) {
    int y = 1 / 0;
  }
}


x86 assembly (clang, -O0):
<nonnegative_int_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <returnUnsignedPointer@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jae    1133 <nonnegative_int_ptr+0x23>
mov    %eax,-0xc(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @nonnegative_int_ptr() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* (...) @returnUnsignedPointer()
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = load i32, i32* %4
%6 = icmp ult i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 poison, i32* %2
br label %8
8: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
define void @nonnegative_int_ptr() {
%1 = tail call i32* (...) @returnUnsignedPointer()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, a, x;
  scanf("%d", &n);
  x = n * n;
  a = n * n * n;
  printf("%d \n%d \n", x, a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
mov    %edx,%esi
imul   %edx,%esi
imul   %esi,%edx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d \0A%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = mul nsw i32 %4, %4
%6 = mul nsw i32 %5, %4
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mxFree(void *);
void def_free_func(void *opaque, void *address) {
  (void)opaque, (void)address;
  mxFree(address);
}


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

x86 assembly (clang, -O2):
<def_free_func>:
mov    %rsi,%rdi
jmp    1030 <mxFree@plt>

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

LLVM IR (-O2):
define void @def_free_func(i8* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @mxFree(i8* %1)
ret void
}