xunge/DecIR huggingface dataset:
/* Variables and functions */
char getchar();
int readline(char *str) {
  int i = 0;
  char ch;
  while ((ch = getchar()) != '\n') {
    str[i++] = ch;
  }
  str[i] = '\0';
  return i;
}


x86 assembly (clang, -O0):
<readline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1156 <readline+0x46>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1123 <readline+0x13>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readline>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     1143 <readline+0x33>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1130 <readline+0x20>
mov    %ebx,%eax
movb   $0x0,(%r14,%rax,1)
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @readline(i8* nocapture writeonly %0) {
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %9, %4 ], [ %2, %1 ]
%7 = add nuw i64 %5, 1
%8 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %6, i8* %8
%9 = tail call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = trunc i64 %7 to i32
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 0, %1 ], [ %12, %11 ]
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 0, i8* %16
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ braccioAvantiMax(int);
int /*<<< orphan*/ braccioAvantiMin(int);
int /*<<< orphan*/ braccioShowObj(int);
int /*<<< orphan*/ pinzaOpen();
int /*<<< orphan*/ pinzaPoly();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ usleep(int);
void takeObj() {
  braccioAvantiMin(60);
  pinzaOpen();
  sleep(5);
  braccioAvantiMax(90);
  pinzaPoly();
  usleep(300000);
  braccioShowObj(50);
  sleep(1);
}


x86 assembly (clang, -O0):
<takeObj>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3c,%edi
call   1040 <braccioAvantiMin@plt>
mov    $0x0,%al
call   1030 <pinzaOpen@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
mov    $0x5a,%edi
call   1080 <braccioAvantiMax@plt>
mov    $0x0,%al
call   1060 <pinzaPoly@plt>
mov    $0x493e0,%edi
call   1090 <usleep@plt>
mov    $0x32,%edi
call   1050 <braccioShowObj@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<takeObj>:
push   %rax
mov    $0x3c,%edi
call   1040 <braccioAvantiMin@plt>
xor    %eax,%eax
call   1030 <pinzaOpen@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
mov    $0x5a,%edi
call   1080 <braccioAvantiMax@plt>
xor    %eax,%eax
call   1060 <pinzaPoly@plt>
mov    $0x493e0,%edi
call   1090 <usleep@plt>
mov    $0x32,%edi
call   1050 <braccioShowObj@plt>
mov    $0x1,%edi
pop    %rax
jmp    1070 <sleep@plt>

LLVM IR (-O0):
define void @takeObj() {
%1 = call i32 @braccioAvantiMin(i32 60)
%2 = call i32 (...) @pinzaOpen()
%3 = call i32 @sleep(i32 5)
%4 = call i32 @braccioAvantiMax(i32 90)
%5 = call i32 (...) @pinzaPoly()
%6 = call i32 @usleep(i32 300000)
%7 = call i32 @braccioShowObj(i32 50)
%8 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
define void @takeObj() {
%1 = tail call i32 @braccioAvantiMin(i32 60)
%2 = tail call i32 (...) @pinzaOpen()
%3 = tail call i32 @sleep(i32 5)
%4 = tail call i32 @braccioAvantiMax(i32 90)
%5 = tail call i32 (...) @pinzaPoly()
%6 = tail call i32 @usleep(i32 300000)
%7 = tail call i32 @braccioShowObj(i32 50)
%8 = tail call i32 @sleep(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _IO(int, int);
int ioctl(int, int /*<<< orphan*/);
int pe_idle(int handle) { return ioctl(handle, _IO(0xfe, 1)); }


x86 assembly (clang, -O0):
<pe_idle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0xfe,%edi
mov    $0x1,%esi
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pe_idle>:
push   %rbx
mov    %edi,%ebx
mov    $0xfe,%edi
mov    $0x1,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @pe_idle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_IO(i32 254, i32 1)
%5 = call i32 @ioctl(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @pe_idle(i32 %0) {
%2 = tail call i32 @_IO(i32 254, i32 1)
%3 = tail call i32 @ioctl(i32 %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ put_serverbyte(int /*<<< orphan*/);
void put_serverdata(void *data, int size) {
  char *p;
  for (p = data; size > 0; size--)
    put_serverbyte(*(p++));
}


x86 assembly (clang, -O0):
<put_serverdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1156 <put_serverdata+0x46>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edi
call   1030 <put_serverbyte@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <put_serverdata+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_serverdata>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    1134 <put_serverdata+0x24>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
nop
movsbl (%rbx),%edi
add    $0x1,%rbx
call   1030 <put_serverbyte@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1120 <put_serverdata+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @put_serverdata(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i8* [ %7, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ %1, %2 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = tail call i32 @put_serverbyte(i32 %9)
%11 = add nsw i32 %6, -1
%12 = icmp ugt i32 %6, 1
br i1 %12, label %4, label %13
13: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug_warning(char *);
int /*<<< orphan*/ h_free(void *);
void component_position_free(void *data) {
  if (!data) {
    debug_warning("[component_position_free] data cannot be NULL");
    return;
  }
  h_free(data);
}


x86 assembly (clang, -O0):
<component_position_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <component_position_free+0x28>
lea    0xec2(%rip),%rdi
call   1040 <debug_warning@plt>
jmp    1151 <component_position_free+0x31>
mov    -0x8(%rbp),%rdi
call   1030 <h_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<component_position_free>:
test   %rdi,%rdi
je     112a <component_position_free+0xa>
jmp    1030 <h_free@plt>
lea    0xecf(%rip),%rdi
jmp    1040 <debug_warning@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"[component_position_free] data cannot be NULL\00"
define void @component_position_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 @debug_warning(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @h_free(i8* %8)
br label %10
10: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"[component_position_free] data cannot be NULL\00"
define void @component_position_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @debug_warning(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 @h_free(i8* %0)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ output(char *);
void cast(int sz, int asz) {
  if (sz <= asz)
    return;
  if (asz == 1)
    output(" xz A1;");
  if (sz == 4)
    output(" xz A2; xz A3;");
}


x86 assembly (clang, -O0):
<cast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     112f <cast+0x1f>
jmp    115b <cast+0x4b>
cmpl   $0x1,-0x8(%rbp)
jne    1145 <cast+0x35>
lea    0xec0(%rip),%rdi
call   1030 <output@plt>
cmpl   $0x4,-0x4(%rbp)
jne    115b <cast+0x4b>
lea    0xeb2(%rip),%rdi
call   1030 <output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cast>:
cmp    %esi,%edi
jle    113a <cast+0x2a>
push   %rbx
mov    %edi,%ebx
cmp    $0x1,%esi
jne    1128 <cast+0x18>
lea    0xedd(%rip),%rdi
call   1030 <output@plt>
cmp    $0x4,%ebx
pop    %rbx
jne    113a <cast+0x2a>
lea    0xed3(%rip),%rdi
jmp    1030 <output@plt>
ret

LLVM IR (-O0):
@.str = [8 x i8] c" xz A1;\00"
@.str.1 = [15 x i8] c" xz A2; xz A3;\00"
define void @cast(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 sle i32 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %19
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @output(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 4
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @output(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %8, %17, %14
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c" xz A1;\00"
@.str.1 = [15 x i8] c" xz A2; xz A3;\00"
define void @cast(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = icmp eq i32 %1, 1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @output(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = icmp eq i32 %0, 4
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 @output(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %2, %10, %8
ret void
}
int int_sub(int a, int b) { return a - b; }


x86 assembly (clang, -O0):
<int_sub>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_sub>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @int_sub(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @int_sub(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int private_copy_to_temporary_location(char const *, char const *);
int copy_to_temporary_location(const char *source, const char *destination) {
  if (!source || !destination) {
    return -1;
  }
  return private_copy_to_temporary_location(source, destination);
}


x86 assembly (clang, -O0):
<copy_to_temporary_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <copy_to_temporary_location+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <copy_to_temporary_location+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1152 <copy_to_temporary_location+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <private_copy_to_temporary_location@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_to_temporary_location>:
test   %rdi,%rdi
je     111f <copy_to_temporary_location+0xf>
test   %rsi,%rsi
je     111f <copy_to_temporary_location+0xf>
jmp    1030 <private_copy_to_temporary_location@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @copy_to_temporary_location(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @private_copy_to_temporary_location(i8* %0, i8* %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ -1, %2 ]
ret i32 %9
}
void f() {
ddd:;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <f+0x9>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f() {
br label %1
1: ; preds = %0
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ luaL_check_lstr(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void luaB_alert(void) { fputs((luaL_check_lstr((1), NULL)), stderr); }


x86 assembly (clang, -O0):
<luaB_alert>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <luaL_check_lstr@plt>
mov    %eax,%edi
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<luaB_alert>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <luaL_check_lstr@plt>
mov    0x2eac(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
pop    %rax
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @luaB_alert() {
%1 = call i32 @luaL_check_lstr(i32 1, i32* null)
%2 = load i32, i32* @stderr
%3 = call i32 @fputs(i32 %1, i32 %2)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @luaB_alert() {
%1 = tail call i32 @luaL_check_lstr(i32 1, i32* null)
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i32 %1, i32 %2)
ret void
}
void g_async_queue_new() {}


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

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

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

LLVM IR (-O2):
define void @g_async_queue_new() {
ret void
}
void strcpy(unsigned char *str1, unsigned char *str2, unsigned long length) {
  asm("rep movsb" ::"S"((unsigned long)str2), "D"((unsigned long)str1),
      "c"(length));
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
rep movsb %ds:(%rsi),%es:(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdx,%rcx
rep movsb %ds:(%rsi),%es:(%rdi)
ret

LLVM IR (-O0):
define void @strcpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = ptrtoint i8* %7 to i64
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
%11 = load i64, i64* %6
ret void
}

LLVM IR (-O2):
define void @strcpy(i8* %0, i8* %1, i64 %2) {
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %0 to i64
tail call void asm sideeffect "rep movsb", "{si},{di},{cx},~{dirflag},~{fpsr},~{flags}"(i64 %4, i64 %5, i64 %2)
ret void
}
/* Variables and functions */
unsigned int string_hash2(void const *);
unsigned int charptr_hash(const void *o) {
  if (!o)
    return 0;
  return string_hash2(o);
}


x86 assembly (clang, -O0):
<charptr_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <charptr_hash+0x23>
movl   $0x0,-0x4(%rbp)
jmp    113f <charptr_hash+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <string_hash2@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charptr_hash>:
test   %rdi,%rdi
je     111a <charptr_hash+0xa>
jmp    1030 <string_hash2@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @charptr_hash(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @string_hash2(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void abort(void) {
  printf("kernel panic!\n");
  for (;;) {
  }
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
jmp    1120 <abort+0x10>

x86 assembly (clang, -O2):
<abort>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
nopl   (%rax)
jmp    1120 <abort+0x10>

LLVM IR (-O0):
@.str = [15 x i8] c"kernel panic!\0A\00"
define void @abort() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
br label %2
}

LLVM IR (-O2):
@str = [14 x i8] c"kernel panic!\00"
define void @abort() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int ssl3_read_internal(int /*<<< orphan*/ *, void *, int, int);
int ssl3_peek(SSL *s, void *buf, int len) {
  return ssl3_read_internal(s, buf, len, 1);
}


x86 assembly (clang, -O0):
<ssl3_peek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x1,%ecx
call   1030 <ssl3_read_internal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssl3_peek>:
mov    $0x1,%ecx
jmp    1030 <ssl3_read_internal@plt>

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

LLVM IR (-O2):
define i32 @ssl3_peek(i32* %0, i8* %1, i32 %2) {
%4 = tail call i32 @ssl3_read_internal(i32* %0, i8* %1, i32 %2, i32 1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ altivec_check();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ main1();
int main() {
  altivec_check();
  main1();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <altivec_check@plt>
mov    $0x0,%al
call   1040 <main1@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <altivec_check@plt>
xor    %eax,%eax
call   1040 <main1@plt>
xor    %edi,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @altivec_check()
%2 = tail call i32 (...) @main1()
%3 = tail call i32 @exit(i32 0)
unreachable
}
void close_socket(int sockfd) {}


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

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

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

LLVM IR (-O2):
define void @close_socket(i32 %0) {
ret void
}
int read_element(int *array, int index) {
  int x = array[index];
  return x;
}


x86 assembly (clang, -O0):
<read_element>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_element>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @read_element(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 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @read_element(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
void pci_null_debug(char *__attribute__((unused)) msg, ...) {}


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

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

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

LLVM IR (-O2):
define void @pci_null_debug(i8* nocapture %0, ...) {
ret void
}
int complement(int x) { return ~x; }


x86 assembly (clang, -O0):
<complement>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @complement(i32 %0) {
%2 = xor i32 %0, -1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int sock_write(int /*<<< orphan*/ *, char const *, int);
int strlen(char const *);
int sock_puts(BIO *bp, const char *str) {
  int n, ret;
  n = strlen(str);
  ret = sock_write(bp, str, n);
  return (ret);
}


x86 assembly (clang, -O0):
<sock_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <sock_write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_puts>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <sock_write@plt>

LLVM IR (-O0):
define i32 @sock_puts(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
%9 = load i32*, i32** %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = call i32 @sock_write(i32* %9, i8* %10, i32 %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
ret i32 %13
}

LLVM IR (-O2):
define i32 @sock_puts(i32* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @sock_write(i32* %0, i8* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *malloc(size_t);
void *xmalloc(size_t n) {
  void *p = malloc(n);
  if (!p)
    abort();
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <xmalloc+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     112d <xmalloc+0xd>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret i8* %2
}
unsigned int lshift_u_s(unsigned int left, int right) {
  if ((right < 0) || (right >= sizeof(unsigned int) * 8) ||
      (left > (4294967295U >> right))) {
    return left;
  }
  return left << right;
}


x86 assembly (clang, -O0):
<lshift_u_s>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1139 <lshift_u_s+0x39>
movslq -0xc(%rbp),%rax
cmp    $0x20,%rax
jae    1139 <lshift_u_s+0x39>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shr    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jbe    1144 <lshift_u_s+0x44>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <lshift_u_s+0x4f>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lshift_u_s>:
mov    %esi,%ecx
mov    %edi,%eax
mov    $0xffffffff,%edx
shr    %cl,%edx
xor    %esi,%esi
cmp    %edi,%edx
mov    %ecx,%edx
cmovb  %esi,%edx
cmp    $0x20,%ecx
cmovae %esi,%edx
mov    %edx,%ecx
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @lshift_u_s(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp slt i32 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = icmp uge i64 %10, 32
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = lshr i32 -1, %14
%16 = icmp ugt i32 %13, %15
br i1 %16, label %17, label %19
17: ; preds = %12, %8, %2
%18 = load i32, i32* %4
store i32 %18, i32* %3
br label %23
19: ; preds = %12
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = shl i32 %20, %21
store i32 %22, i32* %3
br label %23
23: ; preds = %19, %17
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @lshift_u_s(i32 %0, i32 %1) {
%3 = icmp ugt i32 %1, 31
%4 = lshr i32 -1, %1
%5 = icmp ult i32 %4, %0
%6 = select i1 %3, i1 true, i1 %5
%7 = select i1 %6, i32 0, i32 %1
%8 = shl i32 %0, %7
ret i32 %8
}
/* Type definitions */
struct file {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BUG();
long kgsl_compat_ioctl(struct file *filep, unsigned int cmd,
                       unsigned long arg) {
  BUG();
  return 0;
}


x86 assembly (clang, -O0):
<kgsl_compat_ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <BUG@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.file = type { i32 }
define i64 @kgsl_compat_ioctl(%struct.file* %0, i32 %1, i64 %2) {
%4 = alloca %struct.file*
%5 = alloca i32
%6 = alloca i64
store %struct.file* %0, %struct.file** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = call i32 (...) @BUG()
ret i64 0
}

LLVM IR (-O2):
%struct.file = type { i32 }
define i64 @kgsl_compat_ioctl(%struct.file* nocapture readnone %0, i32 %1, i64 %2) {
%4 = tail call i32 (...) @BUG()
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void playmultiplayer() { printf("Play multiplayer called"); }


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"Play multiplayer called\00"
define void @playmultiplayer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Play multiplayer called\00"
define void @playmultiplayer() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}
push(int item, int *top, int array[]) {
  array[*top] = item;
  (*top)++;
}


x86 assembly (clang, -O0):
<push>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<push>:
movslq (%rsi),%rax
mov    %edi,(%rdx,%rax,4)
addl   $0x1,(%rsi)
ret

LLVM IR (-O0):
define i32 @push(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%8 = load i32, i32* %5
%9 = load i32*, i32** %7
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %9, i64 %12
store i32 %8, i32* %13
%14 = load i32*, i32** %6
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
define i32 @push(i32 %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %2, i64 %5
store i32 %0, i32* %6
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
ret i32 undef
}
int bits(int val) {
  switch (val) {
  case 0:
    return 0x01;
  case 1:
    return 0x02;
  case 2:
    return 0x04;
  case 3:
    return 0x08;
  case 4:
    return 0x10;
  case 5:
    return 0x20;
  case 6:
    return 0x40;
  case 7:
    return 0x80;
  }
}


x86 assembly (clang, -O0):
<bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x7,%rax
ja     1187 <bits+0x87>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1187 <bits+0x87>
movl   $0x2,-0x4(%rbp)
jmp    1187 <bits+0x87>
movl   $0x4,-0x4(%rbp)
jmp    1187 <bits+0x87>
movl   $0x8,-0x4(%rbp)
jmp    1187 <bits+0x87>
movl   $0x10,-0x4(%rbp)
jmp    1187 <bits+0x87>
movl   $0x20,-0x4(%rbp)
jmp    1187 <bits+0x87>
movl   $0x40,-0x4(%rbp)
jmp    1187 <bits+0x87>
movl   $0x80,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits>:
add    $0xffffffff,%edi
mov    $0x1,%eax
cmp    $0x6,%edi
ja     111a <bits+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @bits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %13 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
]
5: ; preds = %1
store i32 1, i32* %2
br label %13
6: ; preds = %1
store i32 2, i32* %2
br label %13
7: ; preds = %1
store i32 4, i32* %2
br label %13
8: ; preds = %1
store i32 8, i32* %2
br label %13
9: ; preds = %1
store i32 16, i32* %2
br label %13
10: ; preds = %1
store i32 32, i32* %2
br label %13
11: ; preds = %1
store i32 64, i32* %2
br label %13
12: ; preds = %1
store i32 128, i32* %2
br label %13
13: ; preds = %5, %6, %7, %8, %9, %10, %11, %12, %1
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@switch.table.bits = [7 x i32] [i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128]
define i32 @bits(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 7
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.bits, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
struct msghdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int recvmsg(int sockfd, struct msghdr *msg, int flags) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<recvmsg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.msghdr = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @recvmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @recvmsg(i32 %0, %struct.msghdr* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ hwreset();
void cb_reset(void *data) { hwreset(); }


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

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

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

LLVM IR (-O2):
define void @cb_reset(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @hwreset()
ret void
}
int get_flash_params_count(void) { return 111; }


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

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

LLVM IR (-O0):
define i32 @get_flash_params_count() {
ret i32 111
}

LLVM IR (-O2):
define i32 @get_flash_params_count() {
ret i32 111
}
/* Variables and functions */
int /*<<< orphan*/ W_OK;
int test_sysattr(char *, int /*<<< orphan*/, int);
int __sysattr_is_writeable(char *attribute, int threads_in_system) {
  return test_sysattr(attribute, W_OK, threads_in_system);
}


x86 assembly (clang, -O0):
<__sysattr_is_writeable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ebe(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
call   1030 <test_sysattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sysattr_is_writeable>:
mov    %esi,%edx
mov    0x2ecf(%rip),%rax
mov    (%rax),%esi
jmp    1030 <test_sysattr@plt>

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

LLVM IR (-O2):
@W_OK = global i32 0
define i32 @__sysattr_is_writeable(i8* %0, i32 %1) {
%3 = load i32, i32* @W_OK
%4 = tail call i32 @test_sysattr(i8* %0, i32 %3, i32 %1)
ret i32 %4
}
float prectangle(float l, float h) { return (l + l + h + h); }


x86 assembly (clang, -O0):
<prectangle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<prectangle>:
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @prectangle(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %3
%7 = fadd float %5, %6
%8 = load float, float* %4
%9 = fadd float %7, %8
%10 = load float, float* %4
%11 = fadd float %9, %10
ret float %11
}

LLVM IR (-O2):
define float @prectangle(float %0, float %1) {
%3 = fadd float %0, %0
%4 = fadd float %3, %1
%5 = fadd float %4, %1
ret float %5
}
/* Type definitions */
typedef int uint8_t;
typedef int uint64_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint64_t gather_bytes(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e) {
  return ((uint64_t)a << 32) | ((uint32_t)b << 24) | ((uint32_t)c << 16) |
         ((uint16_t)d << 8) | e;
}


x86 assembly (clang, -O0):
<gather_bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gather_bytes(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = shl i32 %11, 32
%13 = load i32, i32* %7
%14 = shl i32 %13, 24
%15 = or i32 %12, %14
%16 = load i32, i32* %8
%17 = shl i32 %16, 16
%18 = or i32 %15, %17
%19 = load i32, i32* %9
%20 = shl i32 %19, 8
%21 = or i32 %18, %20
%22 = load i32, i32* %10
%23 = or i32 %21, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @gather_bytes(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ asm_cursorshape(int, int);
void cursoroff(void) { asm_cursorshape(32, 32); }


x86 assembly (clang, -O0):
<cursoroff>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%esi
mov    %esi,%edi
call   1030 <asm_cursorshape@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cursoroff>:
mov    $0x20,%edi
mov    $0x20,%esi
jmp    1030 <asm_cursorshape@plt>

LLVM IR (-O0):
define void @cursoroff() {
%1 = call i32 @asm_cursorshape(i32 32, i32 32)
ret void
}

LLVM IR (-O2):
define void @cursoroff() {
%1 = tail call i32 @asm_cursorshape(i32 32, i32 32)
ret void
}
void ARGBColorTable() {}


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

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

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

LLVM IR (-O2):
define void @ARGBColorTable() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glRotatef(double, int, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(double, double, double);
void BendForward(void) {
  glTranslatef(0.0, 1.0, 0.0);
  glRotatef(90.0, 1, 0, 0);
  glTranslatef(0.0, -1.0, 0.0);
}


x86 assembly (clang, -O0):
<BendForward>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm2,%xmm2
movsd  0xee1(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glTranslatef@plt>
movsd  0xec9(%rip),%xmm0
mov    $0x1,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <glRotatef@plt>
xorps  %xmm2,%xmm2
movsd  0xea8(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glTranslatef@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BendForward>:
push   %rax
movsd  0xed7(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
call   1030 <glTranslatef@plt>
movsd  0xecc(%rip),%xmm0
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <glRotatef@plt>
movsd  0xebe(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
pop    %rax
jmp    1030 <glTranslatef@plt>

LLVM IR (-O0):
define void @BendForward() {
%1 = call i32 @glTranslatef(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%2 = call i32 @glRotatef(double 9.000000e+01, i32 1, i32 0, i32 0)
%3 = call i32 @glTranslatef(double 0.000000e+00, double -1.000000e+00, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
define void @BendForward() {
%1 = tail call i32 @glTranslatef(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%2 = tail call i32 @glRotatef(double 9.000000e+01, i32 1, i32 0, i32 0)
%3 = tail call i32 @glTranslatef(double 0.000000e+00, double -1.000000e+00, double 0.000000e+00)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
long llerp(long v0, long v1, long t) {
  printf("Call function "
         "llerp"
         ": ");
  return (1 - t) * v0 + t * v1;
}


x86 assembly (clang, -O0):
<llerp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
sub    -0x18(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
imul   -0x10(%rbp),%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llerp>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
sub    %r14,%rax
imul   %r15,%rax
imul   %r14,%rbx
add    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"Call function llerp: \00"
define i64 @llerp(i64 %0, i64 %1, i64 %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = sub nsw i64 1, %2
%6 = mul nsw i64 %5, %0
%7 = mul nsw i64 %2, %1
%8 = add nsw i64 %6, %7
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ init_exports();
int /*<<< orphan*/ init_func_types();
int /*<<< orphan*/ init_globals();
int /*<<< orphan*/ init_memory();
int /*<<< orphan*/ init_table();
void init(void) {
  init_func_types();
  init_globals();
  init_memory();
  init_table();
  init_exports();
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <init_func_types@plt>
mov    $0x0,%al
call   1030 <init_globals@plt>
mov    $0x0,%al
call   1060 <init_memory@plt>
mov    $0x0,%al
call   1040 <init_table@plt>
mov    $0x0,%al
call   1070 <init_exports@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
xor    %eax,%eax
call   1050 <init_func_types@plt>
xor    %eax,%eax
call   1030 <init_globals@plt>
xor    %eax,%eax
call   1060 <init_memory@plt>
xor    %eax,%eax
call   1040 <init_table@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <init_exports@plt>

LLVM IR (-O0):
define void @init() {
%1 = call i32 (...) @init_func_types()
%2 = call i32 (...) @init_globals()
%3 = call i32 (...) @init_memory()
%4 = call i32 (...) @init_table()
%5 = call i32 (...) @init_exports()
ret void
}

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @init_func_types()
%2 = tail call i32 (...) @init_globals()
%3 = tail call i32 (...) @init_memory()
%4 = tail call i32 (...) @init_table()
%5 = tail call i32 (...) @init_exports()
ret void
}
juggle(loc) int loc;
{}


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

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

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

LLVM IR (-O2):
define i32 @juggle(i32 %0) {
ret i32 undef
}
void __DELETE_java_lang_ref_ReferenceQueue(void *me, void *client_data) {}


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

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

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

LLVM IR (-O2):
define void @__DELETE_java_lang_ref_ReferenceQueue(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bswap32(int /*<<< orphan*/);
uint32_t fetch32(char *data, bool swap) {
  uint32_t tmp = *(uint32_t *)data;
  if (swap)
    tmp = bswap32(tmp);
  return tmp;
}


x86 assembly (clang, -O0):
<fetch32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113d <fetch32+0x2d>
mov    -0x10(%rbp),%edi
call   1030 <bswap32@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetch32>:
mov    (%rdi),%edi
test   %esi,%esi
je     111b <fetch32+0xb>
jmp    1030 <bswap32@plt>
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @fetch32(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = icmp eq i32 %1, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @bswap32(i32 %4)
br label %8
8: ; preds = %6, %2
%9 = phi i32 [ %7, %6 ], [ %4, %2 ]
ret i32 %9
}
void I_NoAppServicesJoinLobbyFromInvite(void) {}


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

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

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

LLVM IR (-O2):
define void @I_NoAppServicesJoinLobbyFromInvite() {
ret void
}