xunge/DecIR huggingface dataset:
int mipmap_index(int s) {
  int mip;
  mip = 0;
  s >>= 2;
  while (s) {
    s >>= 1;
    mip++;
  }
  return mip;
}


x86 assembly (clang, -O0):
<mipmap_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1138 <mipmap_index+0x38>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1117 <mipmap_index+0x17>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mipmap_index>:
xor    %eax,%eax
cmp    $0x4,%edi
jb     111c <mipmap_index+0x1c>
sar    $0x2,%edi
xor    %eax,%eax
mov    %edi,%ecx
xchg   %ax,%ax
sar    %ecx
add    $0x1,%eax
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <mipmap_index+0x10>
ret

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

LLVM IR (-O2):
define i32 @mipmap_index(i32 %0) {
%2 = icmp ult i32 %0, 4
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = ashr i32 %0, 2
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ 0, %3 ]
%7 = phi i32 [ %8, %5 ], [ %4, %3 ]
%8 = ashr i32 %7, 1
%9 = add nuw nsw i32 %6, 1
%10 = icmp ult i32 %7, 2
br i1 %10, label %11, label %5
11: ; preds = %5, %1
%12 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %12
}
/* Variables and functions */
char *luaL_check_lstr(int, long *);
scalar_t__ lua_lua2C(int);
char *luaL_opt_lstr(int numArg, char *def, long *len) {
  return (lua_lua2C(numArg) == 0) ? def : luaL_check_lstr(numArg, len);
}


x86 assembly (clang, -O0):
<luaL_opt_lstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <lua_lua2C@plt>
cmp    $0x0,%rax
jne    1152 <luaL_opt_lstr+0x32>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1162 <luaL_opt_lstr+0x42>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <luaL_check_lstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<luaL_opt_lstr>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
call   1040 <lua_lua2C@plt>
test   %rax,%rax
je     1144 <luaL_opt_lstr+0x24>
mov    %ebp,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <luaL_check_lstr@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @luaL_opt_lstr(i32 %0, i8* readnone %1, i64* %2) {
%4 = tail call i64 @lua_lua2C(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i8* @luaL_check_lstr(i32 %0, i64* %2)
br label %8
8: ; preds = %3, %6
%9 = phi i8* [ %7, %6 ], [ %1, %3 ]
ret i8* %9
}
double r16(void *x) { return *(double *)(x + 32752); }


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

x86 assembly (clang, -O2):
<r16>:
movsd  0x7ff0(%rdi),%xmm0
ret

LLVM IR (-O0):
define double @r16(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr i8, i8* %3, i64 32752
%5 = bitcast i8* %4 to double*
%6 = load double, double* %5
ret double %6
}

LLVM IR (-O2):
define double @r16(i8* nocapture %0) {
%2 = getelementptr i8, i8* %0, i64 32752
%3 = bitcast i8* %2 to double*
%4 = load double, double* %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("helloworld\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"helloworld\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct ir_remote {
  int dummy;
};

/* Variables and functions */
scalar_t__ is_rc5(struct ir_remote const *);
scalar_t__ is_rc6(struct ir_remote const *);
int is_biphase(const struct ir_remote *remote) {
  if (is_rc5(remote) || is_rc6(remote))
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<is_biphase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <is_rc5@plt>
cmp    $0x0,%rax
jne    1152 <is_biphase+0x32>
mov    -0x10(%rbp),%rdi
call   1040 <is_rc6@plt>
cmp    $0x0,%rax
je     115e <is_biphase+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    1165 <is_biphase+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_biphase>:
push   %rbx
mov    %rdi,%rbx
call   1030 <is_rc5@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1138 <is_biphase+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <is_rc6@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
%struct.ir_remote = type { i32 }
define i32 @is_biphase(%struct.ir_remote* %0) {
%2 = alloca i32
%3 = alloca %struct.ir_remote*
store %struct.ir_remote* %0, %struct.ir_remote** %3
%4 = load %struct.ir_remote*, %struct.ir_remote** %3
%5 = call i64 @is_rc5(%struct.ir_remote* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load %struct.ir_remote*, %struct.ir_remote** %3
%9 = call i64 @is_rc6(%struct.ir_remote* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 1, i32* %2
br label %13
12: ; preds = %7
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.ir_remote = type { i32 }
define i32 @is_biphase(%struct.ir_remote* %0) {
%2 = tail call i64 @is_rc5(%struct.ir_remote* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @is_rc6(%struct.ir_remote* %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
void *mmap(int /*<<< orphan*/, size_t, int /*<<< orphan*/, int /*<<< orphan*/,
           int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void *_ifo_mmap(int fd, size_t len) {
  void *ret;
  if ((ret = mmap(0, len, PROT_READ, MAP_SHARED, fd, 0)) < 0) {
    fprintf(stderr, "%s/%d: unable to mmap\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/jcsteele/dxr2-linux/refs/heads/master/"
            "player/ifo.c",
            264);
  }
  return ret;
}


x86 assembly (clang, -O0):
<_ifo_mmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    0x2ebe(%rip),%rax
mov    (%rax),%edx
mov    0x2ea5(%rip),%rax
mov    (%rax),%ecx
mov    -0x4(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1030 <mmap@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jae    1183 <_ifo_mmap+0x63>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
lea    0xe9e(%rip),%rdx
mov    $0x108,%ecx
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ifo_mmap>:
mov    %edi,%r8d
mov    0x2ede(%rip),%rax
mov    (%rax),%edx
mov    0x2ec5(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
xor    %r9d,%r9d
jmp    1030 <mmap@plt>

LLVM IR (-O0):
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"%s/%d: unable to mmap\0A\00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jcsteele/dxr2-linux/refs/heads/master/player/ifo.c\00"
define i8* @_ifo_mmap(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8*
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i32, i32* @PROT_READ
%8 = load i32, i32* @MAP_SHARED
%9 = load i32, i32* %3
%10 = call i8* @mmap(i32 0, i64 %6, i32 %7, i32 %8, i32 %9, i32 0)
store i8* %10, i8** %5
%11 = icmp ult i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 264)
br label %15
15: ; preds = %12, %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@stderr = global i32 0
define i8* @_ifo_mmap(i32 %0, i64 %1) {
%3 = load i32, i32* @PROT_READ
%4 = load i32, i32* @MAP_SHARED
%5 = tail call i8* @mmap(i32 0, i64 %1, i32 %3, i32 %4, i32 %0, i32 0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
main() { write(1, "\033]2;Title\033\\", 11); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
mov    $0xb,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"\1B]2;Title\1B\\\00"
define i32 @main() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"\1B]2;Title\1B\\\00"
define i32 @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void usage(int retval) {
  printf(
      "%s",
      "Usage: dataserver [ARGS]\n\n"
      "  --tables DIR     Specify the tables folder. Default: working "
      "directory\n"
      "  --threads NUM    Specify the number of threads for handling client\n"
      "                   connections. (default: 5)\n"
      "  --silent         Don't output any messages unless absolutely "
      "necessary.\n"
      "  --debug          Enable debugging messages.\n");
  exit(retval);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [334 x i8] c"Usage: dataserver [ARGS]\0A\0A --tables DIR Specify the tables folder. Default: working directory\0A --threads NUM Specify the number of threads for handling client\0A connections. (default: 5)\0A --silent Don't output any messages unless absolutely necessary.\0A --debug Enable debugging messages.\0A\00"
define void @usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([334 x i8], [334 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [334 x i8] c"Usage: dataserver [ARGS]\0A\0A --tables DIR Specify the tables folder. Default: working directory\0A --threads NUM Specify the number of threads for handling client\0A connections. (default: 5)\0A --silent Don't output any messages unless absolutely necessary.\0A --debug Enable debugging messages.\0A\00"
define void @usage(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([334 x i8], [334 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ print_str(char *);
int atoi(const char *s) {
  print_str("atoi not implemented\n");
  exit(1);
}


x86 assembly (clang, -O0):
<atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <print_str@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<atoi>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <print_str@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"atoi not implemented\0A\00"
define i32 @atoi(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @print_str(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [22 x i8] c"atoi not implemented\0A\00"
define i32 @atoi(i8* nocapture readnone %0) {
%2 = tail call i32 @print_str(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef scalar_t__ op;

/* Variables and functions */
int characterObjectOf(int);
int isCharacterObject(int op) {
  return op >= characterObjectOf(0) && op <= characterObjectOf(255) &&
         (((op)&3) == 0);
}


x86 assembly (clang, -O0):
<isCharacterObject>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
call   1030 <characterObjectOf@plt>
mov    -0xc(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x5(%rbp)
jl     116b <isCharacterObject+0x5b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0xff,%edi
call   1030 <characterObjectOf@plt>
mov    -0x10(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x5(%rbp)
jg     116b <isCharacterObject+0x5b>
mov    -0x4(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isCharacterObject>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <characterObjectOf@plt>
cmp    %ebp,%eax
jg     1139 <isCharacterObject+0x29>
mov    $0xff,%edi
call   1030 <characterObjectOf@plt>
cmp    %ebp,%eax
jl     1139 <isCharacterObject+0x29>
xor    %ebx,%ebx
test   $0x3,%bpl
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isCharacterObject(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @characterObjectOf(i32 0)
%5 = icmp sge i32 %3, %4
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @characterObjectOf(i32 255)
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i32, i32* %2
%12 = and i32 %11, 3
%13 = icmp eq i32 %12, 0
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ false, %6 ], [ false, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @isCharacterObject(i32 %0) {
%2 = tail call i32 @characterObjectOf(i32 0)
%3 = icmp sgt i32 %2, %0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @characterObjectOf(i32 255)
%6 = icmp slt i32 %5, %0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = and i32 %0, 3
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %10, %7 ]
ret i32 %12
}
void times_two(int *x) { *x *= 2; }


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

x86 assembly (clang, -O2):
<times_two>:
shll   (%rdi)
ret

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

LLVM IR (-O2):
define void @times_two(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl nsw i32 %2, 1
store i32 %3, i32* %0
ret void
}
void cafebabe_constant_info_name_and_type_deinit(
    struct cafebabe_constant_info_name_and_type *nat) {}


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

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

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

LLVM IR (-O2):
%struct.cafebabe_constant_info_name_and_type = type opaque
define void @cafebabe_constant_info_name_and_type_deinit(%struct.cafebabe_constant_info_name_and_type* nocapture %0) {
ret void
}
/* Variables and functions */
int foo();
void f5(int a) {
  switch (a == 3)
    break;
  switch (a != 3)
    break;
  switch (a > 3)
    break;
  switch (a < 3)
    break;
  switch (a <= 3)
    break;
  switch (a >= 3)
    break;
  switch (foo(), foo(), a >= 42)
    break;
  switch (a == 3, a & 4, a ^ 5, a)
    break;
  switch ((int)(a == 3))
    break;
  switch ((int)(a != 3))
    break;
}


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

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

LLVM IR (-O0):
define void @f5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 3
%5 = zext i1 %4 to i32
switch i32 %5, label %6 [
]
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 3
%9 = zext i1 %8 to i32
switch i32 %9, label %10 [
]
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 3
%13 = zext i1 %12 to i32
switch i32 %13, label %14 [
]
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 3
%17 = zext i1 %16 to i32
switch i32 %17, label %18 [
]
18: ; preds = %14
%19 = load i32, i32* %2
%20 = icmp sle i32 %19, 3
%21 = zext i1 %20 to i32
switch i32 %21, label %22 [
]
22: ; preds = %18
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 3
%25 = zext i1 %24 to i32
switch i32 %25, label %26 [
]
26: ; preds = %22
%27 = call i32 (...) @foo()
%28 = call i32 (...) @foo()
%29 = load i32, i32* %2
%30 = icmp sge i32 %29, 42
%31 = zext i1 %30 to i32
switch i32 %31, label %32 [
]
32: ; preds = %26
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 3
%35 = zext i1 %34 to i32
%36 = load i32, i32* %2
%37 = and i32 %36, 4
%38 = load i32, i32* %2
%39 = xor i32 %38, 5
%40 = load i32, i32* %2
switch i32 %40, label %41 [
]
41: ; preds = %32
%42 = load i32, i32* %2
%43 = icmp eq i32 %42, 3
%44 = zext i1 %43 to i32
switch i32 %44, label %45 [
]
45: ; preds = %41
%46 = load i32, i32* %2
%47 = icmp ne i32 %46, 3
%48 = zext i1 %47 to i32
switch i32 %48, label %49 [
]
49: ; preds = %45
ret void
}

LLVM IR (-O2):
define void @f5(i32 %0) {
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @foo()
ret void
}
void gtk_accel_group_from_accel_closure() {}


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

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

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

LLVM IR (-O2):
define void @gtk_accel_group_from_accel_closure() {
ret void
}
/* Type definitions */
typedef scalar_t__ int8_t;

/* Variables and functions */
void spin_unlock_xchg(int8_t *lock) { *lock = 0; }


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

x86 assembly (clang, -O2):
<spin_unlock_xchg>:
movq   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @spin_unlock_xchg(i64* nocapture writeonly %0) {
store i64 0, i64* %0
ret void
}
int main(int argc, const char *argv[]) {
  struct MyStruct {
    int a;
    int b;
  };
  struct MyStruct var = {1, 2};
  struct MyStruct x[2][2] = {{var, var}, {var, var}};
  struct {
    struct MyStruct x[2][2];
  } q;
  q.x[0][0] = x[1][1];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xee7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.MyStruct = type { i32, i32 }
%struct.anon = type { [2 x [2 x %struct.MyStruct]] }
@__const.main.var = %struct.MyStruct { i32 1, i32 2 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.MyStruct
%7 = alloca [2 x [2 x %struct.MyStruct]]
%8 = alloca %struct.anon
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast %struct.MyStruct* %6 to i8*
%10 = getelementptr inbounds [2 x [2 x %struct.MyStruct]], [2 x [2 x %struct.MyStruct]]* %7, i64 0, i64 0
%11 = getelementptr inbounds [2 x %struct.MyStruct], [2 x %struct.MyStruct]* %10, i64 0, i64 0
%12 = bitcast %struct.MyStruct* %11 to i8*
%13 = bitcast %struct.MyStruct* %6 to i8*
%14 = getelementptr inbounds %struct.MyStruct, %struct.MyStruct* %11, i64 1
%15 = bitcast %struct.MyStruct* %14 to i8*
%16 = bitcast %struct.MyStruct* %6 to i8*
%17 = getelementptr inbounds [2 x %struct.MyStruct], [2 x %struct.MyStruct]* %10, i64 1
%18 = getelementptr inbounds [2 x %struct.MyStruct], [2 x %struct.MyStruct]* %17, i64 0, i64 0
%19 = bitcast %struct.MyStruct* %18 to i8*
%20 = bitcast %struct.MyStruct* %6 to i8*
%21 = getelementptr inbounds %struct.MyStruct, %struct.MyStruct* %18, i64 1
%22 = bitcast %struct.MyStruct* %21 to i8*
%23 = bitcast %struct.MyStruct* %6 to i8*
%24 = getelementptr inbounds %struct.anon, %struct.anon* %8, i32 0, i32 0
%25 = getelementptr inbounds [2 x [2 x %struct.MyStruct]], [2 x [2 x %struct.MyStruct]]* %24, i64 0, i64 0
%26 = getelementptr inbounds [2 x %struct.MyStruct], [2 x %struct.MyStruct]* %25, i64 0, i64 0
%27 = getelementptr inbounds [2 x [2 x %struct.MyStruct]], [2 x [2 x %struct.MyStruct]]* %7, i64 0, i64 1
%28 = getelementptr inbounds [2 x %struct.MyStruct], [2 x %struct.MyStruct]* %27, i64 0, i64 1
%29 = bitcast %struct.MyStruct* %26 to i8*
%30 = bitcast %struct.MyStruct* %28 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int compare_sizes(uint32_t s1, uint32_t s2) {
  if (s1 < s2)
    return -1;
  if (s1 > s2)
    return 1;
  return 0;
}


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

x86 assembly (clang, -O2):
<compare_sizes>:
xor    %ecx,%ecx
cmp    %rsi,%rdi
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_sizes(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = icmp sgt i64 %0, %1
%5 = zext i1 %4 to i32
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
void gone() {
  int a[2];
  a[3] = 'x';
}


x86 assembly (clang, -O0):
<gone>:
push   %rbp
mov    %rsp,%rbp
movl   $0x78,0x4(%rbp)
pop    %rbp
ret

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

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

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


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

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

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

LLVM IR (-O2):
define void @assert() {
ret void
}
int main(void) {
  int i = 45, j = 3;
  return i - j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x2d,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 45, i32* %2
store i32 3, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = sub nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
ret i32 42
}
/* Variables and functions */
int SOCK_STREAM;
int /*<<< orphan*/ SO_TYPE;
int _get_socket_option(int, int /*<<< orphan*/);
int _is_stream_socket(int fd) {
  int option = _get_socket_option(fd, SO_TYPE);
  return option == -1 ? -1 : (option == SOCK_STREAM);
}


x86 assembly (clang, -O0):
<_is_stream_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <_get_socket_option@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1146 <_is_stream_socket+0x36>
mov    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <_is_stream_socket+0x4d>
mov    -0x8(%rbp),%eax
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_stream_socket>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
call   1030 <_get_socket_option@plt>
mov    0x2eb2(%rip),%rcx
xor    %edx,%edx
cmp    (%rcx),%eax
sete   %dl
cmp    $0xffffffff,%eax
cmovne %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SO_TYPE = global i32 0
@SOCK_STREAM = global i32 0
define i32 @_is_stream_socket(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @SO_TYPE
%6 = call i32 @_get_socket_option(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %10
9: ; preds = %1
br label %15
10: ; preds = %1
%11 = load i32, i32* %3
%12 = load i32, i32* @SOCK_STREAM
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %10, %9
%16 = phi i32 [ -1, %9 ], [ %14, %10 ]
ret i32 %16
}

LLVM IR (-O2):
@SO_TYPE = global i32 0
@SOCK_STREAM = global i32 0
define i32 @_is_stream_socket(i32 %0) {
%2 = load i32, i32* @SO_TYPE
%3 = tail call i32 @_get_socket_option(i32 %0, i32 %2)
%4 = icmp eq i32 %3, -1
%5 = load i32, i32* @SOCK_STREAM
%6 = icmp eq i32 %3, %5
%7 = zext i1 %6 to i32
%8 = select i1 %4, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void exit_tool(int status) { exit(status); }


x86 assembly (clang, -O0):
<exit_tool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<exit_tool>:
push   %rax
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @exit_tool(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
void print_inst_ST_RS_RS_RD(char *mnemonic, int rd, int rs1, int rs2) { ; }


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

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

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

LLVM IR (-O2):
define void @print_inst_ST_RS_RS_RD(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int same_screen;
};
struct TYPE_4__ {
  TYPE_1__ xkey;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xkey_same_screen(void *_p, int _v) {
  ((XEvent *)_p)->xkey.same_screen = (int)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xkey_same_screen(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xkey_same_screen(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
float nvEasef(float t) {
  float t_2 = t * t;
  float t_3 = t_2 * t;
  return 3.0f * t_2 - 2.0f * t_3;
}


x86 assembly (clang, -O0):
<nvEasef>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xed0(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  0xeb2(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvEasef>:
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm1,%xmm0
addss  %xmm0,%xmm0
mulss  0xee9(%rip),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @nvEasef(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = load float, float* %2
%7 = fmul float %5, %6
store float %7, float* %3
%8 = load float, float* %3
%9 = load float, float* %2
%10 = fmul float %8, %9
store float %10, float* %4
%11 = load float, float* %3
%12 = load float, float* %4
%13 = fmul float 2.000000e+00, %12
%14 = fneg float %13
%15 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %11, float %14)
ret float %15
}

LLVM IR (-O2):
define float @nvEasef(float %0) {
%2 = fmul float %0, %0
%3 = fmul float %2, %0
%4 = fmul float %3, -2.000000e+00
%5 = tail call float @llvm.fmuladd.f32(float %2, float 3.000000e+00, float %4)
ret float %5
}
int adreno_iommu_set_pt_ctx(struct adreno_ringbuffer *rb,
                            struct kgsl_pagetable *new_pt,
                            struct adreno_context *drawctxt,
                            unsigned long flags) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.adreno_ringbuffer = type opaque
%struct.kgsl_pagetable = type opaque
%struct.adreno_context = type opaque
define i32 @adreno_iommu_set_pt_ctx(%struct.adreno_ringbuffer* %0, %struct.kgsl_pagetable* %1, %struct.adreno_context* %2, i64 %3) {
%5 = alloca %struct.adreno_ringbuffer*
%6 = alloca %struct.kgsl_pagetable*
%7 = alloca %struct.adreno_context*
%8 = alloca i64
store %struct.adreno_ringbuffer* %0, %struct.adreno_ringbuffer** %5
store %struct.kgsl_pagetable* %1, %struct.kgsl_pagetable** %6
store %struct.adreno_context* %2, %struct.adreno_context** %7
store i64 %3, i64* %8
ret i32 0
}

LLVM IR (-O2):
%struct.adreno_ringbuffer = type opaque
%struct.kgsl_pagetable = type opaque
%struct.adreno_context = type opaque
define i32 @adreno_iommu_set_pt_ctx(%struct.adreno_ringbuffer* nocapture readnone %0, %struct.kgsl_pagetable* nocapture readnone %1, %struct.adreno_context* nocapture readnone %2, i64 %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cp_ctype_init();
void ffi_cparser_init(void) { cp_ctype_init(); }


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

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

LLVM IR (-O0):
define void @ffi_cparser_init() {
%1 = call i32 (...) @cp_ctype_init()
ret void
}

LLVM IR (-O2):
define void @ffi_cparser_init() {
%1 = tail call i32 (...) @cp_ctype_init()
ret void
}
void foo_with_default_visibility() {}


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

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

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

LLVM IR (-O2):
define void @foo_with_default_visibility() {
ret void
}
/* Variables and functions */
bool nativeInvert(bool value) { return !value; }


x86 assembly (clang, -O0):
<nativeInvert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nativeInvert>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @nativeInvert(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @nativeInvert(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
unsigned int calc_bytes(unsigned int num_of_bits) {
  unsigned int size = sizeof(unsigned char);
  if ((num_of_bits % size) == 0) {
    return num_of_bits / size;
  } else {
    return (num_of_bits / size) + 1;
  }
}


x86 assembly (clang, -O0):
<calc_bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
jne    112f <calc_bytes+0x2f>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %eax,-0x4(%rbp)
jmp    113d <calc_bytes+0x3d>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @calc_bytes(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dssum(int, float *, int);
int main() {
  float x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dssum(N, x, stride);
  printf("sum: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1040 <stdlib_strided_dssum@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dssum@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [10 x i8] c"sum: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x float]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dssum(i32 %6, float* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [10 x i8] c"sum: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = bitcast [8 x float]* %1 to i8*
%3 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dssum(i32 4, float* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dlclose(void *);
void dllUnload(void *handle) {
  if (handle)
    dlclose(handle);
}


x86 assembly (clang, -O0):
<dllUnload>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <dllUnload+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <dlclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @dllUnload(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 %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @dlclose(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @dllUnload(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @dlclose(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void f(int x) { assert(x != 0); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
mov    %eax,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret void
}

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(int /*<<< orphan*/);
int badname(const char *name) {
  while (*name) {
    if (!isdigit(*name++))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<badname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115a <badname+0x4a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1155 <badname+0x45>
movl   $0x1,-0x4(%rbp)
jmp    1161 <badname+0x51>
jmp    111c <badname+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<badname>:
movsbl (%rdi),%eax
test   %eax,%eax
je     1119 <badname+0x19>
add    $0x1,%rdi
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     1100 <badname>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @badname(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = sext i8 %4 to i32
%9 = add nsw i32 %8, -48
%10 = icmp ult i32 %9, 10
br i1 %10, label %2, label %11
11: ; preds = %2, %6
%12 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %12
}
int sortitem_cmp(const void *a, const void *b) {
  const struct {
    int dupes;
    int lineno;
  } *a1 = a, *b1 = b;
  int ret = b1->dupes - a1->dupes;
  if (ret == 0)
    return a1->lineno - b1->lineno;
  return ret;
}


x86 assembly (clang, -O0):
<sortitem_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    114b <sortitem_cmp+0x4b>
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x28(%rbp),%rcx
sub    0x4(%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <sortitem_cmp+0x51>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortitem_cmp>:
mov    (%rsi),%eax
sub    (%rdi),%eax
je     1107 <sortitem_cmp+0x7>
ret
mov    0x4(%rdi),%eax
sub    0x4(%rsi),%eax
ret

LLVM IR (-O0):
%struct.anon = type { i32, i32 }
define i32 @sortitem_cmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.anon*
%7 = alloca %struct.anon*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to %struct.anon*
store %struct.anon* %10, %struct.anon** %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to %struct.anon*
store %struct.anon* %12, %struct.anon** %7
%13 = load %struct.anon*, %struct.anon** %7
%14 = getelementptr inbounds %struct.anon, %struct.anon* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = load %struct.anon*, %struct.anon** %6
%17 = getelementptr inbounds %struct.anon, %struct.anon* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = sub nsw i32 %15, %18
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %2
%23 = load %struct.anon*, %struct.anon** %6
%24 = getelementptr inbounds %struct.anon, %struct.anon* %23, i32 0, i32 1
%25 = load i32, i32* %24
%26 = load %struct.anon*, %struct.anon** %7
%27 = getelementptr inbounds %struct.anon, %struct.anon* %26, i32 0, i32 1
%28 = load i32, i32* %27
%29 = sub nsw i32 %25, %28
store i32 %29, i32* %3
br label %32
30: ; preds = %2
%31 = load i32, i32* %8
store i32 %31, i32* %3
br label %32
32: ; preds = %30, %22
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @sortitem_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = getelementptr inbounds i8, i8* %0, i64 4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = getelementptr inbounds i8, i8* %1, i64 4
%14 = bitcast i8* %13 to i32*
%15 = load i32, i32* %14
%16 = sub nsw i32 %12, %15
br label %17
17: ; preds = %2, %9
%18 = phi i32 [ %16, %9 ], [ %7, %2 ]
ret i32 %18
}
int *__attribute__((no, noclone)) baz(int *p) { return p; }


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

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

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

LLVM IR (-O2):
define i32* @baz(i32* readnone returned %0) {
ret i32* %0
}