xunge/DecIR huggingface dataset:
/* Type definitions */
typedef long uint32_t;
struct etimer {
  int dummy;
};

/* Variables and functions */
int timer_elapsed_milliseconds(struct etimer *, long);
bool timer_elapsed_minutes(struct etimer *t, uint32_t minutes) {
  uint32_t milliseconds = minutes;
  milliseconds *= 1000L;
  milliseconds *= 60L;
  return timer_elapsed_milliseconds(t, milliseconds);
}


x86 assembly (clang, -O0):
<timer_elapsed_minutes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
imul   $0x3e8,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
imul   $0x3c,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <timer_elapsed_milliseconds@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_elapsed_minutes>:
imul   $0xea60,%rsi,%rsi
jmp    1030 <timer_elapsed_milliseconds@plt>

LLVM IR (-O0):
%struct.etimer = type { i32 }
define i32 @timer_elapsed_minutes(%struct.etimer* %0, i64 %1) {
%3 = alloca %struct.etimer*
%4 = alloca i64
%5 = alloca i64
store %struct.etimer* %0, %struct.etimer** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
store i64 %6, i64* %5
%7 = load i64, i64* %5
%8 = mul nsw i64 %7, 1000
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = mul nsw i64 %9, 60
store i64 %10, i64* %5
%11 = load %struct.etimer*, %struct.etimer** %3
%12 = load i64, i64* %5
%13 = call i32 @timer_elapsed_milliseconds(%struct.etimer* %11, i64 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.etimer = type { i32 }
define i32 @timer_elapsed_minutes(%struct.etimer* %0, i64 %1) {
%3 = mul i64 %1, 60000
%4 = tail call i32 @timer_elapsed_milliseconds(%struct.etimer* %0, i64 %3)
ret i32 %4
}
/* Variables and functions */
int ancil_send_fds_with_buffer_to(int, int const *, unsigned int, void *,
                                  int /*<<< orphan*/ *, int /*<<< orphan*/);
int ancil_send_fds_with_buffer(int sock, const int *fds, unsigned n_fds,
                               void *buffer) {
  return ancil_send_fds_with_buffer_to(sock, fds, n_fds, buffer, NULL, 0);
}


x86 assembly (clang, -O0):
<ancil_send_fds_with_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
xor    %r9d,%r9d
call   1030 <ancil_send_fds_with_buffer_to@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ancil_send_fds_with_buffer>:
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <ancil_send_fds_with_buffer_to@plt>

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

LLVM IR (-O2):
define i32 @ancil_send_fds_with_buffer(i32 %0, i32* %1, i32 %2, i8* %3) {
%5 = tail call i32 @ancil_send_fds_with_buffer_to(i32 %0, i32* %1, i32 %2, i8* %3, i32* null, i32 0)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ key;

/* Variables and functions */
scalar_t__ ini_getdouble(double *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int ini_getdouble_default(double *value, char *param) {
  char key[256];
  snprintf(key, (sizeof(key)), "%s:%s", "default", param);
  if (ini_getdouble(value, key))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ini_getdouble_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%r8
mov    $0x100,%esi
lea    0xeb6(%rip),%rdx
lea    0xeb5(%rip),%rcx
call   1030 <snprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <ini_getdouble@plt>
cmp    $0x0,%rax
je     117c <ini_getdouble_default+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1183 <ini_getdouble_default+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ini_getdouble_default>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r8
mov    %rdi,%rbx
lea    0xec9(%rip),%rdx
lea    0xec8(%rip),%rcx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <ini_getdouble@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%s:%s\00"
@.str.1 = [8 x i8] c"default\00"
define i32 @ini_getdouble_default(double* %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = call i64 @ini_getdouble(double* %0, i8* %4)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
void free_2d_double(double **dd) {
  free(dd[0]);
  free(dd);
}


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

x86 assembly (clang, -O2):
<free_2d_double>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_2d_double(double** nocapture %0) {
%2 = bitcast double** %0 to i8**
%3 = load i8*, i8** %2
tail call void @free(i8* %3)
%4 = bitcast double** %0 to i8*
tail call void @free(i8* %4)
ret void
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sched_getparam(pid_t pid, struct sched_param *param) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sched_getparam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sched_getparam>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @__sched_getparam(i32 %0, %struct.sched_param* %1) {
%3 = alloca i32
%4 = alloca %struct.sched_param*
store i32 %0, i32* %3
store %struct.sched_param* %1, %struct.sched_param** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @__sched_getparam(i32 %0, %struct.sched_param* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Type definitions */
struct i2c_client {
  int dummy;
};
struct fg_state {
  int dummy;
};

/* Variables and functions */
struct fg_state *i2c_get_clientdata(struct i2c_client *);
int /*<<< orphan*/ kfree(struct fg_state *);
int fg_i2c_remove(struct i2c_client *client) {
  struct fg_state *fg = i2c_get_clientdata(client);
  kfree(fg);
  return 0;
}


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

x86 assembly (clang, -O2):
<fg_i2c_remove>:
push   %rax
call   1030 <i2c_get_clientdata@plt>
mov    %rax,%rdi
call   1040 <kfree@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.i2c_client = type { i32 }
%struct.fg_state = type { i32 }
define i32 @fg_i2c_remove(%struct.i2c_client* %0) {
%2 = alloca %struct.i2c_client*
%3 = alloca %struct.fg_state*
store %struct.i2c_client* %0, %struct.i2c_client** %2
%4 = load %struct.i2c_client*, %struct.i2c_client** %2
%5 = call %struct.fg_state* @i2c_get_clientdata(%struct.i2c_client* %4)
store %struct.fg_state* %5, %struct.fg_state** %3
%6 = load %struct.fg_state*, %struct.fg_state** %3
%7 = call i32 @kfree(%struct.fg_state* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.i2c_client = type { i32 }
%struct.fg_state = type { i32 }
define i32 @fg_i2c_remove(%struct.i2c_client* %0) {
%2 = tail call %struct.fg_state* @i2c_get_clientdata(%struct.i2c_client* %0)
%3 = tail call i32 @kfree(%struct.fg_state* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ gas;

/* Variables and functions */
int canCompleteCircuit(int *, int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int gas[] = {4};
  int cost[] = {5};
  int count = sizeof(gas) / sizeof(*gas);
  printf("%d\n", canCompleteCircuit(gas, count, cost, count));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec6(%rip),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
lea    -0xc(%rbp),%rdx
mov    -0x10(%rbp),%ecx
call   1040 <canCompleteCircuit@plt>
mov    %eax,%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x4,0x4(%rsp)
movl   $0x5,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x1,%esi
mov    $0x1,%ecx
call   1040 <canCompleteCircuit@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.gas = [1 x i32] [i32 4]
@__const.main.cost = [1 x i32] [i32 5]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i32]
%3 = alloca [1 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [1 x i32]* %2 to i8*
%6 = bitcast [1 x i32]* %3 to i8*
store i32 1, i32* %4
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%8 = load i32, i32* %4
%9 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i32 @canCompleteCircuit(i32* %7, i32 %8, i32* %9, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [1 x i32]
%2 = alloca [1 x i32]
%3 = bitcast [1 x i32]* %1 to i8*
%4 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 4, i32* %4
%5 = bitcast [1 x i32]* %2 to i8*
%6 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
store i32 5, i32* %6
%7 = call i32 @canCompleteCircuit(i32* %4, i32 1, i32* %6, i32 1)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int printf(char *, ...);
int main() {
  int i;
  i = printf("%s\n", "Hello");
  printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec9(%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    0xee8(%rip),%rdi
lea    0xee5(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [6 x i8] c"Hello\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
void bzero_long(long *ptr, size_t size) {
  if (size & 1) {
    *(ptr++) = 0;
  }
  size /= 2;
  while (size--) {
    *(ptr++) = 0;
    *(ptr++) = 0;
  }
}


x86 assembly (clang, -O0):
<bzero_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1134 <bzero_long+0x34>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     118a <bzero_long+0x8a>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movq   $0x0,(%rax)
jmp    1140 <bzero_long+0x40>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bzero_long>:
push   %rax
mov    %rsi,%rdx
test   $0x1,%dl
jne    1121 <bzero_long+0x11>
cmp    $0x2,%rdx
jae    1132 <bzero_long+0x22>
pop    %rax
ret
movq   $0x0,(%rdi)
add    $0x8,%rdi
cmp    $0x2,%rdx
jb     111f <bzero_long+0xf>
shl    $0x3,%rdx
and    $0xfffffffffffffff0,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @bzero_long(i64* nocapture writeonly %0, i64 %1) {
%3 = and i64 %1, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = getelementptr inbounds i64, i64* %0, i64 1
store i64 0, i64* %0
br label %7
7: ; preds = %5, %2
%8 = phi i64* [ %6, %5 ], [ %0, %2 ]
%9 = icmp ult i64 %1, 2
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = bitcast i64* %8 to i8*
%12 = shl nuw i64 %1, 3
%13 = and i64 %12, -16
br label %14
14: ; preds = %10, %7
ret void
}
/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, double);
scalar_t__ scanf(char *, double *);
int main() {
  double x;
  while (scanf("%lf", &x) != EOF)
    printf("%.2lf\n", x / 6.28);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
je     1171 <main+0x51>
movsd  -0x10(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed9(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    0x2eaa(%rip),%r12
cmp    (%r12),%rax
je     1186 <main+0x66>
lea    0xec1(%rip),%r14
lea    0xeb6(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rsp),%xmm0
divsd  0xe93(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    (%r12),%rax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%5 = load i64, i64* @EOF
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load double, double* %2
%9 = fdiv double %8, 6.280000e+00
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %9)
br label %3
11: ; preds = %3
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = load double, double* %1
%8 = fdiv double %7, 6.280000e+00
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%11 = load i64, i64* @EOF
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %6
13: ; preds = %6, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ do_a();
int /*<<< orphan*/ do_b();
int /*<<< orphan*/ do_c();
int /*<<< orphan*/ do_d();
scalar_t__ test_condition();
void test_ifelse() {
  do_a();
  if (test_condition())
    do_b();
  else
    do_c();
  do_d();
}


x86 assembly (clang, -O0):
<test_ifelse>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <do_a@plt>
mov    $0x0,%al
call   1030 <test_condition@plt>
cmp    $0x0,%rax
je     1178 <test_ifelse+0x28>
mov    $0x0,%al
call   1040 <do_b@plt>
jmp    117f <test_ifelse+0x2f>
mov    $0x0,%al
call   1070 <do_c@plt>
mov    $0x0,%al
call   1050 <do_d@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ifelse>:
push   %rax
xor    %eax,%eax
call   1060 <do_a@plt>
xor    %eax,%eax
call   1030 <test_condition@plt>
test   %rax,%rax
je     116d <test_ifelse+0x1d>
xor    %eax,%eax
call   1040 <do_b@plt>
jmp    1174 <test_ifelse+0x24>
xor    %eax,%eax
call   1070 <do_c@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <do_d@plt>

LLVM IR (-O0):
define void @test_ifelse() {
%1 = call i32 (...) @do_a()
%2 = call i64 (...) @test_condition()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @do_b()
br label %8
6: ; preds = %0
%7 = call i32 (...) @do_c()
br label %8
8: ; preds = %6, %4
%9 = call i32 (...) @do_d()
ret void
}

LLVM IR (-O2):
define void @test_ifelse() {
%1 = tail call i32 (...) @do_a()
%2 = tail call i64 (...) @test_condition()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (...) @do_b()
br label %8
6: ; preds = %0
%7 = tail call i32 (...) @do_c()
br label %8
8: ; preds = %6, %4
%9 = tail call i32 (...) @do_d()
ret void
}
unsigned int call_write(unsigned int descriptor, void *buffer,
                        unsigned int count) {
  return 0;
}


x86 assembly (clang, -O0):
<call_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @call_write(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ baz();
void foo() {
  bar();
  baz();
}


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

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

LLVM IR (-O0):
define void @foo() {
%1 = call i32 (...) @bar()
%2 = call i32 (...) @baz()
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @baz()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(int /*<<< orphan*/, char *, char *, char *, int);
void gmx_txs(int nodeid, void *buf, int bufsize) {
  fatal_error(0, "Routine %s called in %s, %d", "gmx_txs",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Chadi-akel/cere/refs/heads/master/"
              "tests/test_07/network.c",
              101);
}


x86 assembly (clang, -O0):
<gmx_txs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %edi,%edi
lea    0xed5(%rip),%rsi
lea    0xeea(%rip),%rdx
lea    0xeeb(%rip),%rcx
mov    $0x65,%r8d
call   1030 <fatal_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmx_txs>:
lea    0xee9(%rip),%rsi
lea    0xefe(%rip),%rdx
lea    0xeff(%rip),%rcx
xor    %edi,%edi
mov    $0x65,%r8d
jmp    1030 <fatal_error@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Routine %s called in %s, %d\00"
@.str.1 = [8 x i8] c"gmx_txs\00"
@.str.2 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Chadi-akel/cere/refs/heads/master/tests/test_07/network.c\00"
define void @gmx_txs(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 101)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Routine %s called in %s, %d\00"
@.str.1 = [8 x i8] c"gmx_txs\00"
@.str.2 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Chadi-akel/cere/refs/heads/master/tests/test_07/network.c\00"
define void @gmx_txs(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = tail call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 101)
ret void
}
helloworld3() {
  int a = 10;
  float b = 1.001;
}


x86 assembly (clang, -O0):
<helloworld3>:
push   %rbp
mov    %rsp,%rbp
movl   $0xa,-0x8(%rbp)
movss  0xeed(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @helloworld3() {
ret i32 undef
}
unsigned long bit_top(unsigned long var, int n_bits) {
  return var + ((var & ((1 << n_bits) - 1)) ^ ((1 << n_bits) - 1)) + 1;
}


x86 assembly (clang, -O0):
<bit_top>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x20(%rbp),%rcx
sub    $0x1,%edx
movslq %edx,%rdx
and    %rdx,%rcx
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x18(%rbp),%rcx
sub    $0x1,%edx
movslq %edx,%rdx
xor    %rdx,%rcx
add    %rcx,%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_top>:
mov    %esi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
cltq
mov    %rdi,%rcx
not    %rcx
and    %rax,%rcx
lea    (%rdi,%rcx,1),%rax
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @bit_top(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %3
%7 = load i32, i32* %4
%8 = shl i32 1, %7
%9 = sub nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = and i64 %6, %10
%12 = load i32, i32* %4
%13 = shl i32 1, %12
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = xor i64 %11, %15
%17 = add i64 %5, %16
%18 = add i64 %17, 1
ret i64 %18
}

LLVM IR (-O2):
define i64 @bit_top(i64 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = xor i32 %3, -1
%5 = sext i32 %4 to i64
%6 = xor i64 %0, -1
%7 = and i64 %5, %6
%8 = add i64 %0, 1
%9 = add i64 %8, %7
ret i64 %9
}
/* Variables and functions */
scalar_t__ umount(char const *);
int omb_utils_umount(const char *mountpoint) {
  return umount(mountpoint) == 0 ? 0 : -1;
}


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

x86 assembly (clang, -O2):
<omb_utils_umount>:
push   %rax
call   1030 <umount@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @omb_utils_umount(i8* %0) {
%2 = tail call i64 @umount(i8* %0)
%3 = icmp ne i64 %2, 0
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_stmt;
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ sqlite3_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
char sqlite_quit(sqlite3 *db, sqlite3_stmt *query_prepared, char retval) {
  if (query_prepared)
    sqlite3_finalize(query_prepared);
  sqlite3_close(db);
  return (retval);
}


x86 assembly (clang, -O0):
<sqlite_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1149 <sqlite_quit+0x29>
mov    -0x10(%rbp),%rdi
call   1040 <sqlite3_finalize@plt>
mov    -0x8(%rbp),%rdi
call   1030 <sqlite3_close@plt>
movsbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite_quit>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
test   %rsi,%rsi
je     1135 <sqlite_quit+0x15>
mov    %rsi,%rdi
call   1040 <sqlite3_finalize@plt>
mov    %rbx,%rdi
call   1030 <sqlite3_close@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define signext i8 @sqlite_quit(i32* %0, i32* %1, i8 returned signext %2) {
%4 = icmp eq i32* %1, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @sqlite3_finalize(i32* %1)
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @sqlite3_close(i32* %0)
ret i8 %2
}
int test_imm_AEint64_lowword_reg(long long val) {
  return ((val) & (0xAE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_AEint64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0xae,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_AEint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 174
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
signed int *u_to_s_init(unsigned int *up) {
  signed int *sp = up;
  return sp;
}


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

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

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

LLVM IR (-O2):
define i32* @u_to_s_init(i32* readnone returned %0) {
ret i32* %0
}
/* Variables and functions */
float fabs(float x) {
  if (x >= 0.0)
    return x;
  else
    return -x;
}


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112e <fabs+0x2e>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1145 <fabs+0x45>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
movaps 0xef9(%rip),%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm1,%xmm1
cmpnless %xmm0,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @fabs(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp oge double %5, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load float, float* %3
store float %8, float* %2
br label %12
9: ; preds = %1
%10 = load float, float* %3
%11 = fneg float %10
store float %11, float* %2
br label %12
12: ; preds = %9, %7
%13 = load float, float* %2
ret float %13
}

LLVM IR (-O2):
define float @fabs(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
ret float %4
}
char *__rawmemchr(char *str, char ch) {
  while (*str != ch)
    str++;
  return str;
}


x86 assembly (clang, -O0):
<__rawmemchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     1132 <__rawmemchr+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110e <__rawmemchr+0xe>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rawmemchr>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
mov    %rax,%rcx
add    $0x1,%rax
cmp    %sil,0x1(%rcx)
jne    1110 <__rawmemchr+0x10>
ret

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

LLVM IR (-O2):
define i8* @__rawmemchr(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, %1
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
ret i8* %4
}
/* Variables and functions */
int f403(int *);
int f404(int *p) { return f403(p); }


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

x86 assembly (clang, -O2):
<f404>:
jmp    1030 <f403@plt>

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

LLVM IR (-O2):
define i32 @f404(i32* %0) {
%2 = tail call i32 @f403(i32* %0)
ret i32 %2
}
unsigned long measure_tsc_overhead(void) {
  unsigned long t0, t1, overhead = ~0UL;
  int i;
  for (i = 0; i < 10000; i++) {
    t0 = rdtscll();
    asm volatile("");
    t1 = rdtscllp();
    if (t1 - t0 < overhead)
      overhead = t1 - t0;
  }
  return overhead;
}


x86 assembly (clang, -O0):
<measure_tsc_overhead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0xffffffffffffffff,-0x18(%rbp)
ff
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2710,-0x1c(%rbp)
jge    118f <measure_tsc_overhead+0x6f>
mov    $0x0,%al
call   1030 <rdtscll@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rdtscllp@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    117c <measure_tsc_overhead+0x5c>
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1181 <measure_tsc_overhead+0x61>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <measure_tsc_overhead+0x17>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<measure_tsc_overhead>:
push   %r15
push   %r14
push   %rbx
mov    $0xffffffffffffffff,%rax
mov    $0x2710,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%r14
xor    %eax,%eax
call   1030 <rdtscll@plt>
movslq %eax,%r15
xor    %eax,%eax
call   1040 <rdtscllp@plt>
cltq
sub    %r15,%rax
cmp    %r14,%rax
cmovae %r14,%rax
add    $0xffffffff,%ebx
jne    1140 <measure_tsc_overhead+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @measure_tsc_overhead() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
store i64 -1, i64* %3
store i32 0, i32* %4
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 10000
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = call i32 (...) @rdtscll()
%10 = sext i32 %9 to i64
store i64 %10, i64* %1
%11 = call i32 (...) @rdtscllp()
%12 = sext i32 %11 to i64
store i64 %12, i64* %2
%13 = load i64, i64* %2
%14 = load i64, i64* %1
%15 = sub i64 %13, %14
%16 = load i64, i64* %3
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %8
%19 = load i64, i64* %2
%20 = load i64, i64* %1
%21 = sub i64 %19, %20
store i64 %21, i64* %3
br label %22
22: ; preds = %18, %8
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %5
26: ; preds = %5
%27 = load i64, i64* %3
ret i64 %27
}

LLVM IR (-O2):
define i64 @measure_tsc_overhead() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %11, %1 ]
%3 = phi i64 [ -1, %0 ], [ %10, %1 ]
%4 = tail call i32 (...) @rdtscll()
%5 = sext i32 %4 to i64
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
%6 = tail call i32 (...) @rdtscllp()
%7 = sext i32 %6 to i64
%8 = sub nsw i64 %7, %5
%9 = icmp ult i64 %8, %3
%10 = select i1 %9, i64 %8, i64 %3
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 10000
br i1 %12, label %13, label %1
13: ; preds = %1
ret i64 %10
}
/* Variables and functions */
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int id;
  id = getpid();
  printf("this process has id %d\n", id);
  id = getppid();
  printf("the parent process has id %d\n", id);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getppid@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"this process has id %d\0A\00"
@.str.1 = [30 x i8] c"the parent process has id %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @getpid()
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @getppid()
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"this process has id %d\0A\00"
@.str.1 = [30 x i8] c"the parent process has id %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @getppid()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ GLint;

/* Variables and functions */
int /*<<< orphan*/ glVertex2iv(int /*<<< orphan*/ *);
void Vertex2iv(GLint v[2]) { glVertex2iv(v); }


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

x86 assembly (clang, -O2):
<Vertex2iv>:
jmp    1030 <glVertex2iv@plt>

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

LLVM IR (-O2):
define void @Vertex2iv(i32* %0) {
%2 = tail call i32 @glVertex2iv(i32* %0)
ret void
}
void REMR3NotifyPhysRomRegister(void) {}


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

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

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

LLVM IR (-O2):
define void @REMR3NotifyPhysRomRegister() {
ret void
}
void fun(int signo) { return; }


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

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

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

LLVM IR (-O2):
define void @fun(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __gettid();
int getpid();
int /*<<< orphan*/ printf(char *, int, int, int /*<<< orphan*/);
void sighandler(int num) {
  printf("signal %d, pid=%d, tid=%ld\n", num, getpid(), __gettid());
}


x86 assembly (clang, -O0):
<sighandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <__gettid@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    %eax,%ecx
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sighandler>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <__gettid@plt>
lea    0xeb4(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"signal %d, pid=%d, tid=%ld\0A\00"
define void @sighandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (...) @getpid()
%5 = call i32 (...) @__gettid()
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"signal %d, pid=%d, tid=%ld\0A\00"
define void @sighandler(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @__gettid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2, i32 %3)
ret void
}
/* Type definitions */
struct gengetopt_args_info {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
int options_required(struct gengetopt_args_info *args_info,
                     const char *prog_name) {
  (void)(args_info);
  (void)(prog_name);
  return EXIT_SUCCESS;
}


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

x86 assembly (clang, -O2):
<options_required>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.gengetopt_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @options_required(%struct.gengetopt_args_info* %0, i8* %1) {
%3 = alloca %struct.gengetopt_args_info*
%4 = alloca i8*
store %struct.gengetopt_args_info* %0, %struct.gengetopt_args_info** %3
store i8* %1, i8** %4
%5 = load %struct.gengetopt_args_info*, %struct.gengetopt_args_info** %3
%6 = load i8*, i8** %4
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
%struct.gengetopt_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @options_required(%struct.gengetopt_args_info* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
bool same_string(const char *a, const char *b) {
  return !strcmp(a ?: "", b ?: "");
}


x86 assembly (clang, -O0):
<same_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     113f <same_string+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    114f <same_string+0x3f>
lea    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    114f <same_string+0x3f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1176 <same_string+0x66>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1186 <same_string+0x76>
lea    0xe83(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    1186 <same_string+0x76>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<same_string>:
push   %rax
test   %rdi,%rdi
lea    0xee5(%rip),%rax
cmove  %rax,%rdi
test   %rsi,%rsi
cmove  %rax,%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @same_string(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %8, %7
%10 = phi i8* [ %5, %7 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %8 ]
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %9
br label %15
14: ; preds = %9
br label %15
15: ; preds = %14, %13
%16 = phi i8* [ %11, %13 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %14 ]
%17 = call i32 @strcmp(i8* %10, i8* %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @same_string(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%5 = icmp eq i8* %1, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %1
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}