xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int lace_compat_fd_spawnlp_wait(int /*<<< orphan*/, int, int,
                                int /*<<< orphan*/ *, char const *, char *,
                                char *, char *, int /*<<< orphan*/ *);
void add_usage_tests(const char *lace_exe) {
  int istat;
  istat = lace_compat_fd_spawnlp_wait(0, 1, 2, NULL, lace_exe, "-as", "add",
                                      "no_arg_is_valid", NULL);
  assert(istat == 64);
}


x86 assembly (clang, -O0):
<add_usage_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%r8
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    0xeb9(%rip),%r9
lea    0xeb6(%rip),%r10
lea    0xeb3(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1030 <lace_compat_fd_spawnlp_wait@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_usage_tests>:
push   %rax
mov    %rdi,%r8
sub    $0x8,%rsp
lea    0xed9(%rip),%rax
lea    0xece(%rip),%r10
lea    0xec3(%rip),%r9
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
push   $0x0
push   %rax
push   %r10
call   1030 <lace_compat_fd_spawnlp_wait@plt>
add    $0x20,%rsp
xor    %edi,%edi
cmp    $0x40,%eax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"-as\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [16 x i8] c"no_arg_is_valid\00"
define void @add_usage_tests(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32* null)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 64
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"-as\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [16 x i8] c"no_arg_is_valid\00"
define void @add_usage_tests(i8* %0) {
%2 = tail call i32 @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32* null)
%3 = icmp eq i32 %2, 64
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
ret void
}
/* Type definitions */
struct filelist {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct filelist *);
void freeFilelist(struct filelist *list) { free(list); }


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

x86 assembly (clang, -O2):
<freeFilelist>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.filelist = type { i32 }
define void @freeFilelist(%struct.filelist* %0) {
%2 = alloca %struct.filelist*
store %struct.filelist* %0, %struct.filelist** %2
%3 = load %struct.filelist*, %struct.filelist** %2
%4 = call i32 @free(%struct.filelist* %3)
ret void
}

LLVM IR (-O2):
%struct.filelist = type { i32 }
define void @freeFilelist(%struct.filelist* nocapture %0) {
%2 = tail call i32 @free(%struct.filelist* %0)
ret void
}
void ff_videodsp_init_aarch64() {}


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

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

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

LLVM IR (-O2):
define void @ff_videodsp_init_aarch64() {
ret void
}
void gtk_widget_list_accel_closures() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_list_accel_closures() {
ret void
}
/* Variables and functions */
long floor(long);
long randr();
long randi(long n) {
  long rn;
  rn = floor(n * randr());
  return rn;
}


x86 assembly (clang, -O0):
<randi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <randr@plt>
mov    -0x18(%rbp),%rdi
imul   %rax,%rdi
call   1040 <floor@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randi>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <randr@plt>
imul   %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <floor@plt>

LLVM IR (-O0):
define i64 @randi(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 (...) @randr()
%6 = mul nsw i64 %4, %5
%7 = call i64 @floor(i64 %6)
store i64 %7, i64* %3
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
define i64 @randi(i64 %0) {
%2 = tail call i64 (...) @randr()
%3 = mul nsw i64 %2, %0
%4 = tail call i64 @floor(i64 %3)
ret i64 %4
}
char *var_allones(char *base) {
  static const unsigned long offset = -1;
  return base + offset;
}


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

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

LLVM IR (-O0):
@var_allones.offset = internal constant i64 -1
define i8* @var_allones(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 -1
ret i8* %4
}

LLVM IR (-O2):
define i8* @var_allones(i8* readnone %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ b();
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int main() {
  b();
  ;
  write(1, "c\n", strlen("c\n"));
  ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <b@plt>
lea    0xebe(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xeab(%rip),%rsi
call   1040 <write@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <b@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"c\0A\00"
define i32 @main() {
%1 = call i32 (...) @b()
%2 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"c\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @b()
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  struct stat st;
  int res = stat("test/source/stattest.c", &st);
  printf("Stat returns %d; size of file is %d\n", res, st.st_size);
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%edx
lea    0xed4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [23 x i8] c"test/source/stattest.c\00"
@.str.1 = [37 x i8] c"Stat returns %d; size of file is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @stat(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), %struct.stat* %6)
store i32 %8, i32* %7
%9 = load i32, i32* %7
%10 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %11)
%13 = load i32, i32* %7
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [23 x i8] c"test/source/stattest.c\00"
@.str.1 = [37 x i8] c"Stat returns %d; size of file is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i32 @stat(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
%6 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %7)
ret i32 %5
}
void I2CSlaveIntDisableEx(unsigned long ulBase, unsigned long ulIntFlags) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x0000000C))) &= ~ulIntFlags;
}


x86 assembly (clang, -O0):
<I2CSlaveIntDisableEx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CSlaveIntDisableEx>:
not    %rsi
and    %rsi,0xc(%rdi)
ret

LLVM IR (-O0):
define void @I2CSlaveIntDisableEx(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 = xor i64 %5, -1
%7 = load i64, i64* %3
%8 = add i64 %7, 12
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, %6
store volatile i64 %11, i64* %9
ret void
}

LLVM IR (-O2):
define void @I2CSlaveIntDisableEx(i64 %0, i64 %1) {
%3 = xor i64 %1, -1
%4 = add i64 %0, 12
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, %3
store volatile i64 %7, i64* %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
u_int32_t store_swp_hton32(u_int32_t v) { return htonl(v); }


x86 assembly (clang, -O0):
<store_swp_hton32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <htonl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_swp_hton32>:
jmp    1030 <htonl@plt>

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

LLVM IR (-O2):
define i32 @store_swp_hton32(i32 %0) {
%2 = tail call i32 @htonl(i32 %0)
ret i32 %2
}
int fun_0(int *arr1, int index, int *arr2) {
  arr1[index + 1] = 10;
  arr1[index + 2] = 10;
  return (index + 1) * 4;
}


x86 assembly (clang, -O0):
<fun_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movl   $0xa,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movl   $0xa,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
shl    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_0>:
movslq %esi,%rax
movabs $0xa0000000a,%rcx
mov    %rcx,0x4(%rdi,%rax,4)
lea    0x4(,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @fun_0(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %7, i64 %10
store i32 10, i32* %11
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %12, i64 %15
store i32 10, i32* %16
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = mul nsw i32 %18, 4
ret i32 %19
}

LLVM IR (-O2):
define i32 @fun_0(i32* nocapture writeonly %0, i32 %1, i32* nocapture readnone %2) {
%4 = add nsw i32 %1, 1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 10, i32* %6
%7 = add nsw i32 %1, 2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 10, i32* %9
%10 = shl nsw i32 %4, 2
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ nrerror(char *);
void usage(void) {
  nrerror(
      "usage:\n"
      "RNAfold [-p[0|2]] [-C] [-T temp] [-4] [-d[2|3]] [-noGU] [-noCloseGU]\n"
      "        [-noLP] [-e e_set] [-P paramfile] [-nsp pairs] [-S scale]\n"
      "        [-noconv] [-noPS] [-circ] [-MEA [gamma]]\n");
}


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

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

LLVM IR (-O0):
@.str = [192 x i8] c"usage:\0ARNAfold [-p[0|2]] [-C] [-T temp] [-4] [-d[2|3]] [-noGU] [-noCloseGU]\0A [-noLP] [-e e_set] [-P paramfile] [-nsp pairs] [-S scale]\0A [-noconv] [-noPS] [-circ] [-MEA [gamma]]\0A\00"
define void @usage() {
%1 = call i32 @nrerror(i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [192 x i8] c"usage:\0ARNAfold [-p[0|2]] [-C] [-T temp] [-4] [-d[2|3]] [-noGU] [-noCloseGU]\0A [-noLP] [-e e_set] [-P paramfile] [-nsp pairs] [-S scale]\0A [-noconv] [-noPS] [-circ] [-MEA [gamma]]\0A\00"
define void @usage() {
%1 = tail call i32 @nrerror(i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ sin;

/* Variables and functions */
int getsockname(int, struct sockaddr *, int *);
int ntohs(int /*<<< orphan*/);
int ytcpsocket_port(int socketfd) {
  struct sockaddr_in sin;
  socklen_t len = sizeof(sin);
  if (getsockname(socketfd, (struct sockaddr *)&sin, &len) == -1) {
    return -1;
  } else {
    return ntohs(sin.sin_port);
  }
}


x86 assembly (clang, -O0):
<ytcpsocket_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <getsockname@plt>
cmp    $0xffffffff,%eax
jne    1157 <ytcpsocket_port+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <ytcpsocket_port+0x42>
mov    -0x10(%rbp),%edi
call   1030 <ntohs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ytcpsocket_port>:
push   %rax
movl   $0x4,0x4(%rsp)
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1040 <getsockname@plt>
cmp    $0xffffffff,%eax
je     1145 <ytcpsocket_port+0x25>
mov    (%rsp),%edi
call   1030 <ntohs@plt>
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @ytcpsocket_port(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
store i32 %0, i32* %3
store i32 4, i32* %5
%6 = load i32, i32* %3
%7 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%8 = call i32 @getsockname(i32 %6, %struct.sockaddr* %7, i32* %5)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %15
11: ; preds = %1
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @ntohs(i32 %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @ytcpsocket_port(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = bitcast %struct.sockaddr_in* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%7 = call i32 @getsockname(i32 %0, %struct.sockaddr* %6, i32* %3)
%8 = icmp eq i32 %7, -1
br i1 %8, label %13, label %9
9: ; preds = %1
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @ntohs(i32 %11)
br label %13
13: ; preds = %1, %9
%14 = phi i32 [ %12, %9 ], [ -1, %1 ]
ret i32 %14
}
int test_imm_03uint32_reg(unsigned int val) {
  return ((val) & (0x03 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_03uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x3,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_03uint32_reg(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint16_t;

/* Variables and functions */
uint16_t mmio_read_16(uintptr_t addr) { return *(volatile uint16_t *)addr; }


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

x86 assembly (clang, -O2):
<mmio_read_16>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @mmio_read_16(i64 %0) {
%2 = inttoptr i64 %0 to i32*
%3 = load volatile i32, i32* %2
ret i32 %3
}
void g_filename_display_name() {}


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

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

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

LLVM IR (-O2):
define void @g_filename_display_name() {
ret void
}
float div(int x, int y) { return x / (float)y; }


x86 assembly (clang, -O0):
<div>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<div>:
cvtsi2ss %edi,%xmm0
cvtsi2ss %esi,%xmm1
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @div(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 = sitofp i32 %5 to float
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to float
%9 = fdiv float %6, %8
ret float %9
}

LLVM IR (-O2):
define float @div(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = sitofp i32 %1 to float
%5 = fdiv float %3, %4
ret float %5
}
double *fct_4(double *a, double *b, double *c, double *d, double *e, double *f,
              double *g, double *h) {
  (void)a;
  (void)b;
  (void)c;
  (void)d;
  (void)e;
  (void)f;
  (void)g;
  (void)h;
  return e;
}


x86 assembly (clang, -O0):
<fct_4>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fct_4>:
mov    %r8,%rax
ret

LLVM IR (-O0):
define double* @fct_4(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
store double* %0, double** %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
%17 = load double*, double** %9
%18 = load double*, double** %10
%19 = load double*, double** %11
%20 = load double*, double** %12
%21 = load double*, double** %13
%22 = load double*, double** %14
%23 = load double*, double** %15
%24 = load double*, double** %16
%25 = load double*, double** %13
ret double* %25
}

LLVM IR (-O2):
define double* @fct_4(double* nocapture readnone %0, double* nocapture readnone %1, double* nocapture readnone %2, double* nocapture readnone %3, double* readnone returned %4, double* nocapture readnone %5, double* nocapture readnone %6, double* nocapture readnone %7) {
ret double* %4
}
/* Variables and functions */
double exp(double);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double y = exp(1.050094);
  printf("%f\n", y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xed0(%rip),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 0x4006DD0507A316F0)
ret i32 0
}
void I210ToAR30() {}


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

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

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

LLVM IR (-O2):
define void @I210ToAR30() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void f2(int *p) { printf("the heap is %d\n", *p); }


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

x86 assembly (clang, -O2):
<f2>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"the heap is %d\0A\00"
define void @f2(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"the heap is %d\0A\00"
define void @f2(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _delay_us(int);
int /*<<< orphan*/ clear_SCL();
int /*<<< orphan*/ set_SCL();
void send_SCL_pulse(void) {
  set_SCL();
  _delay_us(1);
  clear_SCL();
  _delay_us(1);
}


x86 assembly (clang, -O0):
<send_SCL_pulse>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <set_SCL@plt>
mov    $0x1,%edi
call   1040 <_delay_us@plt>
mov    $0x0,%al
call   1030 <clear_SCL@plt>
mov    $0x1,%edi
call   1040 <_delay_us@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_SCL_pulse>:
push   %rax
xor    %eax,%eax
call   1050 <set_SCL@plt>
mov    $0x1,%edi
call   1040 <_delay_us@plt>
xor    %eax,%eax
call   1030 <clear_SCL@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <_delay_us@plt>

LLVM IR (-O0):
define void @send_SCL_pulse() {
%1 = call i32 (...) @set_SCL()
%2 = call i32 @_delay_us(i32 1)
%3 = call i32 (...) @clear_SCL()
%4 = call i32 @_delay_us(i32 1)
ret void
}

LLVM IR (-O2):
define void @send_SCL_pulse() {
%1 = tail call i32 (...) @set_SCL()
%2 = tail call i32 @_delay_us(i32 1)
%3 = tail call i32 (...) @clear_SCL()
%4 = tail call i32 @_delay_us(i32 1)
ret void
}
int ft_putn(int *n, int len) {
  *n = len;
  return (0);
}


x86 assembly (clang, -O0):
<ft_putn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putn>:
mov    %esi,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_putn(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) {
  (void)attr;
  (void)stacksize;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @pthread_attr_setstacksize(i32* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void myprint(void *arg, const char *format, va_list ap) {
  vfprintf(stderr, format, ap);
}


x86 assembly (clang, -O0):
<myprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <vfprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myprint>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vfprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
define void @myprint(i8* nocapture readnone %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @vfprintf(i32 %4, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void errorHandler(int i) {
  if (i == 0)
    fprintf(stderr, "ERROR: Pipe Failed!\n");
  if (i == 1)
    fprintf(stderr, "EROR: Dup Failed!\n");
}


x86 assembly (clang, -O0):
<errorHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113a <errorHandler+0x2a>
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1159 <errorHandler+0x49>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errorHandler>:
test   %edi,%edi
je     1122 <errorHandler+0x12>
cmp    $0x1,%edi
jne    1137 <errorHandler+0x27>
lea    0xef5(%rip),%rsi
jmp    1129 <errorHandler+0x19>
lea    0xed7(%rip),%rsi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"ERROR: Pipe Failed!\0A\00"
@.str.1 = [19 x i8] c"EROR: Dup Failed!\0A\00"
define void @errorHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"ERROR: Pipe Failed!\0A\00"
@.str.1 = [19 x i8] c"EROR: Dup Failed!\0A\00"
define void @errorHandler(i32 %0) {
switch i32 %0, label %7 [
i32 0, label %3
i32 1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %1 ]
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* %4)
br label %7
7: ; preds = %3, %1
ret void
}
/* Type definitions */
struct fpu_area {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fpu_xsave(struct fpu_area *, int);
void dune_fpu_save_safe(struct fpu_area *fp) { fpu_xsave(fp, -1); }


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

x86 assembly (clang, -O2):
<dune_fpu_save_safe>:
mov    $0xffffffff,%esi
jmp    1030 <fpu_xsave@plt>

LLVM IR (-O0):
%struct.fpu_area = type { i32 }
define void @dune_fpu_save_safe(%struct.fpu_area* %0) {
%2 = alloca %struct.fpu_area*
store %struct.fpu_area* %0, %struct.fpu_area** %2
%3 = load %struct.fpu_area*, %struct.fpu_area** %2
%4 = call i32 @fpu_xsave(%struct.fpu_area* %3, i32 -1)
ret void
}

LLVM IR (-O2):
%struct.fpu_area = type { i32 }
define void @dune_fpu_save_safe(%struct.fpu_area* %0) {
%2 = tail call i32 @fpu_xsave(%struct.fpu_area* %0, i32 -1)
ret void
}
int _tc_dummyfuncv(int a, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_tc_dummyfuncv(i32 %0, ...) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sqlite3_initialize();
int f() {
  sqlite3_initialize();
  return 1;
}


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

x86 assembly (clang, -O2):
<f>:
push   %rax
xor    %eax,%eax
call   1030 <sqlite3_initialize@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f() {
%1 = call i32 (...) @sqlite3_initialize()
ret i32 1
}

LLVM IR (-O2):
define i32 @f() {
%1 = tail call i32 (...) @sqlite3_initialize()
ret i32 1
}
/* Variables and functions */
char *luaI_buffer(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *lua_strconc(char *l, char *r) {
  int nl = strlen(l);
  char *buffer = luaI_buffer(nl + strlen(r) + 1);
  strcpy(buffer, l);
  strcpy(buffer + nl, r);
  return buffer;
}


x86 assembly (clang, -O0):
<lua_strconc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
call   1050 <luaI_buffer@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lua_strconc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r12,%rax,1),%edi
add    $0x1,%edi
call   1050 <luaI_buffer@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
movslq %r12d,%rdi
add    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @lua_strconc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %9, %11
%13 = add nsw i32 %12, 1
%14 = call i8* @luaI_buffer(i32 %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = load i8*, i8** %3
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = load i8*, i8** %6
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8*, i8** %4
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = load i8*, i8** %6
ret i8* %24
}

LLVM IR (-O2):
define i8* @lua_strconc(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add i32 %3, 1
%6 = add i32 %5, %4
%7 = tail call i8* @luaI_buffer(i32 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = tail call i32 @strcpy(i8* %10, i8* %1)
ret i8* %7
}
int ft_isupper(int c) { return (c <= 'Z' && c >= 'A'); }


x86 assembly (clang, -O0):
<ft_isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x5a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jg     1120 <ft_isupper+0x20>
cmpl   $0x41,-0x4(%rbp)
setge  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 90
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 65
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ft_isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
const char *Exception_Brief(void) { return "Exception Object"; }


x86 assembly (clang, -O0):
<Exception_Brief>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Exception_Brief>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Exception Object\00"
define i8* @Exception_Brief() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [17 x i8] c"Exception Object\00"
define i8* @Exception_Brief() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
void func2() {
  func1();
  printf("debug: "
         "%s:%d: "
         "return to %p"
         "\n",
         __func__, 16, __builtin_return_address(0));
  return;
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <func1@plt>
mov    0x8(%rbp),%rcx
lea    0xeca(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
push   %rax
xor    %eax,%eax
call   1030 <func1@plt>
mov    0x8(%rsp),%rcx
lea    0xecc(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x10,%edx
xor    %eax,%eax
pop    %r8
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"debug: %s:%d: return to %p\0A\00"
@__func__.func2 = [6 x i8] c"func2\00"
define void @func2() {
%1 = call i32 (...) @func1()
%2 = call i8* @llvm.returnaddress(i32 0)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.func2, i64 0, i64 0), i32 16, i8* %2)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"debug: %s:%d: return to %p\0A\00"
@__func__.func2 = [6 x i8] c"func2\00"
define void @func2() {
%1 = tail call i32 (...) @func1()
%2 = tail call i8* @llvm.returnaddress(i32 0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.func2, i64 0, i64 0), i32 16, i8* %2)
ret void
}
/* Variables and functions */
int close(int);
int tcp_close(int s) { return close(s); }


x86 assembly (clang, -O0):
<tcp_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @tcp_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
double max(double val1, double val2) { return (val1 > val2) ? val1 : val2; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <max+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <max+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int main() {
  int x = -50;
  int y;
  while (x < 0) {
    x = x + y;
    y++;
  }
  if (y < 0)
    goto ERROR;
  return 1;
ERROR:;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffce,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1133 <main+0x33>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1112 <main+0x12>
cmpl   $0x0,-0xc(%rbp)
jge    1142 <main+0x42>
jmp    114e <main+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1153 <main+0x53>
jmp    1153 <main+0x53>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -50, i32* %2
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
store i32 %10, i32* %2
%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* %3
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
br label %18
17: ; preds = %13
store i32 1, i32* %1
br label %19
18: ; preds = %16
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
double zero(void) { return 0.0; }


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

x86 assembly (clang, -O2):
<zero>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @zero() {
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @zero() {
ret double 0.000000e+00
}
void _dummy(int c) {}


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

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

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

LLVM IR (-O2):
define void @_dummy(i32 %0) {
ret void
}
int OmronReadBitMem(int plc_id, char type, unsigned short addr, char bit,
                    short num, short *data) {
  return -1;
}


x86 assembly (clang, -O0):
<OmronReadBitMem>:
push   %rbp
mov    %rsp,%rbp
mov    %r8w,%ax
mov    %edi,-0x4(%rbp)
mov    %sil,-0x5(%rbp)
mov    %dx,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %ax,-0xc(%rbp)
mov    %r9,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @OmronReadBitMem(i32 %0, i8 signext %1, i16 zeroext %2, i8 signext %3, i16 signext %4, i16* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i16
%10 = alloca i8
%11 = alloca i16
%12 = alloca i16*
store i32 %0, i32* %7
store i8 %1, i8* %8
store i16 %2, i16* %9
store i8 %3, i8* %10
store i16 %4, i16* %11
store i16* %5, i16** %12
ret i32 -1
}

LLVM IR (-O2):
define i32 @OmronReadBitMem(i32 %0, i8 signext %1, i16 zeroext %2, i8 signext %3, i16 signext %4, i16* nocapture readnone %5) {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned int EOF;
unsigned int fputc(unsigned int, int /*<<< orphan*/ *);
unsigned int fput2b(unsigned int value, FILE *stream) {
  unsigned int result;
  result = fputc((value >> 8) & 0xff, stream);
  if (result != EOF) {
    result = fputc(value & 0xff, stream);
  }
  return result;
}


x86 assembly (clang, -O0):
<fput2b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
shr    $0x8,%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2ea7(%rip),%rcx
cmp    (%rcx),%eax
je     115e <fput2b+0x4e>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fput2b>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
movzbl %bh,%edi
call   1030 <fputc@plt>
mov    0x2ec0(%rip),%rcx
cmp    (%rcx),%eax
jne    1134 <fput2b+0x24>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
movzbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @fput2b(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* %3
%7 = lshr i32 %6, 8
%8 = and i32 %7, 255
%9 = load i32*, i32** %4
%10 = call i32 @fputc(i32 %8, i32* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i32, i32* %3
%16 = and i32 %15, 255
%17 = load i32*, i32** %4
%18 = call i32 @fputc(i32 %16, i32* %17)
store i32 %18, i32* %5
br label %19
19: ; preds = %14, %2
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @fput2b(i32 %0, i32* nocapture %1) {
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
%5 = tail call i32 @fputc(i32 %4, i32* %1)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = and i32 %0, 255
%10 = tail call i32 @fputc(i32 %9, i32* %1)
br label %11
11: ; preds = %8, %2
%12 = phi i32 [ %10, %8 ], [ %5, %2 ]
ret i32 %12
}
unsigned int _hrt_div_nearest(unsigned int a, unsigned int b) {
  return (a + (b / 2)) / b;
}


x86 assembly (clang, -O0):
<_hrt_div_nearest>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x1,%ecx
add    %ecx,%eax
xor    %edx,%edx
divl   -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hrt_div_nearest>:
mov    %esi,%eax
shr    %eax
add    %edi,%eax
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
define i32 @_hrt_div_nearest(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* %4
%7 = udiv i32 %6, 2
%8 = add i32 %5, %7
%9 = load i32, i32* %4
%10 = udiv i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @_hrt_div_nearest(i32 %0, i32 %1) {
%3 = lshr i32 %1, 1
%4 = add i32 %3, %0
%5 = udiv i32 %4, %1
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(double *, int, int, int /*<<< orphan*/ *);
int fread_double_values(FILE *fp, double *dbuf, int num_of_doubles) {
  size_t double_read;
  double_read = fread(dbuf, sizeof(double), num_of_doubles, fp);
  return ((int)double_read);
}


x86 assembly (clang, -O0):
<fread_double_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rcx
mov    $0x8,%esi
call   1030 <fread@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fread_double_values>:
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x8,%esi
jmp    1030 <fread@plt>

LLVM IR (-O0):
define i32 @fread_double_values(i32* %0, double* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i64
store i32* %0, i32** %4
store double* %1, double** %5
store i32 %2, i32* %6
%8 = load double*, double** %5
%9 = load i32, i32* %6
%10 = load i32*, i32** %4
%11 = call i64 @fread(double* %8, i32 8, i32 %9, i32* %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = trunc i64 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @fread_double_values(i32* nocapture %0, double* nocapture %1, i32 %2) {
%4 = tail call i64 @fread(double* %1, i32 8, i32 %2, i32* %0)
%5 = trunc i64 %4 to i32
ret i32 %5
}
void send_message(char *msg) {}


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

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

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

LLVM IR (-O2):
define void @send_message(i8* nocapture %0) {
ret void
}