xunge/DecIR huggingface dataset:
/* Variables and functions */
long find_type(char *);
int /*<<< orphan*/ get_expected(int, long, char *);
int /*<<< orphan*/ get_must(int, char *);
int /*<<< orphan*/ insert_name(char *, int);
int encr_xform(int fd, char *loctoken) {
  long tmp;
  get_must(fd, loctoken);
  if ((tmp = find_type(loctoken)) != 0x104)
    get_expected(fd, tmp, loctoken);
  insert_name(loctoken, 3);
  return 3;
}


x86 assembly (clang, -O0):
<encr_xform>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <get_must@plt>
mov    -0x10(%rbp),%rdi
call   1040 <find_type@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x104,%rax
je     1184 <encr_xform+0x44>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <get_expected@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <insert_name@plt>
mov    $0x3,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encr_xform>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1060 <get_must@plt>
mov    %rbx,%rdi
call   1040 <find_type@plt>
cmp    $0x104,%rax
je     116a <encr_xform+0x2a>
mov    %ebp,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1050 <get_expected@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <insert_name@plt>
mov    $0x3,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @encr_xform(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = load i8*, i8** %4
%8 = call i32 @get_must(i32 %6, i8* %7)
%9 = load i8*, i8** %4
%10 = call i64 @find_type(i8* %9)
store i64 %10, i64* %5
%11 = icmp ne i64 %10, 260
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* %3
%14 = load i64, i64* %5
%15 = load i8*, i8** %4
%16 = call i32 @get_expected(i32 %13, i64 %14, i8* %15)
br label %17
17: ; preds = %12, %2
%18 = load i8*, i8** %4
%19 = call i32 @insert_name(i8* %18, i32 3)
ret i32 3
}

LLVM IR (-O2):
define i32 @encr_xform(i32 %0, i8* %1) {
%3 = tail call i32 @get_must(i32 %0, i8* %1)
%4 = tail call i64 @find_type(i8* %1)
%5 = icmp eq i64 %4, 260
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @get_expected(i32 %0, i64 %4, i8* %1)
br label %8
8: ; preds = %6, %2
%9 = tail call i32 @insert_name(i8* %1, i32 3)
ret i32 3
}
/* Type definitions */
typedef int /*<<< orphan*/ __s32;

/* Variables and functions */
int /*<<< orphan*/ I2C_SMBUS_BYTE;
int /*<<< orphan*/ I2C_SMBUS_WRITE;
int /*<<< orphan*/ i2c_smbus_access(int, int /*<<< orphan*/, int,
                                    int /*<<< orphan*/, int /*<<< orphan*/ *);
__s32 i2c_smbus_write_byte(int fd, int value) {
  return i2c_smbus_access(fd, I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
}


x86 assembly (clang, -O0):
<i2c_smbus_write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2eb4(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <i2c_smbus_access@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_smbus_write_byte>:
mov    %esi,%edx
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
mov    0x2ec6(%rip),%rax
mov    (%rax),%ecx
xor    %r8d,%r8d
jmp    1030 <i2c_smbus_access@plt>

LLVM IR (-O0):
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_BYTE = global i32 0
define i32 @i2c_smbus_write_byte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* @I2C_SMBUS_WRITE
%7 = load i32, i32* %4
%8 = load i32, i32* @I2C_SMBUS_BYTE
%9 = call i32 @i2c_smbus_access(i32 %5, i32 %6, i32 %7, i32 %8, i32* null)
ret i32 %9
}

LLVM IR (-O2):
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_BYTE = global i32 0
define i32 @i2c_smbus_write_byte(i32 %0, i32 %1) {
%3 = load i32, i32* @I2C_SMBUS_WRITE
%4 = load i32, i32* @I2C_SMBUS_BYTE
%5 = tail call i32 @i2c_smbus_access(i32 %0, i32 %3, i32 %1, i32 %4, i32* null)
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int isFree(void *buffer, uint32_t pos) {
  uint32_t nbyte = pos / 8;
  int nbit = pos % 8;
  char *ptr = buffer + nbyte;
  return !((*ptr) & (1 << nbit));
}


x86 assembly (clang, -O0):
<isFree>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isFree>:
mov    %esi,%ecx
lea    0x7(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x3,%eax
cltq
movsbl (%rdi,%rax,1),%eax
not    %eax
and    $0x7,%cl
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isFree(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = sdiv i32 %8, 8
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = srem i32 %10, 8
store i32 %11, i32* %6
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr i8, i8* %12, i64 %14
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i32, i32* %6
%20 = shl i32 1, %19
%21 = and i32 %18, %20
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @isFree(i8* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 8
%4 = sext i32 %3 to i64
%5 = getelementptr i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = and i32 %1, 7
%8 = xor i8 %6, -1
%9 = sext i8 %8 to i32
%10 = lshr i32 %9, %7
%11 = and i32 %10, 1
ret i32 %11
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ finalise();
int /*<<< orphan*/ init(int, char **);
int main(int argc, char **argv) {
  init(argc, argv);
  finalise();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <init@plt>
mov    $0x0,%al
call   1040 <finalise@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <init@plt>
xor    %eax,%eax
call   1040 <finalise@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @init(i32 %6, i8** %7)
%9 = call i32 (...) @finalise()
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @init(i32 %0, i8** %1)
%4 = tail call i32 (...) @finalise()
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char a, b;
  scanf("%c", &a);
  b = 'a' + 'z' - a;
  printf("\n%c", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%ecx
mov    $0xdb,%eax
sub    %ecx,%eax
mov    %al,-0x6(%rbp)
lea    0xeac(%rip),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed9(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xdb,%al
sub    0x7(%rsp),%al
movsbl %al,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"\0A%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = sub nsw i32 219, %6
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i8, i8* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"\0A%c\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = sub i8 -37, %3
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ uart_putc(char);
void uart_puts(char *s) {
  for (; *s != '\0'; ++s) {
    uart_putc(*s);
  }
}


x86 assembly (clang, -O0):
<uart_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <uart_puts+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <uart_putc@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <uart_puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <uart_puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <uart_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <uart_puts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @uart_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @uart_putc(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lua_reportbug(char *);
void orderFB(void) { lua_reportbug("unexpected type at comparison"); }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"unexpected type at comparison\00"
define void @orderFB() {
%1 = call i32 @lua_reportbug(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"unexpected type at comparison\00"
define void @orderFB() {
%1 = tail call i32 @lua_reportbug(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_dvector(double *v, int nl, int nh) { free((void *)(v + nl)); }


x86 assembly (clang, -O0):
<free_dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dvector>:
movslq %esi,%rax
lea    (%rdi,%rax,8),%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_dvector(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %7, i64 %9
%11 = bitcast double* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_dvector(double* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = bitcast double* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
int mysql_errno(int /*<<< orphan*/ *);
char *mysql_error(int /*<<< orphan*/ *);
scalar_t__ mysql_query(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, int, char *);
void dropDb(MYSQL *connection) {
  if (mysql_query(connection, "DROP DATABASE benchmark")) {
    printf("dropDb::Error %u: %s\n", mysql_errno(connection),
           mysql_error(connection));
  }
}


x86 assembly (clang, -O0):
<dropDb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <mysql_query@plt>
cmp    $0x0,%rax
je     118d <dropDb+0x4d>
mov    -0x8(%rbp),%rdi
call   1050 <mysql_errno@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <mysql_error@plt>
mov    -0xc(%rbp),%esi
mov    %rax,%rdx
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dropDb>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb3(%rip),%rsi
call   1030 <mysql_query@plt>
test   %rax,%rax
je     1180 <dropDb+0x40>
mov    %rbx,%rdi
call   1050 <mysql_errno@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <mysql_error@plt>
lea    0xea8(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"DROP DATABASE benchmark\00"
@.str.1 = [22 x i8] c"dropDb::Error %u: %s\0A\00"
define void @dropDb(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @mysql_query(i32* %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = call i32 @mysql_errno(i32* %7)
%9 = load i32*, i32** %2
%10 = call i8* @mysql_error(i32* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %10)
br label %12
12: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"DROP DATABASE benchmark\00"
@.str.1 = [22 x i8] c"dropDb::Error %u: %s\0A\00"
define void @dropDb(i32* %0) {
%2 = tail call i64 @mysql_query(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @mysql_errno(i32* %0)
%6 = tail call i8* @mysql_error(i32* %0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
br label %8
8: ; preds = %4, %1
ret void
}
void handle_TTOU(sig) int sig;
{}


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

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

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

LLVM IR (-O2):
define void @handle_TTOU(i32 %0) {
ret void
}
void gtk_event_box_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_event_box_get_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void moveable_function(void) {
  fprintf(stdout, "Hello from lib2_moveable.c\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<moveable_function>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<moveable_function>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [28 x i8] c"Hello from lib2_moveable.c\0A\00"
define void @moveable_function() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [28 x i8] c"Hello from lib2_moveable.c\0A\00"
define void @moveable_function() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
int __send_to_ppe(int, int, char const **);
int shm_unlink(const char *name) { return __send_to_ppe(0x2101, 22, &name); }


x86 assembly (clang, -O0):
<shm_unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2101,%edi
mov    $0x16,%esi
lea    -0x8(%rbp),%rdx
call   1030 <__send_to_ppe@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shm_unlink>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdx
mov    $0x2101,%edi
mov    $0x16,%esi
call   1030 <__send_to_ppe@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @shm_unlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @__send_to_ppe(i32 8449, i32 22, i8** %2)
ret i32 %3
}

LLVM IR (-O2):
define i32 @shm_unlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @__send_to_ppe(i32 8449, i32 22, i8** %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *strip_whitesp(char *);
int main() {
  char s[] = "       crap     ";
  printf("Before:'%s'\n", s);
  printf("After:'%s'\n", strip_whitesp(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%al
mov    %al,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strip_whitesp@plt>
mov    %rax,%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
lea    0xed5(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <strip_whitesp@plt>
lea    0xec8(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [17 x i8] c" crap \00"
@.str = [13 x i8] c"Before:'%s'\0A\00"
@.str.1 = [12 x i8] c"After:'%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i8]
store i32 0, i32* %1
%3 = bitcast [17 x i8]* %2 to i8*
%4 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%7 = call i8* @strip_whitesp(i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [17 x i8] c" crap \00"
@.str = [13 x i8] c"Before:'%s'\0A\00"
@.str.1 = [12 x i8] c"After:'%s'\0A\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i8* @strip_whitesp(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ testTable();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand(time(NULL));
  testTable();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1030 <testTable@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1030 <testTable@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = call i32 (...) @testTable()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @testTable()
ret i32 0
}
double dsquare(double a) { return a * a; }


x86 assembly (clang, -O0):
<dsquare>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsquare>:
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @dsquare(double %0) {
%2 = fmul double %0, %0
ret double %2
}
float fabs2(float a) {
  int tmp = *(int *)&a;
  tmp &= 0x7FFFFFFF;
  return *(float *)&tmp;
}


x86 assembly (clang, -O0):
<fabs2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs2>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define float @fabs2(float %0) {
%2 = alloca float
%3 = alloca i32
store float %0, float* %2
%4 = bitcast float* %2 to i32*
%5 = load i32, i32* %4
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, 2147483647
store i32 %7, i32* %3
%8 = bitcast i32* %3 to float*
%9 = load float, float* %8
ret float %9
}

LLVM IR (-O2):
define float @fabs2(float %0) {
%2 = bitcast float %0 to i32
%3 = and i32 %2, 2147483647
%4 = bitcast i32 %3 to float
ret float %4
}
/* Variables and functions */
double log(double);
double qexp(const double p, const double lambda) {
  return -(1.0 / lambda) * log(1.0 - p);
}


x86 assembly (clang, -O0):
<qexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xead(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qexp>:
push   %rax
movsd  0xee7(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
movsd  0xede(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <log@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @qexp(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fdiv double 1.000000e+00, %5
%7 = fneg double %6
%8 = load double, double* %3
%9 = fsub double 1.000000e+00, %8
%10 = call double @log(double %9)
%11 = fmul double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @qexp(double %0, double %1) {
%3 = fdiv double -1.000000e+00, %1
%4 = fsub double 1.000000e+00, %0
%5 = tail call double @log(double %4)
%6 = fmul double %3, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int om_gps_open(void) { return open("/dev/ttySAC1", O_RDWR); }


x86 assembly (clang, -O0):
<om_gps_open>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <open@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<om_gps_open>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <open@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/ttySAC1\00"
@O_RDWR = global i32 0
define i32 @om_gps_open() {
%1 = load i32, i32* @O_RDWR
%2 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/ttySAC1\00"
@O_RDWR = global i32 0
define i32 @om_gps_open() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *tmpfile();
FILE *tempfile(void) { return tmpfile(); }


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

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

LLVM IR (-O0):
define i32* @tempfile() {
%1 = call i32* (...) @tmpfile()
ret i32* %1
}

LLVM IR (-O2):
define noalias i32* @tempfile() {
%1 = tail call i32* (...) @tmpfile()
ret i32* %1
}
void Hal_hook_wr_sgndrecfield_recelemc(void) {}


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

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

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

LLVM IR (-O2):
define void @Hal_hook_wr_sgndrecfield_recelemc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int tlib2func();
int tlib7func() {
  printf("This is T7\n");
  if (tlib2func() != 2) {
    fprintf(stderr, "Something wrong with T2\n");
    return 1;
  }
  return 7;
}


x86 assembly (clang, -O0):
<tlib7func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <tlib2func@plt>
cmp    $0x2,%eax
je     1175 <tlib7func+0x45>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    117c <tlib7func+0x4c>
movl   $0x7,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlib7func>:
push   %rax
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <tlib2func@plt>
mov    %eax,%ecx
mov    $0x7,%eax
cmp    $0x2,%ecx
je     116a <tlib7func+0x3a>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"This is T7\0A\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"Something wrong with T2\0A\00"
define i32 @tlib7func() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @tlib2func()
%4 = icmp ne i32 %3, 2
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %9
8: ; preds = %0
store i32 7, i32* %1
br label %9
9: ; preds = %8, %5
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [25 x i8] c"Something wrong with T2\0A\00"
@str = [11 x i8] c"This is T7\00"
define i32 @tlib7func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @tlib2func()
%3 = icmp eq i32 %2, 2
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %0, %4
%8 = phi i32 [ 1, %4 ], [ 7, %0 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int);
void mergeSort(int *Array, int arraySize) {
  if (arraySize < 2)
    return;
  int middle = arraySize / 2;
  mergeSort(Array, middle);
  mergeSort(Array + middle, arraySize - middle);
  merge(Array, arraySize, middle);
}


x86 assembly (clang, -O0):
<mergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    113e <mergeSort+0x1e>
jmp    1181 <mergeSort+0x61>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <merge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
cmp    $0x1,%esi
jg     1126 <mergeSort+0x6>
ret
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
mov    %ebx,%esi
call   1030 <mergeSort@plt>
lea    (%r14,%rbx,4),%rdi
mov    %ebp,%esi
sub    %ebx,%esi
call   1030 <mergeSort@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <merge@plt>

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

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %4, label %5
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = lshr i32 %1, 1
tail call void @mergeSort(i32* %0, i32 %6)
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = sub nsw i32 %1, %6
tail call void @mergeSort(i32* %8, i32 %9)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %6)
br label %4
}
long tclog2l(long num) {
  if (num <= 1)
    return 0;
  num >>= 1;
  long rv = 0;
  while (num > 0) {
    rv++;
    num >>= 1;
  }
  return rv;
}


x86 assembly (clang, -O0):
<tclog2l>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
jg     1120 <tclog2l+0x20>
movq   $0x0,-0x8(%rbp)
jmp    1164 <tclog2l+0x64>
mov    -0x10(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    115c <tclog2l+0x5c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <tclog2l+0x34>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tclog2l>:
xor    %eax,%eax
cmp    $0x2,%rdi
jl     1120 <tclog2l+0x20>
mov    %rdi,%rcx
nopl   0x0(%rax,%rax,1)
shr    %rcx
add    $0x1,%rax
cmp    $0x3,%rdi
mov    %rcx,%rdi
ja     1110 <tclog2l+0x10>
ret

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

LLVM IR (-O2):
define i64 @tclog2l(i64 %0) {
%2 = icmp slt i64 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i64 %5, 1
%7 = add nuw nsw i64 %4, 1
%8 = icmp ugt i64 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i64 [ 0, %1 ], [ %7, %3 ]
ret i64 %10
}
/* Variables and functions */
scalar_t__ calloc(int, int);
scalar_t__ malloc(int);
void **dynarr_new() {
  void **arr = (void **)calloc(10 + 1, sizeof(void *));
  size_t *size = (size_t *)malloc(sizeof(size_t));
  *size = 10;
  arr[0] = size;
  return arr;
}


x86 assembly (clang, -O0):
<dynarr_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xb,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0xa,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dynarr_new>:
push   %rbx
mov    $0xb,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    $0x8,%edi
call   1040 <malloc@plt>
movq   $0xa,(%rax)
mov    %rax,(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8** @dynarr_new() {
%1 = alloca i8**
%2 = alloca i64*
%3 = call i64 @calloc(i32 11, i32 8)
%4 = inttoptr i64 %3 to i8**
store i8** %4, i8*** %1
%5 = call i64 @malloc(i32 8)
%6 = inttoptr i64 %5 to i64*
store i64* %6, i64** %2
%7 = load i64*, i64** %2
store i64 10, i64* %7
%8 = load i64*, i64** %2
%9 = bitcast i64* %8 to i8*
%10 = load i8**, i8*** %1
%11 = getelementptr inbounds i8*, i8** %10, i64 0
store i8* %9, i8** %11
%12 = load i8**, i8*** %1
ret i8** %12
}

LLVM IR (-O2):
define i8** @dynarr_new() {
%1 = tail call i64 @calloc(i32 11, i32 8)
%2 = inttoptr i64 %1 to i8**
%3 = tail call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to i64*
store i64 10, i64* %4
%5 = inttoptr i64 %3 to i8*
store i8* %5, i8** %2
ret i8** %2
}
/* Variables and functions */
void *malloc(int);
void *f6(int n) { return malloc((n + 1) * sizeof(int)); }


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f6>:
lea    0x4(,%rdi,4),%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @f6(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = trunc i64 %6 to i32
%8 = call i8* @malloc(i32 %7)
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @f6(i32 %0) {
%2 = shl i32 %0, 2
%3 = add i32 %2, 4
%4 = tail call i8* @malloc(i32 %3)
ret i8* %4
}
special(s) register char *s;
{
  register char c;
  char b;
  switch (*s) {
  case '^':
    b = *++s;
    if (b == '?') {
      c = b | 0x40;
    } else {
      c = b & 0x1f;
    }
    break;
  default:
    c = *s;
    break;
  }
  return c;
}


x86 assembly (clang, -O0):
<special>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
sub    $0x5e,%al
jne    115b <special+0x5b>
jmp    111b <special+0x1b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    0x1(%rax),%al
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
cmp    $0x3f,%eax
jne    114c <special+0x4c>
movsbl -0xa(%rbp),%eax
or     $0x40,%eax
mov    %al,-0x9(%rbp)
jmp    1156 <special+0x56>
movsbl -0xa(%rbp),%eax
and    $0x1f,%eax
mov    %al,-0x9(%rbp)
jmp    1164 <special+0x64>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<special>:
mov    (%rdi),%al
cmp    $0x5e,%al
jne    111b <special+0x1b>
mov    0x1(%rdi),%al
mov    %eax,%ecx
and    $0x1f,%cl
cmp    $0x3f,%al
movzbl %cl,%ecx
mov    $0x7f,%eax
cmovne %ecx,%eax
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @special(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %26 [
i32 94, label %8
]
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8, i8* %10
store i8 %11, i8* %4
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 63
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = or i32 %17, 64
%19 = trunc i32 %18 to i8
store i8 %19, i8* %3
br label %25
20: ; preds = %8
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = and i32 %22, 31
%24 = trunc i32 %23 to i8
store i8 %24, i8* %3
br label %25
25: ; preds = %20, %15
br label %29
26: ; preds = %1
%27 = load i8*, i8** %2
%28 = load i8, i8* %27
store i8 %28, i8* %3
br label %29
29: ; preds = %26, %25
%30 = load i8, i8* %3
%31 = sext i8 %30 to i32
ret i32 %31
}

LLVM IR (-O2):
define i32 @special(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 94
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 63
%8 = and i8 %6, 31
%9 = select i1 %7, i8 127, i8 %8
br label %10
10: ; preds = %4, %1
%11 = phi i8 [ %2, %1 ], [ %9, %4 ]
%12 = sext i8 %11 to i32
ret i32 %12
}
/* Variables and functions */
int EINVAL;
int pm8921_bms_get_rbatt(void) { return -EINVAL; }


x86 assembly (clang, -O0):
<pm8921_bms_get_rbatt>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    0x2ed3(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pm8921_bms_get_rbatt>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @pm8921_bms_get_rbatt() {
%1 = load i32, i32* @EINVAL
%2 = sub nsw i32 0, %1
ret i32 %2
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @pm8921_bms_get_rbatt() {
%1 = load i32, i32* @EINVAL
%2 = sub nsw i32 0, %1
ret i32 %2
}
void av_bitstream_filter_init() {}


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

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

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

LLVM IR (-O2):
define void @av_bitstream_filter_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ scc_entry(int);
int main() {
  int sum;
  int i;
  for (i = 0; i < 10; i++)
    scc_entry(i);
  if (sum < 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1156 <main+0x36>
mov    -0xc(%rbp),%edi
call   1040 <scc_entry@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
cmpl   $0x0,-0x8(%rbp)
jge    1167 <main+0x47>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <scc_entry@plt>
mov    $0x1,%edi
call   1030 <scc_entry@plt>
mov    $0x2,%edi
call   1030 <scc_entry@plt>
mov    $0x3,%edi
call   1030 <scc_entry@plt>
mov    $0x4,%edi
call   1030 <scc_entry@plt>
mov    $0x5,%edi
call   1030 <scc_entry@plt>
mov    $0x6,%edi
call   1030 <scc_entry@plt>
mov    $0x7,%edi
call   1030 <scc_entry@plt>
mov    $0x8,%edi
call   1030 <scc_entry@plt>
mov    $0x9,%edi
call   1030 <scc_entry@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %3
%9 = call i32 @scc_entry(i32 %8)
br label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @scc_entry(i32 0)
%2 = tail call i32 @scc_entry(i32 1)
%3 = tail call i32 @scc_entry(i32 2)
%4 = tail call i32 @scc_entry(i32 3)
%5 = tail call i32 @scc_entry(i32 4)
%6 = tail call i32 @scc_entry(i32 5)
%7 = tail call i32 @scc_entry(i32 6)
%8 = tail call i32 @scc_entry(i32 7)
%9 = tail call i32 @scc_entry(i32 8)
%10 = tail call i32 @scc_entry(i32 9)
ret i32 0
}
int shmobile_cpu_is_dead(unsigned int cpu) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @shmobile_cpu_is_dead(i32 %0) {
ret i32 1
}
/* Variables and functions */
int chdir(char *);
int sgsXPC_SetCurrentDirectory(char *path) { return chdir(path); }


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

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

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

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

/* Variables and functions */
float powf(float, float);
int16_t dds_scaling_dbm0(float level) {
  return (int16_t)(powf(10.0f, (level - (3.14f)) / 20.0f) * 32767.0f);
}


x86 assembly (clang, -O0):
<dds_scaling_dbm0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm1
movss  0xee2(%rip),%xmm0
subss  %xmm0,%xmm1
movss  0xed2(%rip),%xmm0
divss  %xmm0,%xmm1
movss  0xec2(%rip),%xmm0
call   1030 <powf@plt>
movss  0xeb1(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dds_scaling_dbm0>:
push   %rax
movaps %xmm0,%xmm1
addss  0xee4(%rip),%xmm1
divss  0xee0(%rip),%xmm1
movss  0xedc(%rip),%xmm0
call   1030 <powf@plt>
mulss  0xed3(%rip),%xmm0
cvttss2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dds_scaling_dbm0(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fsub float %3, 0x40091EB860000000
%5 = fdiv float %4, 2.000000e+01
%6 = call float @powf(float 1.000000e+01, float %5)
%7 = fmul float %6, 3.276700e+04
%8 = fptosi float %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @dds_scaling_dbm0(float %0) {
%2 = fadd float %0, 0xC0091EB860000000
%3 = fdiv float %2, 2.000000e+01
%4 = tail call float @powf(float 1.000000e+01, float %3)
%5 = fmul float %4, 3.276700e+04
%6 = fptosi float %5 to i32
ret i32 %6
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
char const *addr2char_r(struct sockaddr *, char *, int);
const char *addr2char(struct sockaddr *ia) {
  static char buf[256];
  return (addr2char_r(ia, buf, sizeof(buf)));
}


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

x86 assembly (clang, -O2):
<addr2char>:
lea    0x2f29(%rip),%rsi
mov    $0x100,%edx
jmp    1030 <addr2char_r@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@addr2char.buf = internal global [256 x i8] zeroinitializer
define i8* @addr2char(%struct.sockaddr* %0) {
%2 = alloca %struct.sockaddr*
store %struct.sockaddr* %0, %struct.sockaddr** %2
%3 = load %struct.sockaddr*, %struct.sockaddr** %2
%4 = call i8* @addr2char_r(%struct.sockaddr* %3, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @addr2char.buf, i64 0, i64 0), i32 256)
ret i8* %4
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@addr2char.buf = internal global [256 x i8] zeroinitializer
define i8* @addr2char(%struct.sockaddr* %0) {
%2 = tail call i8* @addr2char_r(%struct.sockaddr* %0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @addr2char.buf, i64 0, i64 0), i32 256)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ inb_cmos(int);
int /*<<< orphan*/ outb_cmos(int, int);
void init_rtc() {
  outb_cmos(0x0a, 0x26);
  outb_cmos(0x0b, 0x02);
  inb_cmos(0x0c);
  inb_cmos(0x0d);
}


x86 assembly (clang, -O0):
<init_rtc>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
mov    $0x26,%esi
call   1040 <outb_cmos@plt>
mov    $0xb,%edi
mov    $0x2,%esi
call   1040 <outb_cmos@plt>
mov    $0xc,%edi
call   1030 <inb_cmos@plt>
mov    $0xd,%edi
call   1030 <inb_cmos@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rtc>:
push   %rax
mov    $0xa,%edi
mov    $0x26,%esi
call   1040 <outb_cmos@plt>
mov    $0xb,%edi
mov    $0x2,%esi
call   1040 <outb_cmos@plt>
mov    $0xc,%edi
call   1030 <inb_cmos@plt>
mov    $0xd,%edi
pop    %rax
jmp    1030 <inb_cmos@plt>

LLVM IR (-O0):
define void @init_rtc() {
%1 = call i32 @outb_cmos(i32 10, i32 38)
%2 = call i32 @outb_cmos(i32 11, i32 2)
%3 = call i32 @inb_cmos(i32 12)
%4 = call i32 @inb_cmos(i32 13)
ret void
}

LLVM IR (-O2):
define void @init_rtc() {
%1 = tail call i32 @outb_cmos(i32 10, i32 38)
%2 = tail call i32 @outb_cmos(i32 11, i32 2)
%3 = tail call i32 @inb_cmos(i32 12)
%4 = tail call i32 @inb_cmos(i32 13)
ret void
}
/* Type definitions */
struct generator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ write_char(struct generator *, int);
void write_hexdigit(struct generator *g, int n) {
  write_char(g, n < 10 ? n + '0' : n - 10 + 'A');
}


x86 assembly (clang, -O0):
<write_hexdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    113f <write_hexdigit+0x2f>
mov    -0xc(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <write_hexdigit+0x3b>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <write_char@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_hexdigit>:
lea    0x37(%rsi),%ecx
lea    0x30(%rsi),%eax
cmp    $0xa,%esi
cmovge %ecx,%eax
mov    %eax,%esi
jmp    1030 <write_char@plt>

LLVM IR (-O0):
%struct.generator = type { i32 }
define void @write_hexdigit(%struct.generator* %0, i32 %1) {
%3 = alloca %struct.generator*
%4 = alloca i32
store %struct.generator* %0, %struct.generator** %3
store i32 %1, i32* %4
%5 = load %struct.generator*, %struct.generator** %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 48
br label %15
11: ; preds = %2
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 10
%14 = add nsw i32 %13, 65
br label %15
15: ; preds = %11, %8
%16 = phi i32 [ %10, %8 ], [ %14, %11 ]
%17 = call i32 @write_char(%struct.generator* %5, i32 %16)
ret void
}

LLVM IR (-O2):
%struct.generator = type { i32 }
define void @write_hexdigit(%struct.generator* %0, i32 %1) {
%3 = icmp slt i32 %1, 10
%4 = select i1 %3, i32 48, i32 55
%5 = add nsw i32 %4, %1
%6 = tail call i32 @write_char(%struct.generator* %0, i32 %5)
ret void
}