xunge/DecIR huggingface dataset:
int updateCount(int val, int count) {
  if ((val > 2) && (val < 7)) {
    count++;
  } else if (val == 10) {
    count--;
  }
  return count;
}


x86 assembly (clang, -O0):
<updateCount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x2,-0x4(%rbp)
jle    112c <updateCount+0x2c>
cmpl   $0x7,-0x4(%rbp)
jge    112c <updateCount+0x2c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <updateCount+0x44>
cmpl   $0xa,-0x4(%rbp)
jne    113f <updateCount+0x3f>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <updateCount+0x44>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateCount>:
lea    -0x3(%rdi),%eax
xor    %ecx,%ecx
cmp    $0xa,%edi
sete   %cl
neg    %ecx
cmp    $0x4,%eax
mov    $0x1,%eax
cmovae %ecx,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @updateCount(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 = icmp sgt i32 %5, 2
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 7
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
br label %20
13: ; preds = %7, %2
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
store i32 %18, i32* %4
br label %19
19: ; preds = %16, %13
br label %20
20: ; preds = %19, %10
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
define i32 @updateCount(i32 %0, i32 %1) {
%3 = add i32 %0, -3
%4 = icmp ult i32 %3, 4
%5 = icmp eq i32 %0, 10
%6 = sext i1 %5 to i32
%7 = select i1 %4, i32 1, i32 %6
%8 = add nsw i32 %7, %1
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ c();
int /*<<< orphan*/ d();
void b() {
  c();
  d();
}


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

x86 assembly (clang, -O2):
<b>:
push   %rax
xor    %eax,%eax
call   1040 <c@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <d@plt>

LLVM IR (-O0):
define void @b() {
%1 = call i32 (...) @c()
%2 = call i32 (...) @d()
ret void
}

LLVM IR (-O2):
define void @b() {
%1 = tail call i32 (...) @c()
%2 = tail call i32 (...) @d()
ret void
}
/* Variables and functions */
int get_add1(int, int, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void print_add1(int a, int b, int mask) {
  int f, r;
  f = get_add1(a, b, &r);
  f &= mask;
  printf("add"
         " 1"
         " %08x %08x %08x %08x %08x\n",
         a, b, r, f, mask);
}


x86 assembly (clang, -O0):
<print_add1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x14(%rbp),%rdx
call   1040 <get_add1@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0xc(%rbp),%r9d
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_add1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xc(%rsp),%rdx
call   1040 <get_add1@plt>
and    %r14d,%eax
mov    0xc(%rsp),%ecx
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"add 1 %08x %08x %08x %08x %08x\0A\00"
define void @print_add1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @get_add1(i32 %9, i32 %10, i32* %8)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = and i32 %13, %12
store i32 %14, i32* %7
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"add 1 %08x %08x %08x %08x %08x\0A\00"
define void @print_add1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @get_add1(i32 %0, i32 %1, i32* %4)
%7 = and i32 %6, %2
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %8, i32 %7, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(size_t);
int wcslen(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *wmemcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                            size_t);
wchar_t *wcsdup(const wchar_t *string) {
  size_t n = wcslen(string) + 1;
  wchar_t *r = malloc(n * sizeof(char));
  return r == NULL ? NULL : wmemcpy(r, string, n);
}


x86 assembly (clang, -O0):
<wcsdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <wcslen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1175 <wcsdup+0x45>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    118a <wcsdup+0x5a>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <wmemcpy@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <wcslen@plt>
add    $0x1,%eax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1164 <wcsdup+0x34>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <wmemcpy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @wcsdup(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i32*
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @wcslen(i32* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = mul i64 %9, 1
%11 = call i32* @malloc(i64 %10)
store i32* %11, i32** %4
%12 = load i32*, i32** %4
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %15
14: ; preds = %1
br label %20
15: ; preds = %1
%16 = load i32*, i32** %4
%17 = load i32*, i32** %2
%18 = load i64, i64* %3
%19 = call i32* @wmemcpy(i32* %16, i32* %17, i64 %18)
br label %20
20: ; preds = %15, %14
%21 = phi i32* [ null, %14 ], [ %19, %15 ]
ret i32* %21
}

LLVM IR (-O2):
define i32* @wcsdup(i32* %0) {
%2 = tail call i32 @wcslen(i32* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i32* @malloc(i64 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32* @wmemcpy(i32* %5, i32* %0, i64 %4)
br label %9
9: ; preds = %1, %7
%10 = phi i32* [ %8, %7 ], [ null, %1 ]
ret i32* %10
}
/* Type definitions */
struct ssds_class {
  int dummy;
};

/* Variables and functions */
void *ssds_find_field_new(struct ssds_class *, char *, int, int,
                          int /*<<< orphan*/ *);
void *ssds_find_field(struct ssds_class *pclass, char *name, int f_type,
                      int len) {
  return ssds_find_field_new(pclass, name, f_type, len, NULL);
}


x86 assembly (clang, -O0):
<ssds_find_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <ssds_find_field_new@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_find_field>:
xor    %r8d,%r8d
jmp    1030 <ssds_find_field_new@plt>

LLVM IR (-O0):
%struct.ssds_class = type { i32 }
define i8* @ssds_find_field(%struct.ssds_class* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.ssds_class*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store %struct.ssds_class* %0, %struct.ssds_class** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.ssds_class*, %struct.ssds_class** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i8* @ssds_find_field_new(%struct.ssds_class* %9, i8* %10, i32 %11, i32 %12, i32* null)
ret i8* %13
}

LLVM IR (-O2):
%struct.ssds_class = type { i32 }
define i8* @ssds_find_field(%struct.ssds_class* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i8* @ssds_find_field_new(%struct.ssds_class* %0, i8* %1, i32 %2, i32 %3, i32* null)
ret i8* %5
}
int numanuma__get_num_nodes(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @numanuma__get_num_nodes() {
ret i32 1
}

LLVM IR (-O2):
define i32 @numanuma__get_num_nodes() {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL_CTX;

/* Variables and functions */
int /*<<< orphan*/ *SSL_CTX_new(int /*<<< orphan*/);
int /*<<< orphan*/ SSLv23_client_method();
SSL_CTX *zopenssl_create_SSL_CTX_client(void) {
  return SSL_CTX_new(SSLv23_client_method());
}


x86 assembly (clang, -O0):
<zopenssl_create_SSL_CTX_client>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <SSLv23_client_method@plt>
mov    %eax,%edi
call   1040 <SSL_CTX_new@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32* @zopenssl_create_SSL_CTX_client() {
%1 = call i32 (...) @SSLv23_client_method()
%2 = call i32* @SSL_CTX_new(i32 %1)
ret i32* %2
}

LLVM IR (-O2):
define i32* @zopenssl_create_SSL_CTX_client() {
%1 = tail call i32 (...) @SSLv23_client_method()
%2 = tail call i32* @SSL_CTX_new(i32 %1)
ret i32* %2
}
int pOponente(int j) {
  if (j == 1) {
    return 4;
  } else {
    return 2;
  }
}


x86 assembly (clang, -O0):
<pOponente>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111d <pOponente+0x1d>
movl   $0x4,-0x4(%rbp)
jmp    1124 <pOponente+0x24>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pOponente>:
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
add    %eax,%eax
add    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @pOponente(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i32 4, i32 2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ HwDiscoveryF4Handle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void HwDiscoveryF4RequestUpdate() {
  UAVObjRequestUpdate(HwDiscoveryF4Handle());
}


x86 assembly (clang, -O0):
<HwDiscoveryF4RequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HwDiscoveryF4Handle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @HwDiscoveryF4RequestUpdate() {
%1 = call i32 (...) @HwDiscoveryF4Handle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @HwDiscoveryF4RequestUpdate() {
%1 = tail call i32 (...) @HwDiscoveryF4Handle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  write(1, "Hello\n", 6);
  write(1, "World\n", 6);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
lea    0xed5(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
mov    $0x1,%edi
lea    0xec6(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
mov    $0x6,%edx
call   1030 <write@plt>
lea    0xed9(%rip),%rsi
mov    $0x1,%edi
mov    $0x6,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Hello\0A\00"
@.str.1 = [7 x i8] c"World\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%6 = call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"Hello\0A\00"
@.str.1 = [7 x i8] c"World\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%4 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
ret i32 0
}
int msm_ipc_check_send_permissions(void *data) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @msm_ipc_check_send_permissions(i8* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
char *strcat(char *, char *);
void test2(char *to, int to_size, char *from) {
  memset(to, 'z', to_size);
  char *r = strcat(to, from);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x7a,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
mov    %rax,-0x20(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%edx
mov    %rdi,%rbx
mov    $0x7a,%esi
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcat@plt>

LLVM IR (-O0):
define void @test2(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call i32 @memset(i8* %8, i8 signext 122, i32 %9)
%11 = load i8*, i8** %4
%12 = load i8*, i8** %6
%13 = call i8* @strcat(i8* %11, i8* %12)
store i8* %13, i8** %7
ret void
}

LLVM IR (-O2):
define void @test2(i8* %0, i32 %1, i8* nocapture %2) {
%4 = tail call i32 @memset(i8* %0, i8 signext 122, i32 %1)
%5 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %2)
ret void
}
/* Variables and functions */
unsigned int iran32_r(unsigned int *, unsigned int *);
float fran32_r(unsigned *pstate0, unsigned *pstate1) {
  unsigned word = iran32_r(pstate0, pstate1);
  return (float)((double)word / (double)4294967296.0);
}


x86 assembly (clang, -O0):
<fran32_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <iran32_r@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xec0(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fran32_r>:
push   %rax
call   1030 <iran32_r@plt>
mov    %eax,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xedb(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fran32_r(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32*, i32** %4
%8 = call i32 @iran32_r(i32* %6, i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = uitofp i32 %9 to double
%11 = fdiv double %10, 0x41F0000000000000
%12 = fptrunc double %11 to float
ret float %12
}

LLVM IR (-O2):
define float @fran32_r(i32* %0, i32* %1) {
%3 = tail call i32 @iran32_r(i32* %0, i32* %1)
%4 = uitofp i32 %3 to double
%5 = fmul double %4, 0x3DF0000000000000
%6 = fptrunc double %5 to float
ret float %6
}
/* Variables and functions */
int get_random(int);
int get_random_range(int n, int m) {
  int x;
  x = get_random(m - n);
  x = x + n;
  return x;
}


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

x86 assembly (clang, -O2):
<get_random_range>:
push   %rbx
mov    %edi,%ebx
sub    %edi,%esi
mov    %esi,%edi
call   1030 <get_random@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_random_range(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* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = call i32 @get_random(i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @get_random_range(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = tail call i32 @get_random(i32 %3)
%5 = add nsw i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void my_fb_close(int shm_fd) { close(shm_fd); }


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

x86 assembly (clang, -O2):
<my_fb_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @my_fb_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void null_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r,
                     uint8_t n) {
  return;
}


x86 assembly (clang, -O0):
<null_set_sector>:
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    %r9d,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @null_set_sector(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
ret void
}
void lower_zone_protection_sysctl_handler(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<lower_zone_protection_sysctl_handler>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower_zone_protection_sysctl_handler>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.lower_zone_protection_sysctl_handler = [37 x i8] c"lower_zone_protection_sysctl_handler\00"
define void @lower_zone_protection_sysctl_handler() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @__func__.lower_zone_protection_sysctl_handler, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.lower_zone_protection_sysctl_handler = [37 x i8] c"lower_zone_protection_sysctl_handler\00"
define void @lower_zone_protection_sysctl_handler() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @__func__.lower_zone_protection_sysctl_handler, i64 0, i64 0))
ret void
}
int tegra_cpu_process_id(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tegra_cpu_process_id() {
ret i32 0
}
/* Variables and functions */
scalar_t__ ceil(float);
scalar_t__ floor(float);
long lroundf(float t) {
  return t >= 0.0 ? (long)floor(t + 0.5) : (long)ceil(t - 0.5);
}


x86 assembly (clang, -O0):
<lroundf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116a <lroundf+0x4a>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeac(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <floor@plt>
mov    %rax,-0x10(%rbp)
jmp    118c <lroundf+0x6c>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe85(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <ceil@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lroundf>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jae    1135 <lroundf+0x15>
addss  0xed4(%rip),%xmm0
jmp    1030 <ceil@plt>
addss  0xec3(%rip),%xmm0
jmp    1040 <floor@plt>

LLVM IR (-O0):
define i64 @lroundf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fadd double %8, 5.000000e-01
%10 = fptrunc double %9 to float
%11 = call i64 @floor(float %10)
br label %18
12: ; preds = %1
%13 = load float, float* %2
%14 = fpext float %13 to double
%15 = fsub double %14, 5.000000e-01
%16 = fptrunc double %15 to float
%17 = call i64 @ceil(float %16)
br label %18
18: ; preds = %12, %6
%19 = phi i64 [ %11, %6 ], [ %17, %12 ]
ret i64 %19
}

LLVM IR (-O2):
define i64 @lroundf(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = fadd float %0, 5.000000e-01
%5 = tail call i64 @floor(float %4)
br label %9
6: ; preds = %1
%7 = fadd float %0, -5.000000e-01
%8 = tail call i64 @ceil(float %7)
br label %9
9: ; preds = %6, %3
%10 = phi i64 [ %5, %3 ], [ %8, %6 ]
ret i64 %10
}
void QEIEnable(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000000))) |= 0x00000001;
}


x86 assembly (clang, -O0):
<QEIEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIEnable>:
orq    $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @QEIEnable(i64 %0) {
%2 = inttoptr i64 %0 to i64*
%3 = load volatile i64, i64* %2
%4 = or i64 %3, 1
store volatile i64 %4, i64* %2
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t rtp_6184_stap_get_size(const uint8_t *header) {
  return (header[0] << 8) | header[1];
}


x86 assembly (clang, -O0):
<rtp_6184_stap_get_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp_6184_stap_get_size>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rtp_6184_stap_get_size(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @rtp_6184_stap_get_size(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int imax(double, ...);
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  printf("The maximum of %d and %d is %d.\n", 3, 5, imax(3));
  printf("The maxiumumof %d and %d is %d.\n", 3, 5, imax(3.0, 5.0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
mov    $0x1,%al
call   1040 <imax@plt>
mov    %eax,%ecx
lea    0xec9(%rip),%rdi
mov    $0x3,%esi
mov    $0x5,%edx
call   1030 <printf@plt>
movsd  0xea2(%rip),%xmm0
movsd  0xea2(%rip),%xmm1
mov    $0x2,%al
call   1040 <imax@plt>
mov    %eax,%ecx
lea    0xebb(%rip),%rdi
mov    $0x3,%esi
mov    $0x5,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
mov    $0x1,%al
call   1040 <imax@plt>
lea    0xed9(%rip),%rdi
mov    $0x3,%esi
mov    $0x5,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
movsd  0xeb8(%rip),%xmm1
movsd  0xea8(%rip),%xmm0
mov    $0x2,%al
call   1040 <imax@plt>
lea    0xecb(%rip),%rdi
mov    $0x3,%esi
mov    $0x5,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"The maximum of %d and %d is %d.\0A\00"
@.str.1 = [33 x i8] c"The maxiumumof %d and %d is %d.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (double, ...) @imax(double 3.000000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 3, i32 5, i32 %2)
%4 = call i32 (double, ...) @imax(double 3.000000e+00, double 5.000000e+00)
%5 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"The maximum of %d and %d is %d.\0A\00"
@.str.1 = [33 x i8] c"The maxiumumof %d and %d is %d.\0A\00"
define i32 @main() {
%1 = tail call i32 (double, ...) @imax(double 3.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 3, i32 5, i32 %1)
%3 = tail call i32 (double, ...) @imax(double 3.000000e+00, double 5.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EV_SYN;
int /*<<< orphan*/ SYN_REPORT;
int ev_emit(int, int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int ev_syn(int fd) { return ev_emit(fd, EV_SYN, SYN_REPORT, 0); }


x86 assembly (clang, -O0):
<ev_syn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ecb(%rip),%rax
mov    (%rax),%esi
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1030 <ev_emit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ev_syn>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%esi
mov    0x2ec0(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
jmp    1030 <ev_emit@plt>

LLVM IR (-O0):
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define i32 @ev_syn(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @EV_SYN
%5 = load i32, i32* @SYN_REPORT
%6 = call i32 @ev_emit(i32 %3, i32 %4, i32 %5, i32 0)
ret i32 %6
}

LLVM IR (-O2):
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define i32 @ev_syn(i32 %0) {
%2 = load i32, i32* @EV_SYN
%3 = load i32, i32* @SYN_REPORT
%4 = tail call i32 @ev_emit(i32 %0, i32 %2, i32 %3, i32 0)
ret i32 %4
}
int test_imm_39int16_mem(short *val) {
  return ((*val) & (-0x39 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_39int16_mem>:
movzwl (%rdi),%eax
test   $0xffc7,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_39int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -57
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned int CallDrvPlain(int, int, int /*<<< orphan*/, int /*<<< orphan*/,
                          unsigned int, unsigned int, int /*<<< orphan*/,
                          int /*<<< orphan*/, void *, void *);
unsigned int CgosBoardCount(unsigned int dwClass, unsigned int dwFlags) {
  return CallDrvPlain(1, 2, 0, 0, dwClass, dwFlags, 0, 0, ((void *)0),
                      ((void *)0));
}


x86 assembly (clang, -O0):
<CgosBoardCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%r8d
mov    -0x8(%rbp),%r9d
mov    $0x1,%edi
mov    $0x2,%esi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %ecx,%edx
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x18(%rsp)
call   1030 <CallDrvPlain@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CgosBoardCount>:
sub    $0x28,%rsp
mov    %esi,%r9d
mov    %edi,%r8d
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,(%rsp)
mov    $0x1,%edi
mov    $0x2,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <CallDrvPlain@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @CgosBoardCount(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 = call i32 @CallDrvPlain(i32 1, i32 2, i32 0, i32 0, i32 %5, i32 %6, i32 0, i32 0, i8* null, i8* null)
ret i32 %7
}

LLVM IR (-O2):
define i32 @CgosBoardCount(i32 %0, i32 %1) {
%3 = tail call i32 @CallDrvPlain(i32 1, i32 2, i32 0, i32 0, i32 %0, i32 %1, i32 0, i32 0, i8* null, i8* null)
ret i32 %3
}
int netif_rx(struct sk_buff *skb) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.sk_buff = type opaque
define i32 @netif_rx(%struct.sk_buff* nocapture readnone %0) {
ret i32 0
}
unsigned long unsignedLongTest(unsigned long value) { return value; }


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

x86 assembly (clang, -O2):
<unsignedLongTest>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @unsignedLongTest(i64 returned %0) {
ret i64 %0
}
/* Type definitions */
struct lwan_array {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct lwan_array *);
int /*<<< orphan*/ lwan_array_reset(struct lwan_array *, int /*<<< orphan*/ *);
void coro_lwan_array_free_heap(void *data) {
  struct lwan_array *array = data;
  lwan_array_reset(array, NULL);
  free(array);
}


x86 assembly (clang, -O0):
<coro_lwan_array_free_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <lwan_array_reset@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coro_lwan_array_free_heap>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1040 <lwan_array_reset@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.lwan_array = type { i32 }
define void @coro_lwan_array_free_heap(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.lwan_array*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.lwan_array*
store %struct.lwan_array* %5, %struct.lwan_array** %3
%6 = load %struct.lwan_array*, %struct.lwan_array** %3
%7 = call i32 @lwan_array_reset(%struct.lwan_array* %6, i32* null)
%8 = load %struct.lwan_array*, %struct.lwan_array** %3
%9 = call i32 @free(%struct.lwan_array* %8)
ret void
}

LLVM IR (-O2):
%struct.lwan_array = type { i32 }
define void @coro_lwan_array_free_heap(i8* %0) {
%2 = bitcast i8* %0 to %struct.lwan_array*
%3 = tail call i32 @lwan_array_reset(%struct.lwan_array* %2, i32* null)
%4 = tail call i32 @free(%struct.lwan_array* %2)
ret void
}
Quit() {}


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

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

LLVM IR (-O0):
define i32 @Quit() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @Quit() {
ret i32 undef
}
/* Variables and functions */
unsigned long GetAudioVol301(unsigned long);
unsigned long getaudiovol(unsigned long id) { return GetAudioVol301(id); }


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

x86 assembly (clang, -O2):
<getaudiovol>:
jmp    1030 <GetAudioVol301@plt>

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

LLVM IR (-O2):
define i64 @getaudiovol(i64 %0) {
%2 = tail call i64 @GetAudioVol301(i64 %0)
ret i64 %2
}
void DCR_writew(unsigned short value) { ; }


x86 assembly (clang, -O0):
<DCR_writew>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @DCR_writew(i16 zeroext %0) {
ret void
}
void rop3_247_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D & S;
  stk2 = ~stk2;
  stk1 = T | stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_247_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_247_1_1>:
mov    (%rdi),%al
mov    %eax,%ecx
and    %sil,%cl
or     %dl,%sil
not    %sil
or     %cl,%sil
and    %dl,%al
or     %sil,%al
mov    %al,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_247_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
%6 = or i8 %2, %1
%7 = xor i8 %6, -1
%8 = or i8 %5, %7
%9 = and i8 %4, %2
%10 = or i8 %8, %9
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
void memset_bad2() {
  int arr[10];
  memset(arr, 0, -1);
}


x86 assembly (clang, -O0):
<memset_bad2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1030 <memset@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset_bad2>:
sub    $0x28,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1030 <memset@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @memset_bad2() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%3 = call i32 @memset(i32* %2, i32 0, i32 -1)
ret void
}

LLVM IR (-O2):
define void @memset_bad2() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 0, i32 -1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *name) {
  printf("Usage:\n");
  printf("%s [IP | HOSTNAME]\n", name);
  printf("Ipv4/6 compatible.\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [20 x i8] c"%s [IP | HOSTNAME]\0A\00"
@.str.2 = [20 x i8] c"Ipv4/6 compatible.\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"%s [IP | HOSTNAME]\0A\00"
@EXIT_FAILURE = global i32 0
@str = [7 x i8] c"Usage:\00"
@str.3 = [19 x i8] c"Ipv4/6 compatible.\00"
define void @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.3, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *xmalloc(size_t size) {
  void *p = malloc(size);
  if (p == NULL) {
    perror("malloc failed");
    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    1167 <xmalloc+0x37>
lea    0xea5(%rip),%rdi
call   1050 <perror@plt>
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     113d <xmalloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"malloc failed\00"
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 eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [14 x i8] c"malloc failed\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
ret i8* %2
}
unsigned int mmugetpagesize(unsigned int k) {
  int psz = 0;
  if (((k >> 24) & 0xf) >= 1) {
    psz = (k >> 16) & 0x3;
  }
  return psz;
}


x86 assembly (clang, -O0):
<mmugetpagesize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
and    $0xf,%eax
cmp    $0x1,%eax
jb     112c <mmugetpagesize+0x2c>
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmugetpagesize>:
mov    %edi,%eax
and    $0xf000000,%eax
shr    $0x10,%edi
and    $0x3,%edi
test   %eax,%eax
cmovne %edi,%eax
ret

LLVM IR (-O0):
define i32 @mmugetpagesize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = lshr i32 %4, 24
%6 = and i32 %5, 15
%7 = icmp uge i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* %2
%10 = lshr i32 %9, 16
%11 = and i32 %10, 3
store i32 %11, i32* %3
br label %12
12: ; preds = %8, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @mmugetpagesize(i32 %0) {
%2 = and i32 %0, 251658240
%3 = icmp eq i32 %2, 0
%4 = lshr i32 %0, 16
%5 = and i32 %4, 3
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Variables and functions */
char *strchr(char *, char);
char *extractuser(char *mailaddress) {
  char *end;
  if ((end = strchr(mailaddress, '@')) != NULL) {
    *end = '\0';
  }
  return mailaddress;
}


x86 assembly (clang, -O0):
<extractuser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x40,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     113f <extractuser+0x2f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractuser>:
push   %rbx
mov    %rdi,%rbx
mov    $0x40,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1126 <extractuser+0x16>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @extractuser(i8* returned %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 64)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
ret i8* %0
}