xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ideal_weight();
int main(int argv, const char *argc[]) {
  ideal_weight();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <ideal_weight@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @ideal_weight()
ret i32 0
}
int min2(int a, int b) { return a > b ? b : a; }


x86 assembly (clang, -O0):
<min2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <min2+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <min2+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min2>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

LLVM IR (-O0):
define i32 @min2(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
br label %12
10: ; preds = %2
%11 = load i32, i32* %3
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @min2(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int socklen_t;

/* Variables and functions */
int accept(int, struct sockaddr *, int *);
int socket_accept(int sockfd) {
  int clfd;
  struct sockaddr in_addr;
  socklen_t sockaddr_size = sizeof(struct sockaddr);
  if ((clfd = accept(sockfd, &in_addr, &sockaddr_size)) < 0) {
    return -1;
  }
  return clfd;
}


x86 assembly (clang, -O0):
<socket_accept>:
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   1030 <accept@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    114a <socket_accept+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1150 <socket_accept+0x40>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_accept>:
sub    $0x18,%rsp
movl   $0x4,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1030 <accept@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @socket_accept(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sockaddr
%6 = alloca i32
store i32 %0, i32* %3
store i32 4, i32* %6
%7 = load i32, i32* %3
%8 = call i32 @accept(i32 %7, %struct.sockaddr* %5, i32* %6)
store i32 %8, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* %4
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %10
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @socket_accept(i32 %0) {
%2 = alloca %struct.sockaddr
%3 = alloca i32
%4 = bitcast %struct.sockaddr* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = call i32 @accept(i32 %0, %struct.sockaddr* %2, i32* %3)
%7 = icmp sgt i32 %6, -1
%8 = select i1 %7, i32 %6, i32 -1
ret i32 %8
}
/* Type definitions */
typedef unsigned short screen_id;

/* Variables and functions */
int /*<<< orphan*/ SendChar(unsigned short);
void BatchBegin(unsigned short int screen_id) {
  SendChar((0XEE) & 0xFF);
  SendChar((0xB1) & 0xFF);
  SendChar((0x12) & 0xFF);
  SendChar(((screen_id) >> 8) & 0xFF);
  SendChar((screen_id)&0xFF);
}


x86 assembly (clang, -O0):
<BatchBegin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0xee,%edi
call   1030 <SendChar@plt>
mov    $0xb1,%edi
call   1030 <SendChar@plt>
mov    $0x12,%edi
call   1030 <SendChar@plt>
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movzwl %ax,%edi
call   1030 <SendChar@plt>
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
movzwl %ax,%edi
call   1030 <SendChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchBegin>:
push   %rbx
mov    %edi,%ebx
mov    $0xee,%edi
call   1030 <SendChar@plt>
mov    $0xb1,%edi
call   1030 <SendChar@plt>
mov    $0x12,%edi
call   1030 <SendChar@plt>
mov    %ebx,%edi
shr    $0x8,%edi
call   1030 <SendChar@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <SendChar@plt>

LLVM IR (-O0):
define void @BatchBegin(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = call i32 @SendChar(i16 zeroext 238)
%4 = call i32 @SendChar(i16 zeroext 177)
%5 = call i32 @SendChar(i16 zeroext 18)
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = ashr i32 %7, 8
%9 = and i32 %8, 255
%10 = trunc i32 %9 to i16
%11 = call i32 @SendChar(i16 zeroext %10)
%12 = load i16, i16* %2
%13 = zext i16 %12 to i32
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i16
%16 = call i32 @SendChar(i16 zeroext %15)
ret void
}

LLVM IR (-O2):
define void @BatchBegin(i16 zeroext %0) {
%2 = tail call i32 @SendChar(i16 zeroext 238)
%3 = tail call i32 @SendChar(i16 zeroext 177)
%4 = tail call i32 @SendChar(i16 zeroext 18)
%5 = lshr i16 %0, 8
%6 = tail call i32 @SendChar(i16 zeroext %5)
%7 = and i16 %0, 255
%8 = tail call i32 @SendChar(i16 zeroext %7)
ret void
}
/* Variables and functions */
int old_foreach_port(char const *, int (*)(char const *, char const *, void *),
                     void *);
int br_foreach_port(const char *brname,
                    int (*iterator)(const char *br, const char *port,
                                    void *arg),
                    void *arg) {
  return old_foreach_port(brname, iterator, arg);
}


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

x86 assembly (clang, -O2):
<br_foreach_port>:
jmp    1030 <old_foreach_port@plt>

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

LLVM IR (-O2):
define i32 @br_foreach_port(i8* %0, i32 (i8*, i8*, i8*)* %1, i8* %2) {
%4 = tail call i32 @old_foreach_port(i8* %0, i32 (i8*, i8*, i8*)* %1, i8* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr,
                "Usage: %s [-cins] [-d SD] [-f file] [-m msgid] "
                "[-p pri] [-t tag] [message ...]\n",
                getprogname());
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [80 x i8] c"Usage: %s [-cins] [-d SD] [-f file] [-m msgid] [-p pri] [-t tag] [message ...]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @EXIT_FAILURE
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [80 x i8] c"Usage: %s [-cins] [-d SD] [-f file] [-m msgid] [-p pri] [-t tag] [message ...]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
int datalen(const unsigned char *data) {
  int i, len;
  for (i = 0, len = 0; i < 64; i++)
    if (data[i])
      len = i;
  return len + 1;
}


x86 assembly (clang, -O0):
<datalen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    114b <datalen+0x4b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1138 <datalen+0x38>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    113d <datalen+0x3d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <datalen+0x16>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<datalen>:
xor    %ecx,%ecx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,(%rdi,%rcx,1)
cmovne %ecx,%eax
cmpb   $0x0,0x1(%rdi,%rcx,1)
lea    0x1(%rcx),%edx
cmove  %eax,%edx
lea    0x2(%rcx),%esi
cmpb   $0x0,0x2(%rdi,%rcx,1)
cmove  %edx,%esi
lea    0x3(%rcx),%eax
cmpb   $0x0,0x3(%rdi,%rcx,1)
cmove  %esi,%eax
add    $0x4,%rcx
cmp    $0x40,%rcx
jne    1110 <datalen+0x10>
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @datalen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %28, %2 ]
%4 = phi i32 [ 0, %1 ], [ %27, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = trunc i64 %3 to i32
%9 = select i1 %7, i32 %4, i32 %8
%10 = or i64 %3, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = trunc i64 %10 to i32
%15 = select i1 %13, i32 %9, i32 %14
%16 = or i64 %3, 2
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
%20 = trunc i64 %16 to i32
%21 = select i1 %19, i32 %15, i32 %20
%22 = or i64 %3, 3
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
%26 = trunc i64 %22 to i32
%27 = select i1 %25, i32 %21, i32 %26
%28 = add nuw nsw i64 %3, 4
%29 = icmp eq i64 %28, 64
br i1 %29, label %30, label %2
30: ; preds = %2
%31 = add nsw i32 %27, 1
ret i32 %31
}
/* Variables and functions */
int /*<<< orphan*/ ctest_test_assert_add(int, char *);
int ctest_assert_ptr(void *avalue, char *message) {
  if (avalue != NULL) {
    ctest_test_assert_add(0, message);
    return 0;
  }
  ctest_test_assert_add(1, message);
  return -1;
}


x86 assembly (clang, -O0):
<ctest_assert_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1142 <ctest_assert_ptr+0x32>
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1030 <ctest_test_assert_add@plt>
movl   $0x0,-0x4(%rbp)
jmp    1157 <ctest_assert_ptr+0x47>
mov    -0x18(%rbp),%rsi
mov    $0x1,%edi
call   1030 <ctest_test_assert_add@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctest_assert_ptr>:
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
mov    %eax,%ebx
neg    %ebx
mov    %eax,%edi
call   1030 <ctest_test_assert_add@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ctest_assert_ptr(i8* readnone %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = zext i1 %3 to i32
%5 = sext i1 %3 to i32
%6 = tail call i32 @ctest_test_assert_add(i32 %4, i8* %1)
ret i32 %5
}
int menu_state_resume(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @menu_state_resume() {
ret i32 0
}

LLVM IR (-O2):
define i32 @menu_state_resume() {
ret i32 0
}
void test() { test(); }


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
call   1030 <test@plt>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *prog) {
  printf("Utility to do first failure data capture (FFDC).\n"
         "\n"
         "Usage: %s [-h] [-v,--verbose]\n"
         "\t[-C, --card <cardno>]\n"
         "\t[-Q, --dump-queues] Dump DDCB queue registers of all funcs\n"
         "\t[-V, --version]\n"
         "\t[-v, --verbose]\n"
         "\n",
         prog);
}


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

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

LLVM IR (-O0):
@.str = [199 x i8] c"Utility to do first failure data capture (FFDC).\0A\0AUsage: %s [-h] [-v,--verbose]\0A\09[-C, --card <cardno>]\0A\09[-Q, --dump-queues] Dump DDCB queue registers of all funcs\0A\09[-V, --version]\0A\09[-v, --verbose]\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([199 x i8], [199 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [199 x i8] c"Utility to do first failure data capture (FFDC).\0A\0AUsage: %s [-h] [-v,--verbose]\0A\09[-C, --card <cardno>]\0A\09[-Q, --dump-queues] Dump DDCB queue registers of all funcs\0A\09[-V, --version]\0A\09[-v, --verbose]\0A\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([199 x i8], [199 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void restore_floating_point_precision(int prec) {}


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

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

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

LLVM IR (-O2):
define void @restore_floating_point_precision(i32 %0) {
ret void
}
/* Variables and functions */
double __builtin_powi(double, int);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double a = 5.0;
  printf("The __builtin_powi(5.0,2):[%f]\n", __builtin_powi(a, 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm0,%xmm0
lea    0xecc(%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 = [32 x i8] c"The __builtin_powi(5.0,2):[%f]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 5.000000e+00, double* %2
%3 = load double, double* %2
%4 = call double @llvm.powi.f64.i32(double %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"The __builtin_powi(5.0,2):[%f]\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double 2.500000e+01)
ret i32 0
}
double Interpolate(double val, double y0, double x0, double y1, double x1) {
  return (val - x0) * (y1 - y0) / (x1 - x0) + y0;
}


x86 assembly (clang, -O0):
<Interpolate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Interpolate>:
subsd  %xmm2,%xmm0
subsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm0
subsd  %xmm2,%xmm4
divsd  %xmm4,%xmm0
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @Interpolate(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %0, %2
%7 = fsub double %3, %1
%8 = fmul double %6, %7
%9 = fsub double %4, %2
%10 = fdiv double %8, %9
%11 = fadd double %10, %1
ret double %11
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
char *mystrdup(char *src) {
  size_t len = strlen(src);
  char *dst = malloc(len + 1);
  if (dst)
    strcpy(dst, src);
  return dst;
}


x86 assembly (clang, -O0):
<mystrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1172 <mystrdup+0x42>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <mystrdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @mystrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
br label %16
16: ; preds = %12, %1
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
define i8* @mystrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %6, %1
ret i8* %4
}
int qh_intcompare(const void *i, const void *j) {
  return (*((int *)i) - *((int *)j));
}


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

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

LLVM IR (-O0):
define i32 @qh_intcompare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @qh_intcompare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ hal_rtc_time_is_valid(void *);
uint8_t
    __attribute__((deprecated("use hal_rtc_time_is_valid() instead"), always_))
    HAL_RTC_Time_Is_Valid(void *reserved) {
  return (uint8_t)hal_rtc_time_is_valid(reserved);
}


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

x86 assembly (clang, -O2):
<HAL_RTC_Time_Is_Valid>:
jmp    1030 <hal_rtc_time_is_valid@plt>

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

LLVM IR (-O2):
define i32 @HAL_RTC_Time_Is_Valid(i8* %0) {
%2 = tail call i32 @hal_rtc_time_is_valid(i8* %0)
ret i32 %2
}
int test_imm_A7int64_lowword_mem(long long *val) {
  return ((*val) & (0xA7 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A7int64_lowword_mem>:
testb  $0xa7,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A7int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 167
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
main() { return sizeof(int[]){1, 2}; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x8,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
int test_imm_98int16_reg(short val) {
  return ((val) & (-0x98 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_98int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff68,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_98int16_reg>:
test   $0xff68,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_98int16_reg(i16 signext %0) {
%2 = and i16 %0, -152
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
unsigned int align(unsigned int x, unsigned amount) {
  --amount;
  return (x + amount) & ~amount;
}


x86 assembly (clang, -O0):
<align>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
neg    %esi
and    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @align(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = sub i32 0, %1
%6 = and i32 %4, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INET_ADDRSTRLEN;
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, void *, char *,
                             int /*<<< orphan*/);
void ip4_ntoa(void *addr, char *str) {
  inet_ntop(AF_INET, addr, str, INET_ADDRSTRLEN);
}


x86 assembly (clang, -O0):
<ip4_ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    0x2ea0(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip4_ntoa>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
mov    0x2eb2(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <inet_ntop@plt>

LLVM IR (-O0):
@AF_INET = global i32 0
@INET_ADDRSTRLEN = global i32 0
define void @ip4_ntoa(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @AF_INET
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = load i32, i32* @INET_ADDRSTRLEN
%9 = call i32 @inet_ntop(i32 %5, i8* %6, i8* %7, i32 %8)
ret void
}

LLVM IR (-O2):
@AF_INET = global i32 0
@INET_ADDRSTRLEN = global i32 0
define void @ip4_ntoa(i8* %0, i8* %1) {
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @INET_ADDRSTRLEN
%5 = tail call i32 @inet_ntop(i32 %3, i8* %0, i8* %1, i32 %4)
ret void
}
int sub(int val1, int val2) { return val1 - val2; }


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

x86 assembly (clang, -O2):
<sub>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @sub(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @sub(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
bool endianness() {
  union {
    int num;
    char single_byte;
  } test;
  test.num = 1;
  return test.single_byte;
}


x86 assembly (clang, -O0):
<endianness>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @endianness() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i32*
store i32 1, i32* %2
%3 = bitcast %union.anon* %1 to i8*
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @endianness() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ filewindow(int /*<<< orphan*/, char *);
nxtfile(void) { filewindow(0, "File name = "); }


x86 assembly (clang, -O0):
<nxtfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    0xedf(%rip),%rsi
call   1030 <filewindow@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nxtfile>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
jmp    1030 <filewindow@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"File name = \00"
define i32 @nxtfile() {
%1 = alloca i32
%2 = call i32 @filewindow(i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [13 x i8] c"File name = \00"
define i32 @nxtfile() {
%1 = tail call i32 @filewindow(i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_error();
int id(int);
void main() {
  int input = 10;
  int result = id(input);
  if (result == 10) {
    __VERIFIER_error();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <id@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    114b <main+0x2b>
mov    $0x0,%al
call   1030 <__VERIFIER_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <id@plt>
cmp    $0xa,%eax
jne    1138 <main+0x18>
xor    %eax,%eax
pop    %rcx
jmp    1030 <__VERIFIER_error@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 10, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @id(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 10
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @__VERIFIER_error()
br label %9
9: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @id(i32 10)
%2 = icmp eq i32 %1, 10
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @__VERIFIER_error()
br label %5
5: ; preds = %3, %0
ret void
}
void mulvf(float *result, const float m) {
  result[0] *= m;
  result[1] *= m;
  result[2] *= m;
}


x86 assembly (clang, -O0):
<mulvf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
movss  %xmm0,0x4(%rax)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mulvf>:
movss  (%rdi),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%rdi)
movss  0x4(%rdi),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rdi)
mulss  0x8(%rdi),%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @mulvf(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float, float* %4
%6 = load float*, float** %3
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = fmul float %8, %5
store float %9, float* %7
%10 = load float, float* %4
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 1
%13 = load float, float* %12
%14 = fmul float %13, %10
store float %14, float* %12
%15 = load float, float* %4
%16 = load float*, float** %3
%17 = getelementptr inbounds float, float* %16, i64 2
%18 = load float, float* %17
%19 = fmul float %18, %15
store float %19, float* %17
ret void
}

LLVM IR (-O2):
define void @mulvf(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = fmul float %3, %1
store float %4, float* %0
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = fmul float %6, %1
store float %7, float* %5
%8 = getelementptr inbounds float, float* %0, i64 2
%9 = load float, float* %8
%10 = fmul float %9, %1
store float %10, float* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int *);
void proc(void) {
  int i;
  printf("&i               = %p\n", &i);
}


x86 assembly (clang, -O0):
<proc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"&i = %p\0A\00"
define void @proc() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32* %1)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"&i = %p\0A\00"
define void @proc() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ Off_Reg_Bank(int);
void Move_To_Reg_X(int index) {
  Inst_Printf("movl", "%%eax,%s", Off_Reg_Bank(index * 4));
}


x86 assembly (clang, -O0):
<Move_To_Reg_X>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
call   1040 <Off_Reg_Bank@plt>
mov    %eax,%edx
lea    0xec1(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1030 <Inst_Printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Move_To_Reg_X>:
push   %rax
shl    $0x2,%edi
call   1040 <Off_Reg_Bank@plt>
lea    0xed0(%rip),%rdi
lea    0xece(%rip),%rsi
mov    %eax,%edx
pop    %rax
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"movl\00"
@.str.1 = [9 x i8] c"%%eax,%s\00"
define void @Move_To_Reg_X(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
%5 = call i32 @Off_Reg_Bank(i32 %4)
%6 = call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"movl\00"
@.str.1 = [9 x i8] c"%%eax,%s\00"
define void @Move_To_Reg_X(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = tail call i32 @Off_Reg_Bank(i32 %2)
%4 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}
volatile void *git___swap(void *volatile *ptr, void *newval) {
  volatile void *old = *ptr;
  *ptr = newval;
  return old;
}


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

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

LLVM IR (-O0):
define i8* @git___swap(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%6 = load i8**, i8*** %3
%7 = load volatile i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8*, i8** %4
%9 = load i8**, i8*** %3
store volatile i8* %8, i8** %9
%10 = load i8*, i8** %5
ret i8* %10
}

LLVM IR (-O2):
define i8* @git___swap(i8** %0, i8* %1) {
%3 = load volatile i8*, i8** %0
store volatile i8* %1, i8** %0
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ atexit(void (*)());
void xatexit(void (*f)(void)) { atexit(f); }


x86 assembly (clang, -O0):
<xatexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1130 <atexit>
add    $0x10,%rsp
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<xatexit>:
jmp    1120 <atexit>
cs nopw 0x0(%rax,%rax,1)
nop

LLVM IR (-O0):
define void @xatexit(void ()* %0) {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = load void ()*, void ()** %2
%4 = bitcast void ()* %3 to void (...)*
%5 = call i32 @atexit(void (...)* %4)
ret void
}

LLVM IR (-O2):
define void @xatexit(void ()* %0) {
%2 = bitcast void ()* %0 to void (...)*
%3 = tail call i32 @atexit(void (...)* %2)
ret void
}
unsigned int make_hash2(unsigned int saddr, unsigned short sport,
                        unsigned int daddr, unsigned short dport) {
  unsigned int hash = 0;
  hash = (saddr * 59);
  hash ^= daddr;
  hash ^= (sport << 16 | dport);
  return hash;
}


x86 assembly (clang, -O0):
<make_hash2>:
push   %rbp
mov    %rsp,%rbp
mov    %cx,%ax
mov    %si,%cx
mov    %edi,-0x4(%rbp)
mov    %cx,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
movl   $0x0,-0x14(%rbp)
imul   $0x3b,-0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
movzwl -0x6(%rbp),%eax
shl    $0x10,%eax
movzwl -0xe(%rbp),%ecx
or     %ecx,%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_hash2>:
imul   $0x3b,%edi,%edi
shl    $0x10,%esi
lea    (%rsi,%rcx,1),%eax
xor    %edx,%eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @make_hash2(i32 %0, i16 zeroext %1, i32 %2, i16 zeroext %3) {
%5 = alloca i32
%6 = alloca i16
%7 = alloca i32
%8 = alloca i16
%9 = alloca i32
store i32 %0, i32* %5
store i16 %1, i16* %6
store i32 %2, i32* %7
store i16 %3, i16* %8
store i32 0, i32* %9
%10 = load i32, i32* %5
%11 = mul i32 %10, 59
store i32 %11, i32* %9
%12 = load i32, i32* %7
%13 = load i32, i32* %9
%14 = xor i32 %13, %12
store i32 %14, i32* %9
%15 = load i16, i16* %6
%16 = zext i16 %15 to i32
%17 = shl i32 %16, 16
%18 = load i16, i16* %8
%19 = zext i16 %18 to i32
%20 = or i32 %17, %19
%21 = load i32, i32* %9
%22 = xor i32 %21, %20
store i32 %22, i32* %9
%23 = load i32, i32* %9
ret i32 %23
}

LLVM IR (-O2):
define i32 @make_hash2(i32 %0, i16 zeroext %1, i32 %2, i16 zeroext %3) {
%5 = mul i32 %0, 59
%6 = xor i32 %5, %2
%7 = zext i16 %1 to i32
%8 = shl nuw i32 %7, 16
%9 = zext i16 %3 to i32
%10 = or i32 %8, %9
%11 = xor i32 %6, %10
ret i32 %11
}
/* Variables and functions */
int imgL(char *);
int nBit(char *);
int rowL(char *filename) {
  int w = imgL(filename);
  int bit = nBit(filename);
  int l = ((w * bit) + (32 - (w * bit) % 32)) / 8;
  return l;
}


x86 assembly (clang, -O0):
<rowL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <imgL@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <nBit@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
mov    $0x20,%ecx
sub    %edx,%ecx
add    %ecx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rowL>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <imgL@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <nBit@plt>
imul   %ebp,%eax
lea    0x1f(%rax),%ecx
test   %eax,%eax
cmovs  %ecx,%eax
and    $0xffffffe0,%eax
lea    0x20(%rax),%ecx
add    $0x27,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x3,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rowL(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @imgL(i8* %6)
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = call i32 @nBit(i8* %8)
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
%16 = srem i32 %15, 32
%17 = sub nsw i32 32, %16
%18 = add nsw i32 %12, %17
%19 = sdiv i32 %18, 8
store i32 %19, i32* %5
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @rowL(i8* %0) {
%2 = tail call i32 @imgL(i8* %0)
%3 = tail call i32 @nBit(i8* %0)
%4 = mul nsw i32 %3, %2
%5 = srem i32 %4, 32
%6 = add i32 %4, 32
%7 = sub i32 %6, %5
%8 = sdiv i32 %7, 8
ret i32 %8
}
int main() {
  char *str = "哈";
  printf("%d\n", strlen(str));
  printf("%s\n", str);
  printf("%s\n", "\u5f20\u8363\u54cd");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"\E5\93\88\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [10 x i8] c"\E5\BC\A0\E8\8D\A3\E5\93\8D\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i64 @strlen(i8* %2)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %3)
%5 = load i8*, i8** %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"\E5\93\88\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.3 = [10 x i8] c"\E5\BC\A0\E8\8D\A3\E5\93\8D\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 3)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char const *);
__attribute__((no, noclone)) void baz(char *p, const char *q, const char *r) {
  strcat(p, q);
  strcat(p, "abcd");
  strcat(p, r);
  strcat(p, "efgh");
}


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xec4(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baz>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strcat@plt>
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcat@plt>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcat@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"abcd\00"
@.str.1 = [5 x i8] c"efgh\00"
define void @baz(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcat(i8* %0, i8* %1)
%5 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcat(i8* %0, i8* %2)
%7 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void tegra_fb_update_fix(struct tegra_fb_info *fb_info,
                         struct fb_monspecs *specs) {}


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

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

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

LLVM IR (-O2):
%struct.tegra_fb_info = type opaque
%struct.fb_monspecs = type opaque
define void @tegra_fb_update_fix(%struct.tegra_fb_info* nocapture %0, %struct.fb_monspecs* nocapture %1) {
ret void
}
/* Type definitions */
struct wr_queue {
  int dummy;
};

/* Variables and functions */
int add_wr_queue(struct wr_queue *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int send_msgstring(struct wr_queue *pqueue, int msg, char *str) {
  return add_wr_queue(pqueue, msg, str, strlen(str));
}


x86 assembly (clang, -O0):
<send_msgstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
call   1040 <add_wr_queue@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_msgstring>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <add_wr_queue@plt>

LLVM IR (-O0):
%struct.wr_queue = type { i32 }
define i32 @send_msgstring(%struct.wr_queue* %0, i32 %1, i8* %2) {
%4 = alloca %struct.wr_queue*
%5 = alloca i32
%6 = alloca i8*
store %struct.wr_queue* %0, %struct.wr_queue** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.wr_queue*, %struct.wr_queue** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @add_wr_queue(%struct.wr_queue* %7, i32 %8, i8* %9, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.wr_queue = type { i32 }
define i32 @send_msgstring(%struct.wr_queue* %0, i32 %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %2)
%5 = tail call i32 @add_wr_queue(%struct.wr_queue* %0, i32 %1, i8* %2, i32 %4)
ret i32 %5
}