xunge/DecIR huggingface dataset:
/* Type definitions */
union i2c_smbus_data {
  int /*<<< orphan*/ byte;
};
typedef int /*<<< orphan*/ __u8;
typedef int /*<<< orphan*/ __s32;

/* Variables and functions */
int /*<<< orphan*/ I2C_SMBUS_BYTE_DATA;
int /*<<< orphan*/ I2C_SMBUS_WRITE;
int /*<<< orphan*/ i2c_smbus_access(int, int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/, union i2c_smbus_data *);
__s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value) {
  union i2c_smbus_data data;
  data.byte = value;
  return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA,
                          &data);
}


x86 assembly (clang, -O0):
<i2c_smbus_write_byte_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2eab(%rip),%rax
mov    (%rax),%ecx
lea    -0x10(%rbp),%r8
call   1030 <i2c_smbus_access@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_smbus_write_byte_data>:
push   %rax
mov    %esi,%eax
mov    %edx,(%rsp)
mov    0x2ebb(%rip),%rcx
mov    (%rcx),%esi
mov    0x2ec2(%rip),%rcx
mov    (%rcx),%ecx
mov    %rsp,%r8
mov    %eax,%edx
call   1030 <i2c_smbus_access@plt>
pop    %rcx
ret

LLVM IR (-O0):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_BYTE_DATA = global i32 0
define i32 @i2c_smbus_write_byte_data(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %union.i2c_smbus_data
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = bitcast %union.i2c_smbus_data* %7 to i32*
store i32 %8, i32* %9
%10 = load i32, i32* %4
%11 = load i32, i32* @I2C_SMBUS_WRITE
%12 = load i32, i32* %5
%13 = load i32, i32* @I2C_SMBUS_BYTE_DATA
%14 = call i32 @i2c_smbus_access(i32 %10, i32 %11, i32 %12, i32 %13, %union.i2c_smbus_data* %7)
ret i32 %14
}

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_BYTE_DATA = global i32 0
define i32 @i2c_smbus_write_byte_data(i32 %0, i32 %1, i32 %2) {
%4 = alloca %union.i2c_smbus_data
%5 = bitcast %union.i2c_smbus_data* %4 to i8*
%6 = getelementptr inbounds %union.i2c_smbus_data, %union.i2c_smbus_data* %4, i64 0, i32 0
store i32 %2, i32* %6
%7 = load i32, i32* @I2C_SMBUS_WRITE
%8 = load i32, i32* @I2C_SMBUS_BYTE_DATA
%9 = call i32 @i2c_smbus_access(i32 %0, i32 %7, i32 %1, i32 %8, %union.i2c_smbus_data* %4)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ f(unsigned int);
int main() {
  if (f((~0U) >> 1))
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7fffffff,%edi
call   1040 <f@plt>
cmp    $0x0,%rax
je     115a <main+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7fffffff,%edi
call   1040 <f@plt>
test   %rax,%rax
jne    1147 <main+0x17>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @f(i32 2147483647)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @f(i32 2147483647)
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ uputs(int, char *);
int main(void) {
  uputs(0xC0200000, "Hello world!\n");
  exit(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc0200000,%edi
lea    0xec5(%rip),%rsi
call   1030 <uputs@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0xc0200000,%edi
call   1030 <uputs@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @uputs(i32 -1071644672, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello world!\0A\00"
define i32 @main() {
%1 = tail call i32 @uputs(i32 -1071644672, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ pi();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  printf("The value of PI is : %.5Lf\n", pi());
  return 0;
}


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    $0x0,%al
call   1040 <pi@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [28 x i8] c"The value of PI is : %.5Lf\0A\00"
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 = call i32 (...) @pi()
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"The value of PI is : %.5Lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @pi()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
void kml_rd_init(const char *fname) {
  fatal("kml"
        ": This build excluded KML support because expat was not installed.\n");
}


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

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

LLVM IR (-O0):
@.str = [71 x i8] c"kml: This build excluded KML support because expat was not installed.\0A\00"
define void @kml_rd_init(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @fatal(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [71 x i8] c"kml: This build excluded KML support because expat was not installed.\0A\00"
define void @kml_rd_init(i8* nocapture readnone %0) {
%2 = tail call i32 @fatal(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void Close_Log_File() { closelog(); }


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

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

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

LLVM IR (-O2):
define void @Close_Log_File() {
%1 = tail call i32 (...) @closelog()
ret void
}
/* Variables and functions */
int simple_match(void const *, void const *, size_t, int);
int bu_opposite(const void *left, const void *right, size_t n) {
  return simple_match(left, right, n, (0 | (1 << 1) | (1 << 2) | 0));
}


x86 assembly (clang, -O0):
<bu_opposite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x6,%ecx
call   1030 <simple_match@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bu_opposite>:
mov    $0x6,%ecx
jmp    1030 <simple_match@plt>

LLVM IR (-O0):
define i32 @bu_opposite(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @simple_match(i8* %7, i8* %8, i64 %9, i32 6)
ret i32 %10
}

LLVM IR (-O2):
define i32 @bu_opposite(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @simple_match(i8* %0, i8* %1, i64 %2, i32 6)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo(void) { printf("OK\n"); }


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

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

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

LLVM IR (-O2):
@str = [3 x i8] c"OK\00"
define void @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, int);
int get_plugin_info(int opcode, char *buf, int buflen) {
  switch (opcode) {
  case 0:
    strncpy(buf, "irmcd notify plugin", buflen - 1);
    buf[buflen - 1] = '\0';
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_plugin_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
test   %eax,%eax
jne    1159 <get_plugin_info+0x49>
jmp    1132 <get_plugin_info+0x22>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
lea    0xebd(%rip),%rsi
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_plugin_info>:
test   %edi,%edi
je     1117 <get_plugin_info+0x7>
xor    %eax,%eax
ret
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
movslq %edx,%r14
lea    -0x1(%r14),%rdx
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strncpy@plt>
movb   $0x0,-0x1(%rbx,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [20 x i8] c"irmcd notify plugin\00"
define i32 @get_plugin_info(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 = load i32, i32* %4
switch i32 %7, label %18 [
i32 0, label %8
]
8: ; preds = %3
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 1
%12 = call i32 @strncpy(i8* %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %3, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"irmcd notify plugin\00"
define i32 @get_plugin_info(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = add nsw i32 %2, -1
%7 = tail call i32 @strncpy(i8* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 0, i8* %9
br label %10
10: ; preds = %3, %5
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *timestr(time_t t) {
  static char str[64];
  struct tm *tm;
  tm = localtime(&t);
  strftime(str, 64, "%a %b %d %I:%M:%S%P", tm);
  return str;
}


x86 assembly (clang, -O0):
<timestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0x2efd(%rip),%rdi
mov    $0x40,%esi
lea    0xeb1(%rip),%rdx
call   1040 <strftime@plt>
lea    0x2ee5(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestr>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0x2f06(%rip),%rbx
lea    0xebf(%rip),%rdx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %rax,%rcx
call   1040 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@timestr.str = internal global [64 x i8] zeroinitializer
@.str = [20 x i8] c"%a %b %d %I:%M:%S%P\00"
define i8* @timestr(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 %0, i32* %2
%4 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %4, %struct.tm** %3
%5 = load %struct.tm*, %struct.tm** %3
%6 = call i32 @strftime(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timestr.str, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timestr.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@timestr.str = internal global [64 x i8] zeroinitializer
@.str = [20 x i8] c"%a %b %d %I:%M:%S%P\00"
define i8* @timestr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @localtime(i32* %2)
%4 = call i32 @strftime(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timestr.str, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timestr.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ fork();
int /*<<< orphan*/ listening_raw();
void init_serv() {
  pid_t childPID;
  childPID = fork();
  if (!childPID) {
    listening_raw();
  }
}


x86 assembly (clang, -O0):
<init_serv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1143 <init_serv+0x23>
mov    $0x0,%al
call   1030 <listening_raw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_serv>:
push   %rax
xor    %eax,%eax
call   1040 <fork@plt>
test   %eax,%eax
je     112e <init_serv+0xe>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <listening_raw@plt>

LLVM IR (-O0):
define void @init_serv() {
%1 = alloca i32
%2 = call i32 (...) @fork()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 (...) @listening_raw()
br label %7
7: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
define void @init_serv() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @listening_raw()
br label %5
5: ; preds = %3, %0
ret void
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double sgs_GetTime() {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return (double)ts.tv_sec + 0.000000001 * (double)ts.tv_nsec;
}


x86 assembly (clang, -O0):
<sgs_GetTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgs_GetTime>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xec3(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define double @sgs_GetTime() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %9, double %6)
ret double %10
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define double @sgs_GetTime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = call double @llvm.fmuladd.f64(double %10, double 1.000000e-09, double %7)
ret double %11
}
/* Variables and functions */
int get_add2(int, int, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void print_add2(int a, int b, int mask) {
  int f, r;
  f = get_add2(a, b, &r);
  f &= mask;
  printf("add"
         " 2"
         " %08x %08x %08x %08x %08x\n",
         a, b, r, f, mask);
}


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

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

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

LLVM IR (-O2):
@.str = [32 x i8] c"add 2 %08x %08x %08x %08x %08x\0A\00"
define void @print_add2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @get_add2(i32 %0, i32 %1, i32* %4)
%7 = and i32 %6, %2
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %8, i32 %7, i32 %2)
ret void
}
void __attribute__((destructor)) eixt_entry(void) {
  printf("The __exit__function[%s]\n", __FUNCTION__);
}


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

x86 assembly (clang, -O2):
<eixt_entry>:
lea    0xee9(%rip),%rdi
lea    0xefc(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"The __exit__function[%s]\0A\00"
@__FUNCTION__.eixt_entry = [11 x i8] c"eixt_entry\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @eixt_entry, i8* null }]
define void @eixt_entry() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.eixt_entry, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"The __exit__function[%s]\0A\00"
@__FUNCTION__.eixt_entry = [11 x i8] c"eixt_entry\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @eixt_entry, i8* null }]
define void @eixt_entry() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.eixt_entry, i64 0, i64 0))
ret void
}
void idle() {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<idle>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <idle+0x9>
jmp    1109 <idle+0x9>

x86 assembly (clang, -O2):
<idle>:
jmp    1100 <idle>

LLVM IR (-O0):
define void @idle() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @idle() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ longjmp(int /*<<< orphan*/, int);
void jmpfunction(jmp_buf env_buf) { longjmp(env_buf, 1); }


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

x86 assembly (clang, -O2):
<jmpfunction>:
push   %rax
mov    $0x1,%esi
call   1030 <longjmp@plt>

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

LLVM IR (-O2):
define void @jmpfunction(i32 %0) {
%2 = tail call i32 @longjmp(i32 %0, i32 1)
unreachable
}
unsigned int BKDRHash(char *str) {
  static unsigned int seed = 13131;
  unsigned int hash = 0;
  while (*str)
    hash = hash * seed + (*str++);
  return (hash & 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<BKDRHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <BKDRHash+0x42>
mov    -0xc(%rbp),%eax
imul   0x2efa(%rip),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <BKDRHash+0xf>
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BKDRHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <BKDRHash+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x334b,%eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BKDRHash+0x10>
and    $0x7fffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @BKDRHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 13131
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
int test_imm_4Aint16_mem(short *val) {
  return ((*val) & (-0x4A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_4Aint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -74
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void ar5312_init_devices(void) {}


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

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

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

LLVM IR (-O2):
define void @ar5312_init_devices() {
ret void
}
/* Variables and functions */
scalar_t__ logb(double);
float logbf(float x) { return (float)logb((double)x); }


x86 assembly (clang, -O0):
<logbf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <logb@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logbf>:
push   %rax
cvtss2sd %xmm0,%xmm0
call   1030 <logb@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @logbf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call i64 @logb(double %4)
%6 = sitofp i64 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @logbf(float %0) {
%2 = fpext float %0 to double
%3 = tail call i64 @logb(double %2)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ _IO(int, int);
int ioctl(int, int /*<<< orphan*/);
int cbm_reset(int f) { return ioctl(f, _IO(0xcb, 6)); }


x86 assembly (clang, -O0):
<cbm_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0xcb,%edi
mov    $0x6,%esi
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbm_reset>:
push   %rbx
mov    %edi,%ebx
mov    $0xcb,%edi
mov    $0x6,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @cbm_reset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_IO(i32 203, i32 6)
%5 = call i32 @ioctl(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @cbm_reset(i32 %0) {
%2 = tail call i32 @_IO(i32 203, i32 6)
%3 = tail call i32 @ioctl(i32 %0, i32 %2)
ret i32 %3
}
int test_imm_2Fuint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x2F << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_2Fuint64_highword_reg>:
movabs $0x2f00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Fuint64_highword_reg(i64 %0) {
%2 = and i64 %0, 201863462912
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
int File_exist(const char *filename) {
  struct stat buffer;
  if (stat(filename, &buffer) == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<File_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    113f <File_exist+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1146 <File_exist+0x36>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @File_exist(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @File_exist(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
uint64_t mp_sqr_521(uint64_t c[18], uint64_t a[9]) {
  c[0] = a[1] + a[2];
  return 0;
}


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

x86 assembly (clang, -O2):
<mp_sqr_521>:
mov    0x10(%rsi),%rax
add    0x8(%rsi),%rax
mov    %rax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @mp_sqr_521(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 = getelementptr inbounds i64, i64* %5, i64 1
%7 = load i64, i64* %6
%8 = load i64*, i64** %4
%9 = getelementptr inbounds i64, i64* %8, i64 2
%10 = load i64, i64* %9
%11 = add nsw i64 %7, %10
%12 = load i64*, i64** %3
%13 = getelementptr inbounds i64, i64* %12, i64 0
store i64 %11, i64* %13
ret i64 0
}

LLVM IR (-O2):
define i64 @mp_sqr_521(i64* nocapture writeonly %0, i64* nocapture %1) {
%3 = getelementptr inbounds i64, i64* %1, i64 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds i64, i64* %1, i64 2
%6 = load i64, i64* %5
%7 = add nsw i64 %6, %4
store i64 %7, i64* %0
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ i2c_send_raw(int);
int /*<<< orphan*/ i2c_start();
void i2c_start_data() {
  i2c_start();
  i2c_send_raw(0x40);
}


x86 assembly (clang, -O0):
<i2c_start_data>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <i2c_start@plt>
mov    $0x40,%edi
call   1030 <i2c_send_raw@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_start_data>:
push   %rax
xor    %eax,%eax
call   1040 <i2c_start@plt>
mov    $0x40,%edi
pop    %rax
jmp    1030 <i2c_send_raw@plt>

LLVM IR (-O0):
define void @i2c_start_data() {
%1 = call i32 (...) @i2c_start()
%2 = call i32 @i2c_send_raw(i32 64)
ret void
}

LLVM IR (-O2):
define void @i2c_start_data() {
%1 = tail call i32 (...) @i2c_start()
%2 = tail call i32 @i2c_send_raw(i32 64)
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ sprintf(char *, char *, int);
void randomFone(char *fone, int dim) {
  int i;
  for (i = 0; i < dim; i++) {
    sprintf(&fone[i], "%d", rand() % 9);
  }
}


x86 assembly (clang, -O0):
<randomFone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117e <randomFone+0x5e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    -0x18(%rbp),%rdi
mov    $0x9,%ecx
cltd
idiv   %ecx
lea    0xe95(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <randomFone+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomFone>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1178 <randomFone+0x58>
mov    %rdi,%rbx
mov    %esi,%r15d
lea    0xeca(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rdx
imul   $0x38e38e39,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,8),%eax
sub    %eax,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
add    $0x1,%rbx
add    $0xffffffffffffffff,%r15
jne    1140 <randomFone+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @randomFone(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 9
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @randomFone(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 9
%11 = tail call i32 @sprintf(i8* dereferenceable(1) %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
double sign(double x) {
  if (x > 0.)
    return 1.;
  else if (x < 0.)
    return -1.;
  else
    return 0.;
}


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    112d <sign+0x2d>
movsd  0xee5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1155 <sign+0x55>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    114d <sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1155 <sign+0x55>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
cmpltsd %xmm1,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
cmpltsd %xmm0,%xmm1
movsd  0xee2(%rip),%xmm0
andpd  %xmm1,%xmm0
andnpd %xmm3,%xmm1
orpd   %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @sign(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = fcmp olt double %0, 0.000000e+00
%4 = select i1 %3, double -1.000000e+00, double 0.000000e+00
%5 = select i1 %2, double 1.000000e+00, double %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ convert_linear_index_to_3d_indices_inline(int, int, int, int,
                                                             int, int, int);
void convert_linear_index_to_3d_indices(int linear_index, int nx, int ny,
                                        int nz, int *index_vector) {
  convert_linear_index_to_3d_indices_inline(linear_index, nx, ny, nz,
                                            index_vector[0], index_vector[1],
                                            index_vector[2]);
}


x86 assembly (clang, -O0):
<convert_linear_index_to_3d_indices>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    (%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,(%rsp)
call   1030 <convert_linear_index_to_3d_indices_inline@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_linear_index_to_3d_indices>:
push   %rax
mov    (%r8),%r10d
mov    0x4(%r8),%r9d
mov    0x8(%r8),%eax
mov    %eax,(%rsp)
mov    %r10d,%r8d
call   1030 <convert_linear_index_to_3d_indices_inline@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @convert_linear_index_to_3d_indices(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32*, i32** %10
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = load i32*, i32** %10
%19 = getelementptr inbounds i32, i32* %18, i64 1
%20 = load i32, i32* %19
%21 = load i32*, i32** %10
%22 = getelementptr inbounds i32, i32* %21, i64 2
%23 = load i32, i32* %22
%24 = call i32 @convert_linear_index_to_3d_indices_inline(i32 %11, i32 %12, i32 %13, i32 %14, i32 %17, i32 %20, i32 %23)
ret void
}

LLVM IR (-O2):
define void @convert_linear_index_to_3d_indices(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4) {
%6 = load i32, i32* %4
%7 = getelementptr inbounds i32, i32* %4, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %4, i64 2
%10 = load i32, i32* %9
%11 = tail call i32 @convert_linear_index_to_3d_indices_inline(i32 %0, i32 %1, i32 %2, i32 %3, i32 %6, i32 %8, i32 %10)
ret void
}
int compute(double *px, int x) {
  if (x > 100) {
    return *px * x;
  } else {
    return x * 2;
  }
}


x86 assembly (clang, -O0):
<compute>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jle    1132 <compute+0x32>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    113b <compute+0x3b>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute>:
mov    %esi,%eax
cmp    $0x65,%esi
jl     1114 <compute+0x14>
cvtsi2sd %eax,%xmm0
mulsd  (%rdi),%xmm0
cvttsd2si %xmm0,%eax
ret
add    %eax,%eax
ret

LLVM IR (-O0):
define i32 @compute(double* %0, i32 %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sgt i32 %6, 100
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load double*, double** %4
%10 = load double, double* %9
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
%13 = fmul double %10, %12
%14 = fptosi double %13 to i32
store i32 %14, i32* %3
br label %18
15: ; preds = %2
%16 = load i32, i32* %5
%17 = mul nsw i32 %16, 2
store i32 %17, i32* %3
br label %18
18: ; preds = %15, %8
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @compute(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 100
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load double, double* %0
%6 = sitofp i32 %1 to double
%7 = fmul double %5, %6
%8 = fptosi double %7 to i32
br label %11
9: ; preds = %2
%10 = shl nsw i32 %1, 1
br label %11
11: ; preds = %9, %4
%12 = phi i32 [ %8, %4 ], [ %10, %9 ]
ret i32 %12
}
void rop3_44_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = *D | S;
  stk2 = T & stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


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

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

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

LLVM IR (-O2):
define void @rop3_44_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = and i8 %5, %2
%7 = xor i8 %6, %1
%8 = xor i8 %2, -1
%9 = or i8 %7, %8
%10 = and i8 %9, %1
%11 = xor i8 %1, -1
%12 = and i8 %11, %2
%13 = and i8 %12, %4
%14 = or i8 %10, %13
store i8 %14, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test(int);
int main() {
  printf("First pass...\n");
  test(1);
  printf("Second pass...\n");
  test(0);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <test@plt>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"First pass...\0A\00"
@.str.1 = [16 x i8] c"Second pass...\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @test(i32 1)
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @test(i32 0)
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"First pass...\00"
@str.2 = [15 x i8] c"Second pass...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @test(i32 1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
%4 = tail call i32 @test(i32 0)
ret i32 0
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<getpeername>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ed2(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb9(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getpeername>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @getpeername(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32*
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32* %2, i32** %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @getpeername(i32 %0, %struct.sockaddr* nocapture readnone %1, i32* nocapture readnone %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}