xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ os_terminate(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ os_write(int, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void dr_terminate(const char *reason) {
  os_write(1, reason, strlen(reason));
  os_terminate(NULL, 0);
}


x86 assembly (clang, -O0):
<dr_terminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <os_write@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1030 <os_terminate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dr_terminate>:
push   %rbx
mov    %rdi,%rbx
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <os_write@plt>
xor    %edi,%edi
xor    %esi,%esi
pop    %rbx
jmp    1030 <os_terminate@plt>

LLVM IR (-O0):
define void @dr_terminate(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @os_write(i32 1, i8* %3, i32 %5)
%7 = call i32 @os_terminate(i32* null, i32 0)
ret void
}

LLVM IR (-O2):
define void @dr_terminate(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @os_write(i32 1, i8* %0, i32 %2)
%4 = tail call i32 @os_terminate(i32* null, i32 0)
ret void
}
const char *SCE_Time_GetMonth(const unsigned int nb) {
  static const char months[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                                     "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
  return months[nb];
}


x86 assembly (clang, -O0):
<SCE_Time_GetMonth>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xeed(%rip),%rax
shl    $0x2,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Time_GetMonth>:
mov    %edi,%eax
lea    0xef7(%rip),%rcx
lea    (%rcx,%rax,4),%rax
ret

LLVM IR (-O0):
@SCE_Time_GetMonth.months = internal constant [12 x [4 x i8]] [[4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mar\00", [4 x i8] c"Apr\00", [4 x i8] c"May\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00"]
define i8* @SCE_Time_GetMonth(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [12 x [4 x i8]], [12 x [4 x i8]]* @SCE_Time_GetMonth.months, i64 0, i64 %4
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
ret i8* %6
}

LLVM IR (-O2):
@SCE_Time_GetMonth.months = internal constant [12 x [4 x i8]] [[4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mar\00", [4 x i8] c"Apr\00", [4 x i8] c"May\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00"]
define i8* @SCE_Time_GetMonth(i32 %0) {
%2 = zext i32 %0 to i64
%3 = getelementptr inbounds [12 x [4 x i8]], [12 x [4 x i8]]* @SCE_Time_GetMonth.months, i64 0, i64 %2, i64 0
ret i8* %3
}
/* Variables and functions */
int rand();
int gen_rand(int min, int max) { return (min + (rand() % (max - min) + 1)); }


x86 assembly (clang, -O0):
<gen_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    $0x1,%edx
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_rand>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
xor    %eax,%eax
call   1030 <rand@plt>
sub    %r14d,%ebx
cltd
idiv   %ebx
lea    (%r14,%rdx,1),%eax
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @gen_rand(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 = call i32 (...) @rand()
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = srem i32 %6, %9
%11 = add nsw i32 %10, 1
%12 = add nsw i32 %5, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @gen_rand(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub nsw i32 %1, %0
%5 = srem i32 %3, %4
%6 = add i32 %0, 1
%7 = add i32 %6, %5
ret i32 %7
}
extern unsigned char get_bit_0(const unsigned char c) { return (c & 0x1) > 0; }


x86 assembly (clang, -O0):
<get_bit_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit_0>:
mov    %edi,%eax
and    $0x1,%al
ret

LLVM IR (-O0):
define zeroext i8 @get_bit_0(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 1
%6 = icmp sgt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = trunc i32 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @get_bit_0(i8 zeroext %0) {
%2 = and i8 %0, 1
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ is_prime();
int main() {
  is_prime();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @is_prime()
ret i32 0
}
void termop_unhandled(struct ansiseq *s) {
  tnc_log_log(
      6, 3, -1,
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c",
      195, __func__, "unrecognized:");
  ansiseq_dump(s);
}


x86 assembly (clang, -O0):
<termop_unhandled>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x6,%edi
mov    $0x3,%esi
mov    $0xffffffff,%edx
lea    0xebe(%rip),%rcx
mov    $0xc3,%r8d
lea    0xf37(%rip),%r9
lea    0xf41(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <tnc_log_log@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <ansiseq_dump@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<termop_unhandled>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xf68(%rip),%rax
mov    %rax,(%rsp)
lea    0xec6(%rip),%rcx
lea    0xf45(%rip),%r9
mov    $0x6,%edi
mov    $0x3,%esi
mov    $0xffffffff,%edx
mov    $0xc3,%r8d
xor    %eax,%eax
call   1030 <tnc_log_log@plt>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <ansiseq_dump@plt>

LLVM IR (-O0):
%struct.ansiseq = type opaque
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c\00"
@__func__.termop_unhandled = [17 x i8] c"termop_unhandled\00"
@.str.1 = [14 x i8] c"unrecognized:\00"
define void @termop_unhandled(%struct.ansiseq* %0) {
%2 = alloca %struct.ansiseq*
store %struct.ansiseq* %0, %struct.ansiseq** %2
%3 = call i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @tnc_log_log to i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...)*)(i32 6, i32 3, i32 -1, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 195, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.termop_unhandled, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%4 = load %struct.ansiseq*, %struct.ansiseq** %2
%5 = call i32 (%struct.ansiseq*, ...) bitcast (i32 (...)* @ansiseq_dump to i32 (%struct.ansiseq*, ...)*)(%struct.ansiseq* %4)
ret void
}

LLVM IR (-O2):
%struct.ansiseq = type opaque
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c\00"
@__func__.termop_unhandled = [17 x i8] c"termop_unhandled\00"
@.str.1 = [14 x i8] c"unrecognized:\00"
define void @termop_unhandled(%struct.ansiseq* %0) {
%2 = tail call i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @tnc_log_log to i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...)*)(i32 6, i32 3, i32 -1, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 195, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.termop_unhandled, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (%struct.ansiseq*, ...) bitcast (i32 (...)* @ansiseq_dump to i32 (%struct.ansiseq*, ...)*)(%struct.ansiseq* %0)
ret void
}
/* Variables and functions */
short exp(short);
short internal_exp_s(short value) { return exp(value); }


x86 assembly (clang, -O0):
<internal_exp_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edi
call   1030 <exp@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_exp_s>:
jmp    1030 <exp@plt>

LLVM IR (-O0):
define signext i16 @internal_exp_s(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @exp(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @internal_exp_s(i16 signext %0) {
%2 = tail call signext i16 @exp(i16 signext %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ AskForPort(unsigned short *);
char *GetData(int *, unsigned short);
int /*<<< orphan*/ SendData(int, char *);
int /*<<< orphan*/ initialize_socket(unsigned short);
int /*<<< orphan*/ printf(char *, char *);
main() {
  unsigned short port;
  int connection;
  char *text;
  AskForPort(&port);
  initialize_socket(port);
  while (1) {
    text = GetData(&connection, port);
    printf("received: %s\n", text);
    SendData(connection, text);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x6(%rbp),%rdi
call   1030 <AskForPort@plt>
movzwl -0x6(%rbp),%edi
call   1050 <initialize_socket@plt>
lea    -0xc(%rbp),%rdi
movzwl -0x6(%rbp),%esi
call   1060 <GetData@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1070 <SendData@plt>
jmp    1171 <main+0x21>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xa(%rsp),%rdi
call   1030 <AskForPort@plt>
movzwl 0xa(%rsp),%edi
call   1050 <initialize_socket@plt>
lea    0xc(%rsp),%r14
lea    0xe87(%rip),%r15
nopl   0x0(%rax)
movzwl 0xa(%rsp),%esi
mov    %r14,%rdi
call   1060 <GetData@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1070 <SendData@plt>
jmp    1180 <main+0x30>

LLVM IR (-O0):
@.str = [14 x i8] c"received: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i32 @AskForPort(i16* %2)
%6 = load i16, i16* %2
%7 = call i32 @initialize_socket(i16 zeroext %6)
br label %8
8: ; preds = %0, %8
%9 = load i16, i16* %2
%10 = call i8* @GetData(i32* %3, i16 zeroext %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i32, i32* %3
%14 = load i8*, i8** %4
%15 = call i32 @SendData(i32 %13, i8* %14)
br label %8
}

LLVM IR (-O2):
@.str = [14 x i8] c"received: %s\0A\00"
define i32 @main() {
%1 = alloca i16
%2 = alloca i32
%3 = bitcast i16* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @AskForPort(i16* %1)
%6 = load i16, i16* %1
%7 = call i32 @initialize_socket(i16 zeroext %6)
br label %8
8: ; preds = %8, %0
%9 = load i16, i16* %1
%10 = call i8* @GetData(i32* %2, i16 zeroext %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* %2
%13 = call i32 @SendData(i32 %12, i8* %10)
br label %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage_word_format();
void usage(char **argv) {
  fprintf(stderr, "Usage: %s [-W<word format>] [<file> ...]\n\n", argv[0]);
  usage_word_format();
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xead(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1050 <usage_word_format@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
mov    (%rdi),%rdx
lea    0xebc(%rip),%rsi
mov    %eax,%edi
call   1030 <fprintf@plt>
xor    %eax,%eax
call   1050 <usage_word_format@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s [-W<word format>] [<file> ...]\0A\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i32 (...) @usage_word_format()
%9 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s [-W<word format>] [<file> ...]\0A\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 (...) @usage_word_format()
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *dir_name(char *);
int /*<<< orphan*/ free(char *);
char *parent_dir_name(char const *);
char *parent_parent_dir_name(const char *path) {
  char *parent_dir;
  char *parent_parent_dir;
  parent_dir = parent_dir_name(path);
  if (!parent_dir)
    return NULL;
  parent_parent_dir = dir_name(parent_dir);
  free(parent_dir);
  return parent_parent_dir;
}


x86 assembly (clang, -O0):
<parent_parent_dir_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <parent_dir_name@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1161 <parent_parent_dir_name+0x31>
movq   $0x0,-0x8(%rbp)
jmp    117f <parent_parent_dir_name+0x4f>
mov    -0x18(%rbp),%rdi
call   1050 <dir_name@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent_parent_dir_name>:
push   %r14
push   %rbx
push   %rax
call   1040 <parent_dir_name@plt>
test   %rax,%rax
je     1159 <parent_parent_dir_name+0x29>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <dir_name@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
jmp    115b <parent_parent_dir_name+0x2b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @parent_parent_dir_name(i8* %0) {
%2 = tail call i8* @parent_dir_name(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i8* @dir_name(i8* %2)
%6 = tail call i32 @free(i8* %2)
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %8
}
int ffc2ll(char *cval, int *lval, int *status) {
  if (*status > 0)
    return (*status);
  if (cval[0] == 'T')
    *lval = 1;
  else
    *lval = 0;
  return (*status);
}


x86 assembly (clang, -O0):
<ffc2ll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jle    112b <ffc2ll+0x2b>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <ffc2ll+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x54,%eax
jne    114a <ffc2ll+0x4a>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    1154 <ffc2ll+0x54>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffc2ll>:
mov    (%rdx),%eax
test   %eax,%eax
jle    1107 <ffc2ll+0x7>
ret
xor    %eax,%eax
cmpb   $0x54,(%rdi)
sete   %al
mov    %eax,(%rsi)
mov    (%rdx),%eax
ret

LLVM IR (-O0):
define i32 @ffc2ll(i8* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%8 = load i32*, i32** %7
%9 = load i32, i32* %8
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
store i32 %13, i32* %4
br label %27
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 84
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = load i32*, i32** %6
store i32 1, i32* %21
br label %24
22: ; preds = %14
%23 = load i32*, i32** %6
store i32 0, i32* %23
br label %24
24: ; preds = %22, %20
%25 = load i32*, i32** %7
%26 = load i32, i32* %25
store i32 %26, i32* %4
br label %27
27: ; preds = %24, %11
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @ffc2ll(i8* nocapture %0, i32* nocapture writeonly %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 84
%9 = zext i1 %8 to i32
store i32 %9, i32* %1
%10 = load i32, i32* %2
br label %11
11: ; preds = %3, %6
%12 = phi i32 [ %10, %6 ], [ %4, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ sort(void *, size_t, int (*)(void *, void *),
                        int /*<<< orphan*/, size_t);
void quicksort(void *array, size_t nitems, size_t size,
               int (*cmp)(void *, void *)) {
  sort(array, size, cmp, 0, nitems * size);
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%r8
imul   -0x18(%rbp),%r8
xor    %ecx,%ecx
call   1030 <sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
mov    %rsi,%r8
imul   %rdx,%r8
mov    %rdx,%rsi
mov    %rcx,%rdx
xor    %ecx,%ecx
jmp    1030 <sort@plt>

LLVM IR (-O0):
define void @quicksort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32 (i8*, i8*)*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32 (i8*, i8*)* %3, i32 (i8*, i8*)** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %7
%11 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %8
%12 = load i64, i64* %6
%13 = load i64, i64* %7
%14 = mul i64 %12, %13
%15 = call i32 @sort(i8* %9, i64 %10, i32 (i8*, i8*)* %11, i32 0, i64 %14)
ret void
}

LLVM IR (-O2):
define void @quicksort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = mul i64 %2, %1
%6 = tail call i32 @sort(i8* %0, i64 %2, i32 (i8*, i8*)* %3, i32 0, i64 %5)
ret void
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int64_t int64max(int64_t a, int64_t b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<int64max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <int64max+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <int64max+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @int64max(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int main(void) {
  char c = '\0';
  signed char sc = -1;
  unsigned char uc = 42U;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movb   $0xff,-0x6(%rbp)
movb   $0x2a,-0x7(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned int unset_the_kth_bit_in_a_number(unsigned int num, int k) {
  if ((k < 0) || (k >= (8 * sizeof(num)))) {
    return (~0);
  }
  unsigned int kth_bit_unset_mask = ~(1 << k);
  return (num & kth_bit_unset_mask);
}


x86 assembly (clang, -O0):
<unset_the_kth_bit_in_a_number>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1122 <unset_the_kth_bit_in_a_number+0x22>
movslq -0xc(%rbp),%rax
cmp    $0x20,%rax
jb     112e <unset_the_kth_bit_in_a_number+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1147 <unset_the_kth_bit_in_a_number+0x47>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unset_the_kth_bit_in_a_number>:
btr    %esi,%edi
cmp    $0x20,%esi
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @unset_the_kth_bit_in_a_number(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = icmp uge i64 %11, 32
br i1 %12, label %13, label %14
13: ; preds = %9, %2
store i32 -1, i32* %3
br label %21
14: ; preds = %9
%15 = load i32, i32* %5
%16 = shl i32 1, %15
%17 = xor i32 %16, -1
store i32 %17, i32* %6
%18 = load i32, i32* %4
%19 = load i32, i32* %6
%20 = and i32 %18, %19
store i32 %20, i32* %3
br label %21
21: ; preds = %14, %13
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @unset_the_kth_bit_in_a_number(i32 %0, i32 %1) {
%3 = icmp ugt i32 %1, 31
%4 = shl nuw i32 1, %1
%5 = xor i32 %4, -1
%6 = and i32 %5, %0
%7 = select i1 %3, i32 -1, i32 %6
ret i32 %7
}
int main() { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
int Irc_If_API(void) { return 3; }


x86 assembly (clang, -O0):
<Irc_If_API>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @Irc_If_API() {
ret i32 3
}

LLVM IR (-O2):
define i32 @Irc_If_API() {
ret i32 3
}
void write16(int in, unsigned char *buf) {
  buf[0] = in >> 8;
  buf[1] = in & 0xff;
}


x86 assembly (clang, -O0):
<write16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write16>:
rol    $0x8,%di
mov    %di,(%rsi)
ret

LLVM IR (-O0):
define void @write16(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = ashr i32 %5, 8
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i32, i32* %3
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %14
ret void
}

LLVM IR (-O2):
define void @write16(i32 %0, i8* nocapture writeonly %1) {
%3 = lshr i32 %0, 8
%4 = trunc i32 %3 to i8
store i8 %4, i8* %1
%5 = trunc i32 %0 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
void quack2() { foo(8); }


x86 assembly (clang, -O0):
<quack2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8,%edi
call   1030 <foo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<quack2>:
mov    $0x8,%edi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @quack2() {
%1 = call i32 @foo(i32 8)
ret void
}

LLVM IR (-O2):
define void @quack2() {
%1 = tail call i32 @foo(i32 8)
ret void
}
int set_memory_encrypted(unsigned long addr, int numpages) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @set_memory_encrypted(i64 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ do_while_sub(char *, int);
char *malloc(int);
void do_while() {
  char *a = malloc(10);
  do_while_sub(a, 10);
  do_while_sub(a, 11);
}


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

x86 assembly (clang, -O2):
<do_while>:
push   %rbx
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1040 <do_while_sub@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
pop    %rbx
jmp    1040 <do_while_sub@plt>

LLVM IR (-O0):
define void @do_while() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 10)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @do_while_sub(i8* %3, i32 10)
%5 = load i8*, i8** %1
%6 = call i32 @do_while_sub(i8* %5, i32 11)
ret void
}

LLVM IR (-O2):
define void @do_while() {
%1 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%2 = tail call i32 @do_while_sub(i8* %1, i32 10)
%3 = tail call i32 @do_while_sub(i8* %1, i32 11)
ret void
}
void nf_hook_ingress_init(struct net_device *dev) {}


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

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

LLVM IR (-O0):
%struct.net_device = type opaque
define void @nf_hook_ingress_init(%struct.net_device* %0) {
%2 = alloca %struct.net_device*
store %struct.net_device* %0, %struct.net_device** %2
ret void
}

LLVM IR (-O2):
%struct.net_device = type opaque
define void @nf_hook_ingress_init(%struct.net_device* nocapture %0) {
ret void
}
void freeGrid(short **array) {
  free(array[0]);
  free(array);
}


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

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

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

LLVM IR (-O2):
define void @freeGrid(i16** nocapture %0) {
%2 = bitcast i16** %0 to i8**
%3 = load i8*, i8** %2
tail call void @free(i8* %3)
%4 = bitcast i16** %0 to i8*
tail call void @free(i8* %4)
ret void
}
signed char foo3(void) { return 1; }


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

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

LLVM IR (-O0):
define signext i8 @foo3() {
ret i8 1
}

LLVM IR (-O2):
define signext i8 @foo3() {
ret i8 1
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int sd_get_uids(uid_t **users) {
  return -EINVAL;
}


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

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

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_get_uids(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_get_uids(i32** nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
void *ExClientInit(const char tier_name[100]) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @ExClientInit(i8* nocapture readnone %0) {
ret i8* null
}
int test_imm_1Cint16_reg(short val) {
  return ((val) & (0x1C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_1Cint16_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, 28
%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_1Cint16_reg(i16 signext %0) {
%2 = and i16 %0, 28
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
size_t find(int, int *);
void funion(int x, int y, int *p) { p[find(x, p)] = find(y, p); }


x86 assembly (clang, -O0):
<funion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <find@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <find@plt>
mov    -0x1c(%rbp),%edx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %edx,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funion>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %edi,%r14d
mov    %esi,%edi
mov    %rdx,%rsi
call   1030 <find@plt>
mov    %rax,%rbp
mov    %r14d,%edi
mov    %rbx,%rsi
call   1030 <find@plt>
mov    %ebp,(%rbx,%rax,4)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @funion(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* %5
%8 = load i32*, i32** %6
%9 = call i64 @find(i32 %7, i32* %8)
%10 = trunc i64 %9 to i32
%11 = load i32*, i32** %6
%12 = load i32, i32* %4
%13 = load i32*, i32** %6
%14 = call i64 @find(i32 %12, i32* %13)
%15 = getelementptr inbounds i32, i32* %11, i64 %14
store i32 %10, i32* %15
ret void
}

LLVM IR (-O2):
define void @funion(i32 %0, i32 %1, i32* %2) {
%4 = tail call i64 @find(i32 %1, i32* %2)
%5 = trunc i64 %4 to i32
%6 = tail call i64 @find(i32 %0, i32* %2)
%7 = getelementptr inbounds i32, i32* %2, i64 %6
store i32 %5, i32* %7
ret void
}
/* Type definitions */
struct pstat_str {
  int dummy;
};

/* Variables and functions */
double find_zp(int, double, int, double, struct pstat_str *);
double find_z(int score, double escore, int length, double comp,
              struct pstat_str *pu) {
  return find_zp(score, escore, length, comp, pu);
}


x86 assembly (clang, -O0):
<find_z>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rdx
call   1030 <find_zp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_z>:
jmp    1030 <find_zp@plt>

LLVM IR (-O0):
%struct.pstat_str = type { i32 }
define double @find_z(i32 %0, double %1, i32 %2, double %3, %struct.pstat_str* %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca %struct.pstat_str*
store i32 %0, i32* %6
store double %1, double* %7
store i32 %2, i32* %8
store double %3, double* %9
store %struct.pstat_str* %4, %struct.pstat_str** %10
%11 = load i32, i32* %6
%12 = load double, double* %7
%13 = load i32, i32* %8
%14 = load double, double* %9
%15 = load %struct.pstat_str*, %struct.pstat_str** %10
%16 = call double @find_zp(i32 %11, double %12, i32 %13, double %14, %struct.pstat_str* %15)
ret double %16
}

LLVM IR (-O2):
%struct.pstat_str = type { i32 }
define double @find_z(i32 %0, double %1, i32 %2, double %3, %struct.pstat_str* %4) {
%6 = tail call double @find_zp(i32 %0, double %1, i32 %2, double %3, %struct.pstat_str* %4)
ret double %6
}
void *tight_loop(void *unused) {
  unsigned i0;
  unsigned i1;
  for (i0 = i1 = 0; ++i1 > i0; i0 = i1) {
    ;
  }
}


x86 assembly (clang, -O0):
<tight_loop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmp    -0x14(%rbp),%eax
jbe    1138 <tight_loop+0x38>
jmp    112d <tight_loop+0x2d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1116 <tight_loop+0x16>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i8* @tight_loop(i8* nocapture readnone %0) {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(void) {
  char hi[40];
  fgets(hi, 40, stdin);
  fprintf(stderr, "String is '%s'\n", hi);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
mov    $0x28,%esi
call   1030 <fgets@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rdx
lea    0xea6(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0x2ebc(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
call   1030 <fgets@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@stderr = global i32 0
@.str = [16 x i8] c"String is '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [40 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 40, i32 %4)
%6 = load i32, i32* @stderr
%7 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stderr = global i32 0
@.str = [16 x i8] c"String is '%s'\0A\00"
define i32 @main() {
%1 = alloca [40 x i8]
%2 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 40, i32 %3)
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ rdtsc_markerInit();
void cere_markerInit() { rdtsc_markerInit(); }


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

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

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

LLVM IR (-O2):
define void @cere_markerInit() {
%1 = tail call i32 (...) @rdtsc_markerInit()
ret void
}
/* Variables and functions */
int write(int, void const *, size_t);
int Write(int fd, const void *buf, size_t size) { return write(fd, buf, size); }


x86 assembly (clang, -O0):
<Write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Write>:
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @Write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ dcl_av(int, int, ...);
void test_1(void) {
  dcl_av(1, 1);
  dcl_av(2, 1, 2);
  dcl_av(2, 1, 2, 3);
}


x86 assembly (clang, -O0):
<test_1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%esi
mov    %esi,%edi
mov    $0x0,%al
call   1030 <dcl_av@plt>
mov    $0x2,%edx
mov    $0x1,%esi
mov    %edx,%edi
mov    $0x0,%al
call   1030 <dcl_av@plt>
mov    $0x2,%edx
mov    $0x1,%esi
mov    $0x3,%ecx
mov    %edx,%edi
mov    $0x0,%al
call   1030 <dcl_av@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_1>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <dcl_av@plt>
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <dcl_av@plt>
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
xor    %eax,%eax
pop    %r8
jmp    1030 <dcl_av@plt>

LLVM IR (-O0):
define void @test_1() {
%1 = call i32 (i32, i32, ...) @dcl_av(i32 1, i32 1)
%2 = call i32 (i32, i32, ...) @dcl_av(i32 2, i32 1, i32 2)
%3 = call i32 (i32, i32, ...) @dcl_av(i32 2, i32 1, i32 2, i32 3)
ret void
}

LLVM IR (-O2):
define void @test_1() {
%1 = tail call i32 (i32, i32, ...) @dcl_av(i32 1, i32 1)
%2 = tail call i32 (i32, i32, ...) @dcl_av(i32 2, i32 1, i32 2)
%3 = tail call i32 (i32, i32, ...) @dcl_av(i32 2, i32 1, i32 2, i32 3)
ret void
}
char *langRomTypeRtype() { return "R-Type"; }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"R-Type\00"
define i8* @langRomTypeRtype() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"R-Type\00"
define i8* @langRomTypeRtype() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int candy(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x[] = {
      1,
      2,
      2,
  };
  printf("%d\n", candy(x, sizeof(x) / sizeof(int)));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <candy@plt>
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1040 <candy@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [3 x i32] [i32 1, i32 2, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @candy(i32* %3, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ init_colors();
int /*<<< orphan*/ initscr();
void init() {
  initscr();
  init_colors();
}


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

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

LLVM IR (-O0):
define void @init() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @init_colors()
ret void
}

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @init_colors()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void sh_exit() { exit(0); }


x86 assembly (clang, -O0):
<sh_exit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sh_exit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @sh_exit() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sh_exit() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
unsigned int _packhl2(unsigned int src1, unsigned int src2) {
  unsigned v0 = src1 & 0xffff0000;
  unsigned v1 = src2 & 0x0000ffff;
  unsigned v = v0 | v1;
  return v;
}


x86 assembly (clang, -O0):
<_packhl2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff0000,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_packhl2>:
and    $0xffff0000,%edi
movzwl %si,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @_packhl2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = and i32 %8, -65536
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = and i32 %10, 65535
store i32 %11, i32* %6
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = or i32 %12, %13
store i32 %14, i32* %7
%15 = load i32, i32* %7
ret i32 %15
}

LLVM IR (-O2):
define i32 @_packhl2(i32 %0, i32 %1) {
%3 = and i32 %0, -65536
%4 = and i32 %1, 65535
%5 = or i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_handler(int nsig) {
  switch (nsig) {
  case 2:
    printf("Receive signal %d, CTRL-C pressed\n");
    break;
  case 3:
    printf("Receive signal %d, CTRL-4 pressed\n");
  }
}


x86 assembly (clang, -O0):
<my_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x2,%eax
je     1140 <my_handler+0x30>
jmp    112f <my_handler+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     1151 <my_handler+0x41>
jmp    115d <my_handler+0x4d>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
jmp    115d <my_handler+0x4d>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_handler>:
cmp    $0x2,%edi
je     1126 <my_handler+0x16>
cmp    $0x3,%edi
jne    1132 <my_handler+0x22>
lea    0xf02(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xed3(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Receive signal %d, CTRL-C pressed\0A\00"
@.str.1 = [35 x i8] c"Receive signal %d, CTRL-4 pressed\0A\00"
define void @my_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 2, label %4
i32 3, label %6
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %1, %4
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"Receive signal %d, CTRL-C pressed\0A\00"
@.str.1 = [35 x i8] c"Receive signal %d, CTRL-4 pressed\0A\00"
define void @my_handler(i32 %0) {
switch i32 %0, label %6 [
i32 2, label %3
i32 3, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), %1 ]
%5 = tail call i32 @printf(i8* dereferenceable(1) %4)
br label %6
6: ; preds = %3, %1
ret void
}