xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage:  jfs_fsck <volumename>\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: jfs_fsck <volumename>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: jfs_fsck <volumename>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int rep_clz(int);
int normalize(unsigned *significand) {
  const int shift = rep_clz(*significand) - rep_clz(((1) << 23));
  *significand <<= shift;
  return 1 - shift;
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <rep_clz@plt>
mov    %eax,-0x10(%rbp)
mov    $0x800000,%edi
call   1030 <rep_clz@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
shl    %cl,%edx
mov    %edx,%ecx
mov    %ecx,(%rax)
mov    $0x1,%eax
sub    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <rep_clz@plt>
mov    %eax,%ebp
mov    $0x800000,%edi
call   1030 <rep_clz@plt>
sub    %eax,%ebp
mov    %ebp,%ecx
shll   %cl,(%rbx)
mov    $0x1,%eax
sub    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @normalize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = call i32 @rep_clz(i32 %5)
%7 = call i32 @rep_clz(i32 8388608)
%8 = sub nsw i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = shl i32 %11, %9
store i32 %12, i32* %10
%13 = load i32, i32* %3
%14 = sub nsw i32 1, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @normalize(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @rep_clz(i32 %2)
%4 = tail call i32 @rep_clz(i32 8388608)
%5 = sub nsw i32 %3, %4
%6 = load i32, i32* %0
%7 = shl i32 %6, %5
store i32 %7, i32* %0
%8 = sub nsw i32 1, %5
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
size_t write(int, void const *, size_t);
void Write(int fd, const void *buf, size_t count) {
  if (write(fd, buf, count) != count)
    err_sys("write error");
}


x86 assembly (clang, -O0):
<Write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <write@plt>
cmp    -0x18(%rbp),%rax
je     1159 <Write+0x39>
lea    0xeac(%rip),%rdi
call   1030 <err_sys@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Write>:
push   %rbx
mov    %rdx,%rbx
call   1040 <write@plt>
cmp    %rbx,%rax
jne    1130 <Write+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
pop    %rbx
jmp    1030 <err_sys@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"write error\00"
define void @Write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @write(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @err_sys(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PrintErrorCode();
int dxl_read_byte(int, int);
void getP(int ID) {
  int pVal;
  pVal = dxl_read_byte(ID, 26);
  PrintErrorCode();
}


x86 assembly (clang, -O0):
<getP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1a,%esi
call   1040 <dxl_read_byte@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <PrintErrorCode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getP>:
push   %rax
mov    $0x1a,%esi
call   1040 <dxl_read_byte@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <PrintErrorCode@plt>

LLVM IR (-O0):
define void @getP(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @dxl_read_byte(i32 %4, i32 26)
store i32 %5, i32* %3
%6 = call i32 (...) @PrintErrorCode()
ret void
}

LLVM IR (-O2):
define void @getP(i32 %0) {
%2 = tail call i32 @dxl_read_byte(i32 %0, i32 26)
%3 = tail call i32 (...) @PrintErrorCode()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int number;
  printf("Type in your number: ");
  scanf("%i", &number);
  if (number < 0)
    number = -number;
  printf("The absolute value is %i\n", number);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    115f <main+0x3f>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jns    114e <main+0x2e>
neg    %esi
mov    %esi,0x4(%rsp)
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Type in your number: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [26 x i8] c"The absolute value is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Type in your number: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [26 x i8] c"The absolute value is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = sub nsw i32 0, %5
store i32 %8, i32* %1
br label %9
9: ; preds = %7, %0
%10 = phi i32 [ %8, %7 ], [ %5, %0 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}
int get_cell_idx(int cell0, int val, int step, int ncell) {
  int idx;
  idx = (int)((val - cell0) / step);
  if (idx < 0)
    return 0;
  else if (idx > ncell - 1)
    return ncell - 1;
  return idx;
}


x86 assembly (clang, -O0):
<get_cell_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1133 <get_cell_idx+0x33>
movl   $0x0,-0x4(%rbp)
jmp    115d <get_cell_idx+0x5d>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    1152 <get_cell_idx+0x52>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115d <get_cell_idx+0x5d>
jmp    1157 <get_cell_idx+0x57>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cell_idx>:
mov    %edx,%r8d
mov    %esi,%eax
sub    %edi,%eax
cltd
idiv   %r8d
lea    -0x1(%rcx),%edx
cmp    %ecx,%eax
cmovl  %eax,%edx
xor    %ecx,%ecx
test   %eax,%eax
cmovns %edx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_cell_idx(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %1, %0
%6 = sdiv i32 %5, %2
%7 = icmp slt i32 %6, 0
%8 = icmp slt i32 %6, %3
%9 = add nsw i32 %3, -1
%10 = select i1 %8, i32 %6, i32 %9
%11 = select i1 %7, i32 0, i32 %10
ret i32 %11
}
int sum_sized_array(int a[3]) {
  int sum = 0;
  for (int i = 0; i < 3; i++) {
    sum += a[i];
  }
  return sum;
}


x86 assembly (clang, -O0):
<sum_sized_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    113f <sum_sized_array+0x3f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <sum_sized_array+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_sized_array>:
mov    0x4(%rdi),%eax
add    (%rdi),%eax
add    0x8(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @sum_sized_array(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = add nsw i32 %4, %2
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = add nsw i32 %7, %5
ret i32 %8
}
void ircUpdateSessionTimers(struct IrcLibSession *ses, int n) {}


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

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

LLVM IR (-O0):
%struct.IrcLibSession = type opaque
define void @ircUpdateSessionTimers(%struct.IrcLibSession* %0, i32 %1) {
%3 = alloca %struct.IrcLibSession*
%4 = alloca i32
store %struct.IrcLibSession* %0, %struct.IrcLibSession** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.IrcLibSession = type opaque
define void @ircUpdateSessionTimers(%struct.IrcLibSession* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ system(char *);
void convert_to_ppm(char *fname) {
  char test_cmd[500];
  sprintf(test_cmd,
          "debayer -w 1920 -h 1920 -cw 1920 -ch 1920 -aw 1920 -ah 1920 -i %s "
          "-o %s.ppm &> /dev/null",
          fname, fname);
  printf("Executing: %s\n", test_cmd);
  system(test_cmd);
  return;
}


x86 assembly (clang, -O0):
<convert_to_ppm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x200(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xeab(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x200(%rbp),%rsi
lea    0xef1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x200(%rbp),%rdi
call   1030 <system@plt>
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_to_ppm>:
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%rcx
lea    0xebe(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rcx,%rdx
call   1050 <sprintf@plt>
lea    0xf02(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [89 x i8] c"debayer -w 1920 -h 1920 -cw 1920 -ch 1920 -aw 1920 -ah 1920 -i %s -o %s.ppm &> /dev/null\00"
@.str.1 = [15 x i8] c"Executing: %s\0A\00"
define void @convert_to_ppm(i8* %0) {
%2 = alloca i8*
%3 = alloca [500 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%11 = call i32 @system(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [89 x i8] c"debayer -w 1920 -h 1920 -cw 1920 -ch 1920 -aw 1920 -ah 1920 -i %s -o %s.ppm &> /dev/null\00"
@.str.1 = [15 x i8] c"Executing: %s\0A\00"
define void @convert_to_ppm(i8* %0) {
%2 = alloca [500 x i8]
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i32 @system(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __do_all_loops(int, int *, int);
void do_all_loops(int quiet, int numloops) {
  int i = 0;
  __do_all_loops(quiet, &i, numloops);
}


x86 assembly (clang, -O0):
<do_all_loops>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
lea    -0xc(%rbp),%rsi
call   1030 <__do_all_loops@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_all_loops>:
push   %rax
mov    %esi,%edx
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <__do_all_loops@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @do_all_loops(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @__do_all_loops(i32 %0, i32* %3, i32 %1)
ret void
}
int msm_tsens_early_init(struct tsens_platform_data *pdata) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.tsens_platform_data = type opaque
define i32 @msm_tsens_early_init(%struct.tsens_platform_data* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int string_equals(char *str1, char *str2) {
  return (strcmp(str1, str2) == 0) ? 1 : 0;
}


x86 assembly (clang, -O0):
<string_equals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_equals>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @string_equals(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i64 @strcmp(i8* %5, i8* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
ret i32 %10
}

LLVM IR (-O2):
define i32 @string_equals(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
char *strpbrk(char *, char const *);
char *strsep(char **stringp, const char *delim) {
  char *ret = *stringp;
  if (ret == NULL)
    return NULL;
  if ((*stringp = strpbrk(*stringp, delim)) != NULL)
    *((*stringp)++) = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<strsep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1143 <strsep+0x33>
movq   $0x0,-0x8(%rbp)
jmp    1180 <strsep+0x70>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strpbrk@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
je     1178 <strsep+0x68>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsep>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rbx
test   %rbx,%rbx
je     113c <strsep+0x2c>
mov    %rdi,%r14
mov    %rbx,%rdi
call   1030 <strpbrk@plt>
mov    %rax,(%r14)
test   %rax,%rax
je     113c <strsep+0x2c>
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,(%r14)
movb   $0x0,(%rax)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strsep(i8** %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
store i8** %0, i8*** %4
store i8* %1, i8** %5
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i8* null, i8** %3
br label %25
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
%15 = load i8*, i8** %5
%16 = call i8* @strpbrk(i8* %14, i8* %15)
%17 = load i8**, i8*** %4
store i8* %16, i8** %17
%18 = icmp ne i8* %16, null
br i1 %18, label %19, label %23
19: ; preds = %12
%20 = load i8**, i8*** %4
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %20
store i8 0, i8* %21
br label %23
23: ; preds = %19, %12
%24 = load i8*, i8** %6
store i8* %24, i8** %3
br label %25
25: ; preds = %23, %11
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
define i8* @strsep(i8** nocapture %0, i8* nocapture %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i8* @strpbrk(i8* %3, i8* %1)
store i8* %6, i8** %0
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %9, i8** %0
store i8 0, i8* %6
br label %10
10: ; preds = %5, %8, %2
ret i8* %3
}
/* Type definitions */
struct btf_type {
  int dummy;
};
typedef scalar_t__ __u16;

/* Variables and functions */
scalar_t__ BTF_KIND_STRUCT;
scalar_t__ BTF_KIND_UNION;
scalar_t__ btf_kind(struct btf_type const *);
bool btf_is_composite(const struct btf_type *t) {
  __u16 kind = btf_kind(t);
  return kind == BTF_KIND_STRUCT || kind == BTF_KIND_UNION;
}


x86 assembly (clang, -O0):
<btf_is_composite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <btf_kind@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x1,%al
mov    0x2eaa(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x11(%rbp)
je     1156 <btf_is_composite+0x46>
mov    -0x10(%rbp),%rax
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btf_is_composite>:
push   %rax
call   1030 <btf_kind@plt>
mov    0x2ec3(%rip),%rcx
cmp    (%rcx),%rax
sete   %cl
mov    0x2ea6(%rip),%rdx
cmp    (%rdx),%rax
sete   %al
or     %cl,%al
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.btf_type = type { i32 }
@BTF_KIND_STRUCT = global i64 0
@BTF_KIND_UNION = global i64 0
define i32 @btf_is_composite(%struct.btf_type* %0) {
%2 = alloca %struct.btf_type*
%3 = alloca i64
store %struct.btf_type* %0, %struct.btf_type** %2
%4 = load %struct.btf_type*, %struct.btf_type** %2
%5 = call i64 @btf_kind(%struct.btf_type* %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = load i64, i64* @BTF_KIND_STRUCT
%8 = icmp eq i64 %6, %7
br i1 %8, label %13, label %9
9: ; preds = %1
%10 = load i64, i64* %3
%11 = load i64, i64* @BTF_KIND_UNION
%12 = icmp eq i64 %10, %11
br label %13
13: ; preds = %9, %1
%14 = phi i1 [ true, %1 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
%struct.btf_type = type { i32 }
@BTF_KIND_STRUCT = global i64 0
@BTF_KIND_UNION = global i64 0
define i32 @btf_is_composite(%struct.btf_type* %0) {
%2 = tail call i64 @btf_kind(%struct.btf_type* %0)
%3 = load i64, i64* @BTF_KIND_STRUCT
%4 = icmp eq i64 %2, %3
%5 = load i64, i64* @BTF_KIND_UNION
%6 = icmp eq i64 %2, %5
%7 = select i1 %4, i1 true, i1 %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void sched_create_task(char *executable) { assert(0 && "Please fill me!"); }


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

x86 assembly (clang, -O2):
<sched_create_task>:
xor    %edi,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define void @sched_create_task(i8* nocapture readnone %0) {
%2 = tail call i32 @assert(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SystemIdentHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void SystemIdentUpdated() { UAVObjUpdated(SystemIdentHandle()); }


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

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

LLVM IR (-O0):
define void @SystemIdentUpdated() {
%1 = call i32 (...) @SystemIdentHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @SystemIdentUpdated() {
%1 = tail call i32 (...) @SystemIdentHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
label(l) { outcode("BN", 112, l); }


x86 assembly (clang, -O0):
<label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xedb(%rip),%rdi
mov    $0x70,%esi
mov    $0x0,%al
call   1030 <outcode@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<label>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
mov    $0x70,%esi
xor    %eax,%eax
jmp    1030 <outcode@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"BN\00"
define i32 @label(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @outcode to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 112, i32 %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"BN\00"
define i32 @label(i32 %0) {
%2 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @outcode to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 112, i32 %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const *, int const, int const *,
                          int const);
int compar(const int *ap, const int *bp) {
  printf("comparing %p/%d and %p/%d\n", ap, *ap, bp, *bp);
  return *ap - *bp;
}


x86 assembly (clang, -O0):
<compar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    (%rax),%r8d
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compar>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edx
mov    (%rsi),%r8d
lea    0xeda(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rcx
call   1030 <printf@plt>
mov    (%rbx),%eax
sub    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"comparing %p/%d and %p/%d\0A\00"
define i32 @compar(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** %3
%7 = load i32, i32* %6
%8 = load i32*, i32** %4
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32* %5, i32 %7, i32* %8, i32 %10)
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = sub nsw i32 %13, %15
ret i32 %16
}

LLVM IR (-O2):
@.str = [27 x i8] c"comparing %p/%d and %p/%d\0A\00"
define i32 @compar(i32* %0, i32* %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32* %0, i32 %3, i32* %1, i32 %4)
%6 = load i32, i32* %0
%7 = load i32, i32* %1
%8 = sub nsw i32 %6, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *);
void gen_int_flag_have(const char *prefix, const char *flag, int value) {
  printf("#define %sHAVE-%s\n", prefix, flag);
}


x86 assembly (clang, -O0):
<gen_int_flag_have>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_int_flag_have>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"#define %sHAVE-%s\0A\00"
define void @gen_int_flag_have(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"#define %sHAVE-%s\0A\00"
define void @gen_int_flag_have(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
void nrf_drv_radio802154_timer_init(void) {}


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

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

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

LLVM IR (-O2):
define void @nrf_drv_radio802154_timer_init() {
ret void
}
void overflow(char *factorial, int idx, int carry) {
  int addend = factorial[idx] - '0';
  if ((addend + carry) > 9)
    overflow(factorial, idx + 1, 1);
  factorial[idx] = ((addend + carry) % 10) + '0';
}


x86 assembly (clang, -O0):
<overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x9,%eax
jle    1157 <overflow+0x47>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    $0x1,%edx
call   1030 <overflow@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
movslq %esi,%r14
movsbl (%rdi,%r14,1),%eax
lea    (%rdx,%rax,1),%ebp
add    $0xffffffd0,%ebp
cmp    $0xa,%ebp
jl     113a <overflow+0x2a>
add    $0x1,%esi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <overflow@plt>
movslq %ebp,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebp
add    $0x30,%bpl
mov    %bpl,(%rbx,%r14,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @overflow(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = add i32 %2, -48
%9 = add i32 %8, %7
%10 = icmp sgt i32 %9, 9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = add nsw i32 %1, 1
tail call void @overflow(i8* %0, i32 %12, i32 1)
br label %13
13: ; preds = %11, %3
%14 = srem i32 %9, 10
%15 = trunc i32 %14 to i8
%16 = add nsw i8 %15, 48
store i8 %16, i8* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ confirm_array_is_sorted(int *, int);
int *copy_array(int *, int);
int /*<<< orphan*/ finish();
int *merge_sort(int *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ start();
void test_merge_sort(int *original, int size) {
  int *array = copy_array(original, size);
  puts("---------- merge sort");
  start();
  int *sorted = merge_sort(array, size);
  finish();
  confirm_array_is_sorted(sorted, size);
}


x86 assembly (clang, -O0):
<test_merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <copy_array@plt>
mov    %rax,-0x18(%rbp)
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1050 <start@plt>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <merge_sort@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <finish@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <confirm_array_is_sorted@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_merge_sort>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
call   1070 <copy_array@plt>
mov    %rax,%r14
lea    0xe8b(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <start@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <merge_sort@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <finish@plt>
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1080 <confirm_array_is_sorted@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"---------- merge sort\00"
define void @test_merge_sort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = call i32* @copy_array(i32* %7, i32 %8)
store i32* %9, i32** %5
%10 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @start()
%12 = load i32*, i32** %5
%13 = load i32, i32* %4
%14 = call i32* @merge_sort(i32* %12, i32 %13)
store i32* %14, i32** %6
%15 = call i32 (...) @finish()
%16 = load i32*, i32** %6
%17 = load i32, i32* %4
%18 = call i32 @confirm_array_is_sorted(i32* %16, i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"---------- merge sort\00"
define void @test_merge_sort(i32* %0, i32 %1) {
%3 = tail call i32* @copy_array(i32* %0, i32 %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @start()
%6 = tail call i32* @merge_sort(i32* %3, i32 %1)
%7 = tail call i32 (...) @finish()
%8 = tail call i32 @confirm_array_is_sorted(i32* %6, i32 %1)
ret void
}
int test_imm_ACuint16_reg(unsigned short val) {
  return ((val) & (0xAC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_ACuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xac,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_ACuint16_reg>:
test   $0xac,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_ACuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 172
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void GeoIP_range_by_ip_delete(char **ptr) {
  if (ptr) {
    if (ptr[0]) {
      free(ptr[0]);
    }
    if (ptr[1]) {
      free(ptr[1]);
    }
    free(ptr);
  }
}


x86 assembly (clang, -O0):
<GeoIP_range_by_ip_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1166 <GeoIP_range_by_ip_delete+0x56>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1141 <GeoIP_range_by_ip_delete+0x31>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     115d <GeoIP_range_by_ip_delete+0x4d>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GeoIP_range_by_ip_delete>:
test   %rdi,%rdi
je     113d <GeoIP_range_by_ip_delete+0x2d>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1126 <GeoIP_range_by_ip_delete+0x16>
call   1030 <free@plt>
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     1134 <GeoIP_range_by_ip_delete+0x24>
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @GeoIP_range_by_ip_delete(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 %26
5: ; preds = %1
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i8**, i8*** %2
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
br label %14
14: ; preds = %10, %5
%15 = load i8**, i8*** %2
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i8**, i8*** %2
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
br label %23
23: ; preds = %19, %14
%24 = load i8**, i8*** %2
%25 = bitcast i8** %24 to i8*
br label %26
26: ; preds = %23, %1
ret void
}

LLVM IR (-O2):
define void @GeoIP_range_by_ip_delete(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %3
tail call void @free(i8* %4)
br label %7
7: ; preds = %6, %3
%8 = getelementptr inbounds i8*, i8** %0, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %7
tail call void @free(i8* %9)
br label %12
12: ; preds = %11, %7
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
br label %14
14: ; preds = %12, %1
ret void
}
/* Type definitions */
typedef unsigned long long uint64_t;
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
unsigned long long gettime_ns(int /*<<< orphan*/);
uint64_t gettime_us(clockid_t clk_id) { return gettime_ns(clk_id) / 1000ULL; }


x86 assembly (clang, -O0):
<gettime_us>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <gettime_ns@plt>
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime_us>:
push   %rax
call   1030 <gettime_ns@plt>
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
mov    %rdx,%rax
shr    $0x4,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @gettime_us(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @gettime_ns(i32 %3)
%5 = udiv i64 %4, 1000
ret i64 %5
}

LLVM IR (-O2):
define i64 @gettime_us(i32 %0) {
%2 = tail call i64 @gettime_ns(i32 %0)
%3 = udiv i64 %2, 1000
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ Secant(double, double);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void TestSecant() {
  printf("Test Secant: for a=3.2, b=8.98; root = %lf\n", Secant(3.2, 8.98));
}


x86 assembly (clang, -O0):
<TestSecant>:
push   %rbp
mov    %rsp,%rbp
movsd  0xed4(%rip),%xmm0
movsd  0xed4(%rip),%xmm1
call   1040 <Secant@plt>
mov    %eax,%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestSecant>:
push   %rax
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
call   1040 <Secant@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"Test Secant: for a=3.2, b=8.98; root = %lf\0A\00"
define void @TestSecant() {
%1 = call i32 @Secant(double 3.200000e+00, double 8.980000e+00)
%2 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"Test Secant: for a=3.2, b=8.98; root = %lf\0A\00"
define void @TestSecant() {
%1 = tail call i32 @Secant(double 3.200000e+00, double 8.980000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
unsigned int DINT_TO_UDINT(int var) {
  unsigned int newvar;
  if (var < 0)
    newvar = 0;
  else
    newvar = (unsigned int)var;
  return newvar;
}


x86 assembly (clang, -O0):
<DINT_TO_UDINT>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111d <DINT_TO_UDINT+0x1d>
movl   $0x0,-0x8(%rbp)
jmp    1123 <DINT_TO_UDINT+0x23>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DINT_TO_UDINT>:
xor    %eax,%eax
test   %edi,%edi
cmovns %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @DINT_TO_UDINT(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
ret i32 %3
}
/* Variables and functions */
int toupper(char);
unsigned hash(char *s) {
  unsigned hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = toupper(*s) + 31 * hashval;
  return hashval % 101;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1159 <hash+0x49>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1123 <hash+0x13>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     116e <hash+0x5e>
mov    %rdi,%r14
add    $0x1,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %ebx,%ecx
shl    $0x5,%ecx
sub    %ebx,%ecx
mov    %ecx,%ebx
add    %eax,%ebx
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
jne    1130 <hash+0x20>
mov    %ebx,%eax
imul   $0x446f8657,%rax,%rax
shr    $0x20,%rax
mov    %ebx,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x6,%ecx
imul   $0x65,%ecx,%eax
sub    %eax,%ebx
jmp    1170 <hash+0x60>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = tail call i32 @toupper(i8 signext %5)
%9 = mul i32 %6, 31
%10 = add i32 %8, %9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 101
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
char tolower(char);
void ToLower(char *l, char *s) {
  int i;
  for (i = 0; (*(s + i) = tolower(*(l + i))) != '\0'; i++)
    ;
}


x86 assembly (clang, -O0):
<ToLower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1162 <ToLower+0x52>
jmp    1154 <ToLower+0x44>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <ToLower+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ToLower>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   (%rax)
movsbl (%r15,%rbx,1),%edi
call   1030 <tolower@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
test   %al,%al
jne    1120 <ToLower+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ToLower(i8* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %10, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = tail call signext i8 @tolower(i8 signext %6)
%8 = getelementptr inbounds i8, i8* %1, i64 %4
store i8 %7, i8* %8
%9 = icmp eq i8 %7, 0
%10 = add nuw i64 %4, 1
br i1 %9, label %11, label %3
11: ; preds = %3
ret void
}