xunge/DecIR huggingface dataset:
long inv_q30_mult(long a, long b) {
  long long temp;
  long result;
  temp = (long long)a * b;
  result = (long)(temp >> 30);
  return result;
}


x86 assembly (clang, -O0):
<inv_q30_mult>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sar    $0x1e,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_q30_mult>:
mov    %rdi,%rax
imul   %rsi,%rax
sar    $0x1e,%rax
ret

LLVM IR (-O0):
define i64 @inv_q30_mult(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = mul nsw i64 %7, %8
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = ashr i64 %10, 30
store i64 %11, i64* %6
%12 = load i64, i64* %6
ret i64 %12
}

LLVM IR (-O2):
define i64 @inv_q30_mult(i64 %0, i64 %1) {
%3 = mul nsw i64 %1, %0
%4 = ashr i64 %3, 30
ret i64 %4
}
/* Variables and functions */
int _function(int);
int /*<<< orphan*/ printf(char *, int);
void otherfunction() { printf(" %d \n", _function(41)); }


x86 assembly (clang, -O0):
<otherfunction>:
push   %rbp
mov    %rsp,%rbp
mov    $0x29,%edi
call   1040 <_function@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<otherfunction>:
push   %rax
mov    $0x29,%edi
call   1040 <_function@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c" %d \0A\00"
define void @otherfunction() {
%1 = call i32 @_function(i32 41)
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" %d \0A\00"
define void @otherfunction() {
%1 = tail call i32 @_function(i32 41)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int count_spaces(const char str[]) {
  int i, count = 0;
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] == ' ')
      count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<count_spaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115c <count_spaces+0x5c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1149 <count_spaces+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <count_spaces+0x4e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <count_spaces+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_spaces>:
xor    %eax,%eax
jmp    1117 <count_spaces+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x20,%cl
je     1110 <count_spaces+0x10>
test   %cl,%cl
jne    1113 <count_spaces+0x13>
ret

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

LLVM IR (-O2):
define i32 @count_spaces(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i64 [ %11, %9 ], [ 0, %1 ]
%4 = phi i32 [ %10, %9 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 0, label %12
i8 32, label %7
]
7: ; preds = %2
%8 = add nsw i32 %4, 1
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ %8, %7 ], [ %4, %2 ]
%11 = add nuw i64 %3, 1
br label %2
12: ; preds = %2
ret i32 %4
}
void test_formatting_ok(void) {
  char *str = format_str("String %swith%s formatting", "'", "'");
  do {
    seatest_assert_string_equal("String 'with' formatting", str, __FUNCTION__,
                                21);
  } while (0);
  free(str);
}


x86 assembly (clang, -O0):
<test_formatting_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed5(%rip),%rdx
mov    %rdx,%rsi
mov    $0x0,%al
call   1040 <format_str@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebc(%rip),%rdi
lea    0xece(%rip),%rdx
mov    $0x15,%ecx
mov    $0x0,%al
call   1050 <seatest_assert_string_equal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_formatting_ok>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xedc(%rip),%rdx
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <format_str@plt>
movslq %eax,%rbx
lea    0xeca(%rip),%rdi
lea    0xedc(%rip),%rdx
mov    %rbx,%rsi
mov    $0x15,%ecx
xor    %eax,%eax
call   1050 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"String %swith%s formatting\00"
@.str.1 = [2 x i8] c"'\00"
@.str.2 = [25 x i8] c"String 'with' formatting\00"
@__FUNCTION__.test_formatting_ok = [19 x i8] c"test_formatting_ok\00"
define void @test_formatting_ok() {
%1 = alloca i8*
%2 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @format_str to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
br label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_formatting_ok, i64 0, i64 0), i32 21)
br label %8
8: ; preds = %5
%9 = load i8*, i8** %1
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"String %swith%s formatting\00"
@.str.1 = [2 x i8] c"'\00"
@.str.2 = [25 x i8] c"String 'with' formatting\00"
@__FUNCTION__.test_formatting_ok = [19 x i8] c"test_formatting_ok\00"
define void @test_formatting_ok() {
%1 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @format_str to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_formatting_ok, i64 0, i64 0), i32 21)
tail call void @free(i8* %3)
ret void
}
int *test1(int *b3) { return b3 + 1; }


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

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

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

LLVM IR (-O2):
define i32* @test1(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
ret i32* %2
}
/* Variables and functions */
int chdir(char *);
int g_set_current_dir(char *dirname) { return chdir(dirname); }


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

x86 assembly (clang, -O2):
<g_set_current_dir>:
jmp    1030 <chdir@plt>

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

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

/* Variables and functions */
int /*<<< orphan*/ _write(int, int *, int);
void led_sleep_set(int fd, int val) {
  uint8_t buf[] = {0x04, val ? 0xa5 : 0xa1, 0, 0, 0};
  _write(fd, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<led_sleep_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x4,-0x20(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xa1,%eax
mov    $0xa5,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x14,%edx
call   1030 <_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_sleep_set>:
sub    $0x18,%rsp
movl   $0x4,(%rsp)
xor    %eax,%eax
test   %esi,%esi
setne  %al
lea    0xa1(,%rax,4),%eax
mov    %eax,0x4(%rsp)
movq   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rsp,%rsi
mov    $0x14,%edx
call   1030 <_write@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @led_sleep_set(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [5 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
store i32 4, i32* %6
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 165, i32 161
store i32 %11, i32* %7
%12 = getelementptr inbounds i32, i32* %7, i64 1
store i32 0, i32* %12
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 0, i32* %13
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 0, i32* %14
%15 = load i32, i32* %3
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%17 = call i32 @_write(i32 %15, i32* %16, i32 20)
ret void
}

LLVM IR (-O2):
define void @led_sleep_set(i32 %0, i32 %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
store i32 4, i32* %5
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%7 = icmp eq i32 %1, 0
%8 = select i1 %7, i32 161, i32 165
store i32 %8, i32* %6
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
store i32 0, i32* %9
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
store i32 0, i32* %10
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
store i32 0, i32* %11
%12 = call i32 @_write(i32 %0, i32* %5, i32 20)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int open_file_dev(char *file_dev_name) {
  int fdevice;
  fdevice = open(file_dev_name, O_RDWR);
  if (fdevice == -1) {
    perror("nct5104dctl open");
    return 2;
  }
  return fdevice;
}


x86 assembly (clang, -O0):
<open_file_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1163 <open_file_dev+0x43>
lea    0xeae(%rip),%rdi
call   1040 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1169 <open_file_dev+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_file_dev>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
cmp    $0xffffffff,%eax
je     1136 <open_file_dev+0x16>
pop    %rcx
ret
lea    0xec3(%rip),%rdi
call   1040 <perror@plt>
mov    $0x2,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@O_RDWR = global i32 0
@.str = [17 x i8] c"nct5104dctl open\00"
define i32 @open_file_dev(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ 2, %5 ], [ %3, %1 ]
ret i32 %8
}
unsigned long long __muldi3(unsigned long long a, unsigned long long b) {
  unsigned int al = (unsigned int)a;
  unsigned int ah = (unsigned int)(a >> 32);
  unsigned int bl = (unsigned int)b;
  unsigned int bh = (unsigned int)(b >> 32);
  unsigned long long v;
  v = (unsigned long long)al * bl;
  v += (unsigned long long)(al * bh + ah * bl) << 32;
  return v;
}


x86 assembly (clang, -O0):
<__muldi3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x20,%rax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    %ecx,%eax
mov    %eax,%eax
shl    $0x20,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__muldi3>:
mov    %rsi,%rcx
shr    $0x20,%rcx
mov    %edi,%edx
imul   %edi,%ecx
mov    %rdi,%rax
shr    $0x20,%rax
mov    %esi,%edi
imul   %rdx,%rdi
imul   %esi,%eax
add    %ecx,%eax
shl    $0x20,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @__muldi3(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%10 = load i64, i64* %3
%11 = trunc i64 %10 to i32
store i32 %11, i32* %5
%12 = load i64, i64* %3
%13 = lshr i64 %12, 32
%14 = trunc i64 %13 to i32
store i32 %14, i32* %6
%15 = load i64, i64* %4
%16 = trunc i64 %15 to i32
store i32 %16, i32* %7
%17 = load i64, i64* %4
%18 = lshr i64 %17, 32
%19 = trunc i64 %18 to i32
store i32 %19, i32* %8
%20 = load i32, i32* %5
%21 = zext i32 %20 to i64
%22 = load i32, i32* %7
%23 = zext i32 %22 to i64
%24 = mul i64 %21, %23
store i64 %24, i64* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %8
%27 = mul i32 %25, %26
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = mul i32 %28, %29
%31 = add i32 %27, %30
%32 = zext i32 %31 to i64
%33 = shl i64 %32, 32
%34 = load i64, i64* %9
%35 = add i64 %34, %33
store i64 %35, i64* %9
%36 = load i64, i64* %9
ret i64 %36
}

LLVM IR (-O2):
define i64 @__muldi3(i64 %0, i64 %1) {
%3 = lshr i64 %0, 32
%4 = lshr i64 %1, 32
%5 = and i64 %0, 4294967295
%6 = and i64 %1, 4294967295
%7 = mul nuw i64 %6, %5
%8 = mul i64 %4, %0
%9 = mul i64 %3, %1
%10 = add i64 %8, %9
%11 = shl i64 %10, 32
%12 = add i64 %11, %7
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void log_float(char *tag, int num) { printf("%s: %d\n", tag, num); }


x86 assembly (clang, -O0):
<log_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_float>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %d\0A\00"
define void @log_float(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
__attribute__((always_)) int up_smp_call_function(void (*func)(void *),
                                                  void *info) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @up_smp_call_function(void (i8*)* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
int lowestSetBit(unsigned int x) {
  int bit_posn = 0;
  while ((x & 0xf) == 0) {
    bit_posn += 4;
    x >>= 4;
  }
  while ((x & 1) == 0) {
    bit_posn++;
    x >>= 1;
  }
  return bit_posn;
}


x86 assembly (clang, -O0):
<lowestSetBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    1134 <lowestSetBit+0x34>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <lowestSetBit+0xe>
jmp    1139 <lowestSetBit+0x39>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    115f <lowestSetBit+0x5f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1139 <lowestSetBit+0x39>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowestSetBit>:
xor    %eax,%eax
test   $0xf,%dil
je     110c <lowestSetBit+0xc>
mov    %edi,%ecx
jmp    111e <lowestSetBit+0x1e>
xor    %eax,%eax
mov    %edi,%ecx
add    $0x4,%eax
shr    $0x4,%ecx
test   $0xf0,%dil
mov    %ecx,%edi
je     1110 <lowestSetBit+0x10>
test   $0x1,%cl
jne    113c <lowestSetBit+0x3c>
mov    %ecx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
shr    %edx
test   $0x2,%cl
mov    %edx,%ecx
je     1130 <lowestSetBit+0x30>
ret

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

LLVM IR (-O2):
define i32 @lowestSetBit(i32 %0) {
%2 = and i32 %0, 15
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %9, %1
%5 = phi i32 [ %0, %1 ], [ %13, %9 ]
%6 = phi i32 [ 0, %1 ], [ %12, %9 ]
%7 = and i32 %5, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %23
9: ; preds = %1, %9
%10 = phi i32 [ %12, %9 ], [ 0, %1 ]
%11 = phi i32 [ %13, %9 ], [ %0, %1 ]
%12 = add nuw nsw i32 %10, 4
%13 = lshr i32 %11, 4
%14 = and i32 %11, 240
%15 = icmp eq i32 %14, 0
br i1 %15, label %9, label %4
16: ; preds = %4, %16
%17 = phi i32 [ %19, %16 ], [ %6, %4 ]
%18 = phi i32 [ %20, %16 ], [ %5, %4 ]
%19 = add nuw nsw i32 %17, 1
%20 = lshr i32 %18, 1
%21 = and i32 %18, 2
%22 = icmp eq i32 %21, 0
br i1 %22, label %16, label %23
23: ; preds = %16, %4
%24 = phi i32 [ %6, %4 ], [ %19, %16 ]
ret i32 %24
}
/* Variables and functions */
int /*<<< orphan*/ core4_print(char *, char const *);
void U_EMRSTROKEPATH_print(const char *contents) {
  core4_print("U_EMRSTROKEPATH", contents);
}


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

x86 assembly (clang, -O2):
<U_EMRSTROKEPATH_print>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <core4_print@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"U_EMRSTROKEPATH\00"
define void @U_EMRSTROKEPATH_print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @core4_print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"U_EMRSTROKEPATH\00"
define void @U_EMRSTROKEPATH_print(i8* %0) {
%2 = tail call i32 @core4_print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void vx_try_unhold(struct rq *rq, int cpu) { return; }


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

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

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

LLVM IR (-O2):
%struct.rq = type opaque
define void @vx_try_unhold(%struct.rq* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fdputs(int, char *);
int /*<<< orphan*/ send_200_ok(int);
int /*<<< orphan*/ send_header_textplain(int);
void send_http_ok(int clientsock, char *message) {
  send_200_ok(clientsock);
  send_header_textplain(clientsock);
  fdputs(clientsock, "\n");
  fdputs(clientsock, message);
  fdputs(clientsock, "\n");
}


x86 assembly (clang, -O0):
<send_http_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <send_200_ok@plt>
mov    -0x4(%rbp),%edi
call   1030 <send_header_textplain@plt>
mov    -0x4(%rbp),%edi
lea    0xea7(%rip),%rsi
call   1050 <fdputs@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <fdputs@plt>
mov    -0x4(%rbp),%edi
lea    0xe8c(%rip),%rsi
call   1050 <fdputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_http_ok>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <send_200_ok@plt>
mov    %ebp,%edi
call   1030 <send_header_textplain@plt>
lea    0xeb4(%rip),%r14
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <fdputs@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <fdputs@plt>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fdputs@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @send_http_ok(i32 %0, i8* %1) {
%3 = tail call i32 @send_200_ok(i32 %0)
%4 = tail call i32 @send_header_textplain(i32 %0)
%5 = tail call i32 @fdputs(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @fdputs(i32 %0, i8* %1)
%7 = tail call i32 @fdputs(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rvidcc_read();
int /*<<< orphan*/ rvidcc_write();
void rvidcc_poll(void) {
  rvidcc_write();
  rvidcc_read();
}


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

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

LLVM IR (-O0):
define void @rvidcc_poll() {
%1 = call i32 (...) @rvidcc_write()
%2 = call i32 (...) @rvidcc_read()
ret void
}

LLVM IR (-O2):
define void @rvidcc_poll() {
%1 = tail call i32 (...) @rvidcc_write()
%2 = tail call i32 (...) @rvidcc_read()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ sqlite3_assert_msg(int, int /*<<< orphan*/);
int /*<<< orphan*/ sqlite3_errmsg(int /*<<< orphan*/ *);
void sqlite3_assert_db(int rc, sqlite3 *db) {
  if (!rc)
    return;
  sqlite3_assert_msg(rc, sqlite3_errmsg(db));
}


x86 assembly (clang, -O0):
<sqlite3_assert_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113e <sqlite3_assert_db+0x1e>
jmp    1157 <sqlite3_assert_db+0x37>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sqlite3_errmsg@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1040 <sqlite3_assert_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite3_assert_db>:
test   %edi,%edi
je     1139 <sqlite3_assert_db+0x19>
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1030 <sqlite3_errmsg@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <sqlite3_assert_msg@plt>
ret

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

LLVM IR (-O2):
define void @sqlite3_assert_db(i32 %0, i32* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @sqlite3_errmsg(i32* %1)
%6 = tail call i32 @sqlite3_assert_msg(i32 %0, i32 %5)
br label %7
7: ; preds = %2, %4
ret void
}
/* Variables and functions */
unsigned short foo2(int);
unsigned short int bar2(int x) { return foo2(x + 6); }


x86 assembly (clang, -O0):
<bar2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x6,%edi
call   1030 <foo2@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar2>:
add    $0x6,%edi
jmp    1030 <foo2@plt>

LLVM IR (-O0):
define zeroext i16 @bar2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 6
%5 = call zeroext i16 @foo2(i32 %4)
ret i16 %5
}

LLVM IR (-O2):
define zeroext i16 @bar2(i32 %0) {
%2 = add nsw i32 %0, 6
%3 = tail call zeroext i16 @foo2(i32 %2)
ret i16 %3
}
/* Variables and functions */
int f30(int *);
int f31(int *p) { return f30(p); }


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

x86 assembly (clang, -O2):
<f31>:
jmp    1030 <f30@plt>

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

LLVM IR (-O2):
define i32 @f31(i32* %0) {
%2 = tail call i32 @f30(i32* %0)
ret i32 %2
}
/* Variables and functions */
int test_harness_run(int, char **);
int main(int argc, char **argv) { return test_harness_run(argc, argv); }


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <test_harness_run@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @test_harness_run(i32 %0, i8** %1)
ret i32 %3
}
void free_matrix_int_2d(int **mat, int dim1) {
  int i;
  for (i = 0; i < dim1; i++)
    free(mat[i]);
  free(mat);
}


x86 assembly (clang, -O0):
<free_matrix_int_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_matrix_int_2d+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_matrix_int_2d+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_matrix_int_2d>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_matrix_int_2d+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_matrix_int_2d+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_matrix_int_2d(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = bitcast i32** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast i32** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *pgm) {
  fprintf(stderr, "Usage: %s [-c] [-sl] file.... > docfile\n", pgm);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"Usage: %s [-c] [-sl] file.... > docfile\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"Usage: %s [-c] [-sl] file.... > docfile\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
char *find_char(const char *s, const char c) {
  do
    if (*s == c)
      return (char *)s;
  while (*s++);
  return ((void *)0);
}


x86 assembly (clang, -O0):
<find_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    112e <find_char+0x2e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <find_char+0x53>
jmp    1133 <find_char+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    110e <find_char+0xe>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_char>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
cmp    %sil,%cl
je     1122 <find_char+0x22>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <find_char+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @find_char(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, %1
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, 0
br i1 %9, label %10, label %3
10: ; preds = %7, %3
%11 = phi i8* [ %4, %3 ], [ null, %7 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_datamodel() {
  if (sizeof(void *) == 4) {
    if (sizeof(int) == 2) {
      printf("LP32");
    } else {
      printf("ILP32");
    }
  } else {
    if (sizeof(int) == 8) {
      printf("ILP64");
    } else if (sizeof(int) == 4 && sizeof(long) == 4) {
      printf("P64");
    } else {
      printf("LP64");
    }
  }
}


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"LP64\00"
define void @print_datamodel() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int MAP_ANON;
void *MAP_FAILED;
int MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
void *mmap(int /*<<< orphan*/ *, int, int, int, int, int /*<<< orphan*/);
void *xalloc(int size) {
  void *ptr;
  ptr = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
  if (ptr == MAP_FAILED)
    return NULL;
  return ptr;
}


x86 assembly (clang, -O0):
<xalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%edx
mov    0x2ead(%rip),%rax
or     (%rax),%edx
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
mov    0x2e8b(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0x1000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2e5b(%rip),%rcx
cmp    (%rcx),%rax
jne    117b <xalloc+0x6b>
movq   $0x0,-0x8(%rbp)
jmp    1183 <xalloc+0x73>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xalloc>:
push   %rbx
mov    0x2ee0(%rip),%rax
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2ea6(%rip),%rax
mov    0x2e97(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
xor    %ebx,%ebx
xor    %edi,%edi
mov    $0x1000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    0x2e6d(%rip),%rcx
cmp    (%rcx),%rax
cmove  %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_ANON = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
define i8* @xalloc(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i32, i32* @PROT_READ
%6 = load i32, i32* @PROT_WRITE
%7 = or i32 %5, %6
%8 = load i32, i32* @MAP_ANON
%9 = load i32, i32* @MAP_PRIVATE
%10 = or i32 %8, %9
%11 = call i8* @mmap(i32* null, i32 4096, i32 %7, i32 %10, i32 -1, i32 0)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = load i8*, i8** @MAP_FAILED
%14 = icmp eq i8* %12, %13
br i1 %14, label %15, label %16
15: ; preds = %1
store i8* null, i8** %2
br label %18
16: ; preds = %1
%17 = load i8*, i8** %4
store i8* %17, i8** %2
br label %18
18: ; preds = %16, %15
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_ANON = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
define i8* @xalloc(i32 %0) {
%2 = load i32, i32* @PROT_READ
%3 = load i32, i32* @PROT_WRITE
%4 = or i32 %3, %2
%5 = load i32, i32* @MAP_ANON
%6 = load i32, i32* @MAP_PRIVATE
%7 = or i32 %6, %5
%8 = tail call i8* @mmap(i32* null, i32 4096, i32 %4, i32 %7, i32 -1, i32 0)
%9 = load i8*, i8** @MAP_FAILED
%10 = icmp eq i8* %8, %9
%11 = select i1 %10, i8* null, i8* %8
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ cp_hl();
void opcode_be() { cp_hl(); }


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

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

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

LLVM IR (-O2):
define void @opcode_be() {
%1 = tail call i32 (...) @cp_hl()
ret void
}
/* Variables and functions */
int omp_get_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int, int);
int main() {
#pragma omp parallel
  printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(),
         omp_get_num_threads());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <omp_get_num_threads@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Hello from thread %d, nthreads %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @omp_get_thread_num()
%3 = call i32 (...) @omp_get_num_threads()
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Hello from thread %d, nthreads %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = tail call i32 (...) @omp_get_num_threads()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set(int /*<<< orphan*/, int /*<<< orphan*/);
void fibn_step(mpz_t F_np1, mpz_t F_n, mpz_t F_nm1) {
  mpz_add(F_np1, F_n, F_nm1);
  mpz_set(F_nm1, F_n);
  mpz_set(F_n, F_np1);
}


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

x86 assembly (clang, -O2):
<fibn_step>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
call   1040 <mpz_add@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <mpz_set@plt>
mov    %ebp,%edi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <mpz_set@plt>

LLVM IR (-O0):
define void @fibn_step(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @mpz_add(i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = call i32 @mpz_set(i32 %11, i32 %12)
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = call i32 @mpz_set(i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
define void @fibn_step(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @mpz_add(i32 %0, i32 %1, i32 %2)
%5 = tail call i32 @mpz_set(i32 %2, i32 %1)
%6 = tail call i32 @mpz_set(i32 %1, i32 %0)
ret void
}
void ft_strclr(char *s) {
  int i;
  if (s) {
    i = 0;
    while (s[i] != '\0') {
      s[i] = '\0';
      i++;
    }
  }
}


x86 assembly (clang, -O0):
<ft_strclr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114e <ft_strclr+0x4e>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1149 <ft_strclr+0x49>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111a <ft_strclr+0x1a>
jmp    114e <ft_strclr+0x4e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strclr>:
test   %rdi,%rdi
je     111d <ft_strclr+0x1d>
cmpb   $0x0,(%rdi)
je     111d <ft_strclr+0x1d>
add    $0x1,%rdi
xchg   %ax,%ax
movb   $0x0,-0x1(%rdi)
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <ft_strclr+0x10>
ret

LLVM IR (-O0):
define void @ft_strclr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %23
6: ; preds = %1
store i32 0, i32* %3
br label %7
7: ; preds = %15, %6
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%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 = icmp ne i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %7
%16 = load i8*, i8** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %7
22: ; preds = %7
br label %23
23: ; preds = %22, %1
ret void
}

LLVM IR (-O2):
define void @ft_strclr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8* [ %10, %6 ], [ %0, %3 ]
store i8 0, i8* %8
%9 = add nuw nsw i64 %7, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sanitize_str(char *);
int strtol(char *, int /*<<< orphan*/ *, int);
void load_int(int *i, char *value) {
  sanitize_str(value);
  *i = strtol(value, NULL, 10);
}


x86 assembly (clang, -O0):
<load_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sanitize_str@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_int>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <sanitize_str@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @load_int(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @sanitize_str(i8* %5)
%7 = load i8*, i8** %4
%8 = call i32 @strtol(i8* %7, i32* null, i32 10)
%9 = load i32*, i32** %3
store i32 %8, i32* %9
ret void
}

LLVM IR (-O2):
define void @load_int(i32* nocapture writeonly %0, i8* %1) {
%3 = tail call i32 @sanitize_str(i8* %1)
%4 = tail call i32 @strtol(i8* nocapture %1, i32* null, i32 10)
store i32 %4, i32* %0
ret void
}