xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strstr(char const *, char *);
char *skip_dots(const char *pos) {
  pos = strstr(pos, "..");
  if (!pos)
    return NULL;
  while (*pos == '.')
    pos++;
  return (char *)pos;
}


x86 assembly (clang, -O0):
<skip_dots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <skip_dots+0x38>
movq   $0x0,-0x8(%rbp)
jmp    1176 <skip_dots+0x66>
jmp    114d <skip_dots+0x3d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    116e <skip_dots+0x5e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114d <skip_dots+0x3d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_dots>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
test   %rax,%rax
je     113f <skip_dots+0x2f>
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rax),%rcx
cmpb   $0x2e,0x1(%rax)
mov    %rcx,%rax
je     1130 <skip_dots+0x20>
jmp    1141 <skip_dots+0x31>
xor    %ecx,%ecx
mov    %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"..\00"
define i8* @skip_dots(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %8, %4 ], [ %2, %1 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 46
%8 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %7, label %4, label %9
9: ; preds = %4, %1
%10 = phi i8* [ null, %1 ], [ %5, %4 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, short);
int fun_stub_base_7_stub(short a) {
  printf("fun_stub_base_7_stub:a = %d \n", a);
  return a;
}


x86 assembly (clang, -O0):
<fun_stub_base_7_stub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    0xeda(%rip),%rdi
movswl -0x2(%rbp),%esi
call   1030 <printf@plt>
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_stub_base_7_stub>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"fun_stub_base_7_stub:a = %d \0A\00"
define i32 @fun_stub_base_7_stub(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i16 signext %3)
%5 = load i16, i16* %2
%6 = sext i16 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [30 x i8] c"fun_stub_base_7_stub:a = %d \0A\00"
define i32 @fun_stub_base_7_stub(i16 signext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i16 signext %0)
%3 = sext i16 %0 to i32
ret i32 %3
}
int square(x) { return (x * x); }


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

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

LLVM IR (-O0):
define i32 @square(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @square(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_arr(int arr[], int len) {
  int i = 0;
  for (i = 0; i < len; i++)
    printf("%d ", arr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1160 <print_arr+0x50>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <print_arr+0x1d>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_arr+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_arr+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_arr(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
int /*<<< orphan*/ gen_pop();
void gen_not_equal(void) {
  gen_pop();
  gen_call("_ne");
}


x86 assembly (clang, -O0):
<gen_not_equal>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gen_pop@plt>
lea    0xece(%rip),%rdi
call   1040 <gen_call@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_not_equal>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <gen_call@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"_ne\00"
define void @gen_not_equal() {
%1 = call i32 (...) @gen_pop()
%2 = call i32 @gen_call(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"_ne\00"
define void @gen_not_equal() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @gen_call(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dump_stuff_shammx(void *, unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, char *);
void dump_stuff_shammx_msg(const void *msg, void *buf, unsigned int size,
                           unsigned int index) {
  printf("%s : ", (char *)msg);
  dump_stuff_shammx(buf, size, index);
}


x86 assembly (clang, -O0):
<dump_stuff_shammx_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <dump_stuff_shammx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_stuff_shammx_msg>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <dump_stuff_shammx@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%s : \00"
define void @dump_stuff_shammx_msg(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32 @dump_stuff_shammx(i8* %1, i32 %2, i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int read_bit(int /*<<< orphan*/ *);
int /*<<< orphan*/ unget_bit(int);
int peek_bit(FILE *in) {
  int c = read_bit(in);
  unget_bit(c);
  return c;
}


x86 assembly (clang, -O0):
<peek_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <read_bit@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <unget_bit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<peek_bit>:
push   %rbx
call   1040 <read_bit@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <unget_bit@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @peek_bit(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @read_bit(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @unget_bit(i32 %6)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @peek_bit(i32* %0) {
%2 = tail call i32 @read_bit(i32* %0)
%3 = tail call i32 @unget_bit(i32 %2)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ log10(int /*<<< orphan*/);
int count3(uint32_t x) { return (int)log10(x) + 1; }


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

x86 assembly (clang, -O2):
<count3>:
push   %rax
call   1030 <log10@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @count3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @log10(i32 %3)
%5 = trunc i64 %4 to i32
%6 = add nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @count3(i32 %0) {
%2 = tail call i64 @log10(i32 %0)
%3 = trunc i64 %2 to i32
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void DisplayUsage(void) {
  {
    fprintf(stderr, "%s\n",
            "usage: gridsize [-v] gpdfile\n"
            "\n"
            " input : gpdfile - grid parameters definition file\n"
            "\n"
            " output: the number of columns and number of rows in the grid is "
            "written\n"
            "         to stdout. In the event of an error, both values are set "
            "to 0.\n"
            "\n"
            " options:v - verbose\n"
            "\n");
    exit(EXIT_FAILURE);
  };
}


x86 assembly (clang, -O0):
<DisplayUsage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xec9(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<DisplayUsage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xecc(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [251 x i8] c"usage: gridsize [-v] gpdfile\0A\0A input : gpdfile - grid parameters definition file\0A\0A output: the number of columns and number of rows in the grid is written\0A to stdout. In the event of an error, both values are set to 0.\0A\0A options:v - verbose\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @DisplayUsage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([251 x i8], [251 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [251 x i8] c"usage: gridsize [-v] gpdfile\0A\0A input : gpdfile - grid parameters definition file\0A\0A output: the number of columns and number of rows in the grid is written\0A to stdout. In the event of an error, both values are set to 0.\0A\0A options:v - verbose\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @DisplayUsage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([251 x i8], [251 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
struct inhalt {
  int dummy;
};

/* Variables and functions */
scalar_t__ malloc(int /*<<< orphan*/);
int /*<<< orphan*/ open(struct inhalt *, char *);
int /*<<< orphan*/ print_header(struct inhalt *, char *);
int /*<<< orphan*/ sizeofinhalt();
struct inhalt *init_plotter(char *name, char *headerstring) {
  struct inhalt *data = (struct inhalt *)malloc(sizeofinhalt());
  open(data, name);
  print_header(data, headerstring);
  return data;
}


x86 assembly (clang, -O0):
<init_plotter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <sizeofinhalt@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <open@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <print_header@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_plotter>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <sizeofinhalt@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1050 <open@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <print_header@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.inhalt = type { i32 }
define %struct.inhalt* @init_plotter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.inhalt*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 (...) @sizeofinhalt()
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to %struct.inhalt*
store %struct.inhalt* %8, %struct.inhalt** %5
%9 = load %struct.inhalt*, %struct.inhalt** %5
%10 = load i8*, i8** %3
%11 = call i32 @open(%struct.inhalt* %9, i8* %10)
%12 = load %struct.inhalt*, %struct.inhalt** %5
%13 = load i8*, i8** %4
%14 = call i32 @print_header(%struct.inhalt* %12, i8* %13)
%15 = load %struct.inhalt*, %struct.inhalt** %5
ret %struct.inhalt* %15
}

LLVM IR (-O2):
%struct.inhalt = type { i32 }
define %struct.inhalt* @init_plotter(i8* %0, i8* %1) {
%3 = tail call i32 (...) @sizeofinhalt()
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to %struct.inhalt*
%6 = tail call i32 @open(%struct.inhalt* %5, i8* %0)
%7 = tail call i32 @print_header(%struct.inhalt* %5, i8* %1)
ret %struct.inhalt* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
unsigned char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void ignoreComments(FILE *f) {
  unsigned char c;
  while ((c = fgetc(f)) == '#')
    while ((c = fgetc(f)) != '\n')
      ;
  fseek(f, -sizeof(unsigned char), SEEK_CUR);
}


x86 assembly (clang, -O0):
<ignoreComments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
movzbl %al,%eax
cmp    $0x23,%eax
jne    116b <ignoreComments+0x4b>
jmp    1149 <ignoreComments+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
movzbl %al,%eax
cmp    $0xa,%eax
je     1166 <ignoreComments+0x46>
jmp    1149 <ignoreComments+0x29>
jmp    112c <ignoreComments+0xc>
mov    -0x8(%rbp),%rdi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1040 <fseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ignoreComments>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <fgetc@plt>
cmp    $0x23,%al
jne    114a <ignoreComments+0x2a>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%al
jne    1139 <ignoreComments+0x19>
mov    %rbx,%rdi
jmp    1130 <ignoreComments+0x10>
mov    0x2e97(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
pop    %rbx
jmp    1040 <fseek@plt>

LLVM IR (-O0):
@SEEK_CUR = global i32 0
define void @ignoreComments(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
br label %4
4: ; preds = %16, %1
%5 = load i32*, i32** %2
%6 = call zeroext i8 @fgetc(i32* %5)
store i8 %6, i8* %3
%7 = zext i8 %6 to i32
%8 = icmp eq i32 %7, 35
br i1 %8, label %9, label %17
9: ; preds = %4
br label %10
10: ; preds = %15, %9
%11 = load i32*, i32** %2
%12 = call zeroext i8 @fgetc(i32* %11)
store i8 %12, i8* %3
%13 = zext i8 %12 to i32
%14 = icmp ne i32 %13, 10
br i1 %14, label %15, label %16
15: ; preds = %10
br label %10
16: ; preds = %10
br label %4
17: ; preds = %4
%18 = load i32*, i32** %2
%19 = load i32, i32* @SEEK_CUR
%20 = call i32 @fseek(i32* %18, i32 -1, i32 %19)
ret void
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
define void @ignoreComments(i32* nocapture %0) {
%2 = tail call zeroext i8 @fgetc(i32* %0)
%3 = icmp eq i8 %2, 35
br i1 %3, label %7, label %11
4: ; preds = %7
%5 = tail call zeroext i8 @fgetc(i32* %0)
%6 = icmp eq i8 %5, 35
br i1 %6, label %10, label %11
7: ; preds = %1, %10
%8 = tail call zeroext i8 @fgetc(i32* %0)
%9 = icmp eq i8 %8, 10
br i1 %9, label %4, label %10
10: ; preds = %7, %4
br label %7
11: ; preds = %4, %1
%12 = load i32, i32* @SEEK_CUR
%13 = tail call i32 @fseek(i32* %0, i32 -1, i32 %12)
ret void
}
char *savestring(s) const char *s;
{ return ((char *)strcpy(xmalloc(1 + (int)strlen(s)), (s))); }


x86 assembly (clang, -O0):
<savestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x0,%al
call   1050 <xmalloc@plt>
movslq %eax,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<savestring>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
xor    %eax,%eax
call   1050 <xmalloc@plt>
movslq %eax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @savestring(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = trunc i64 %4 to i32
%6 = add nsw i32 1, %5
%7 = call i32 (i32, ...) bitcast (i32 (...)* @xmalloc to i32 (i32, ...)*)(i32 %6)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
%10 = load i8*, i8** %2
%11 = call i8* @strcpy(i8* %9, i8* %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @savestring(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add nsw i32 %3, 1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @xmalloc to i32 (i32, ...)*)(i32 %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = tail call i8* @strcpy(i8* dereferenceable(1) %7, i8* dereferenceable(1) %0)
ret i8* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigwait(int /*<<< orphan*/ *, int *);
int wait_signal(void) {
  int sig;
  sigset_t wset;
  sigemptyset(&wset);
  sigaddset(&wset, SIGHUP);
  sigaddset(&wset, SIGINT);
  sigaddset(&wset, SIGTERM);
  sigwait(&wset, &sig);
  return sig;
}


x86 assembly (clang, -O0):
<wait_signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <sigemptyset@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigaddset@plt>
lea    -0x8(%rbp),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <sigwait@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_signal>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <sigemptyset@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <sigwait@plt>
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIGHUP = global i32 0
@SIGINT = global i32 0
@SIGTERM = global i32 0
define i32 @wait_signal() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @sigemptyset(i32* %2)
%4 = load i32, i32* @SIGHUP
%5 = call i32 @sigaddset(i32* %2, i32 %4)
%6 = load i32, i32* @SIGINT
%7 = call i32 @sigaddset(i32* %2, i32 %6)
%8 = load i32, i32* @SIGTERM
%9 = call i32 @sigaddset(i32* %2, i32 %8)
%10 = call i32 @sigwait(i32* %2, i32* %1)
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@SIGINT = global i32 0
@SIGTERM = global i32 0
define i32 @wait_signal() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @sigemptyset(i32* %2)
%6 = load i32, i32* @SIGHUP
%7 = call i32 @sigaddset(i32* %2, i32 %6)
%8 = load i32, i32* @SIGINT
%9 = call i32 @sigaddset(i32* %2, i32 %8)
%10 = load i32, i32* @SIGTERM
%11 = call i32 @sigaddset(i32* %2, i32 %10)
%12 = call i32 @sigwait(i32* %2, i32* %1)
%13 = load i32, i32* %1
ret i32 %13
}
/* Type definitions */
union i2c_smbus_data {
  int /*<<< orphan*/ word;
};
typedef int /*<<< orphan*/ __u16;
typedef int /*<<< orphan*/ __s32;

/* Variables and functions */
int /*<<< orphan*/ i2c_smbus_access(int, int /*<<< orphan*/, int, int,
                                    union i2c_smbus_data *);
extern __s32 i2c_smbus_write_word_data(int fd, int cmd, __u16 value) {
  union i2c_smbus_data data;
  data.word = value;
  return i2c_smbus_access(fd, 0, cmd, 3, &data);
}


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

x86 assembly (clang, -O2):
<i2c_smbus_write_word_data>:
push   %rax
mov    %esi,%eax
mov    %edx,(%rsp)
mov    %rsp,%r8
xor    %esi,%esi
mov    %eax,%edx
mov    $0x3,%ecx
call   1030 <i2c_smbus_access@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
define i32 @i2c_smbus_write_word_data(i32 %0, i32 %1, i32 %2) {
%4 = alloca %union.i2c_smbus_data
%5 = bitcast %union.i2c_smbus_data* %4 to i8*
%6 = getelementptr inbounds %union.i2c_smbus_data, %union.i2c_smbus_data* %4, i64 0, i32 0
store i32 %2, i32* %6
%7 = call i32 @i2c_smbus_access(i32 %0, i32 0, i32 %1, i32 3, %union.i2c_smbus_data* %4)
ret i32 %7
}
/* Variables and functions */
int __mkostemps(char *, int, int /*<<< orphan*/);
int mkstemps(char *template, int len) { return __mkostemps(template, len, 0); }


x86 assembly (clang, -O0):
<mkstemps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1030 <__mkostemps@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkstemps>:
xor    %edx,%edx
jmp    1030 <__mkostemps@plt>

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

LLVM IR (-O2):
define i32 @mkstemps(i8* %0, i32 %1) {
%3 = tail call i32 @__mkostemps(i8* %0, i32 %1, i32 0)
ret i32 %3
}
/* Variables and functions */
char EOF;
char getchar();
void clear_buffer() {
  char c;
  while ((c = getchar()) != EOF && c != '\n') {
    ;
  }
}


x86 assembly (clang, -O0):
<clear_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%ecx
mov    0x2ebc(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     1149 <clear_buffer+0x39>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1159 <clear_buffer+0x49>
jmp    115e <clear_buffer+0x4e>
jmp    1118 <clear_buffer+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_buffer>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     112f <clear_buffer+0x1f>
cmp    (%rbx),%al
jne    1120 <clear_buffer+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @clear_buffer() {
%1 = alloca i8
br label %2
2: ; preds = %14, %0
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = sext i8 %3 to i32
%5 = load i8, i8* @EOF
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %4, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br label %12
12: ; preds = %8, %2
%13 = phi i1 [ false, %2 ], [ %11, %8 ]
br i1 %13, label %14, label %15
14: ; preds = %12
br label %2
15: ; preds = %12
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @clear_buffer() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = load i8, i8* @EOF
%4 = icmp ne i8 %2, %3
%5 = icmp ne i8 %2, 10
%6 = and i1 %5, %4
br i1 %6, label %1, label %7
7: ; preds = %1
ret void
}
unsigned int Mbi2Mb(unsigned int i) {
  int r = i / 1000000;
  r *= 8;
  return r;
}


x86 assembly (clang, -O0):
<Mbi2Mb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mbi2Mb>:
mov    %edi,%eax
imul   $0x431bde83,%rax,%rax
shr    $0x2f,%rax
and    $0xfffffff8,%eax
ret

LLVM IR (-O0):
define i32 @Mbi2Mb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 1000000
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = mul nsw i32 %6, 8
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @Mbi2Mb(i32 %0) {
%2 = udiv i32 %0, 1000000
%3 = shl nuw nsw i32 %2, 3
ret i32 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int *stack_constructor(void) {
  int *stack = (int *)malloc(sizeof(int) * (6 + 1));
  stack[0] = 0;
  return stack;
}


x86 assembly (clang, -O0):
<stack_constructor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1c,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stack_constructor>:
push   %rax
mov    $0x1c,%edi
call   1030 <malloc@plt>
movl   $0x0,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i32* @stack_constructor() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 28)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = getelementptr inbounds i32, i32* %4, i64 0
store i32 0, i32* %5
%6 = load i32*, i32** %1
ret i32* %6
}

LLVM IR (-O2):
define i32* @stack_constructor() {
%1 = tail call i64 @malloc(i32 28)
%2 = inttoptr i64 %1 to i32*
store i32 0, i32* %2
ret i32* %2
}
unsigned retro_api_version() { return 1; }


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

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

LLVM IR (-O0):
define i32 @retro_api_version() {
ret i32 1
}

LLVM IR (-O2):
define i32 @retro_api_version() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("\nUsage: userls <email/names/paths> <no days old>\n\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [51 x i8] c"\0AUsage: userls <email/names/paths> <no days old>\0A\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [50 x i8] c"\0AUsage: userls <email/names/paths> <no days old>\0A\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int toascii(int c) { return (c & 0x7F); }


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

x86 assembly (clang, -O2):
<toascii>:
mov    %edi,%eax
and    $0x7f,%eax
ret

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

LLVM IR (-O2):
define i32 @toascii(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
/* Variables and functions */
void *realloc(void *, size_t);
void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2) {
  size2 += size1;
  if (size2 < size1)
    return 0;
  return realloc(ptr, size2);
}


x86 assembly (clang, -O0):
<safe_realloc_add_2op_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114b <safe_realloc_add_2op_+0x3b>
movq   $0x0,-0x8(%rbp)
jmp    115c <safe_realloc_add_2op_+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_realloc_add_2op_>:
add    %rdx,%rsi
jae    1118 <safe_realloc_add_2op_+0x8>
xor    %eax,%eax
ret
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @safe_realloc_add_2op_(i8* nocapture %0, i64 %1, i64 %2) {
%4 = add i64 %2, %1
%5 = icmp ult i64 %4, %1
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i8* @realloc(i8* %0, i64 %4)
br label %8
8: ; preds = %3, %6
%9 = phi i8* [ %7, %6 ], [ null, %3 ]
ret i8* %9
}
long main() {
  char **strstar;
  strstar = &*strstar;
  strstar = &*&*&*strstar;
  strstar = &*&*&**strstar;
  return 1;
}


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

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

LLVM IR (-O0):
define i64 @main() {
%1 = alloca i8**
%2 = load i8**, i8*** %1
store i8** %2, i8*** %1
%3 = load i8**, i8*** %1
store i8** %3, i8*** %1
%4 = load i8**, i8*** %1
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i8**
store i8** %6, i8*** %1
ret i64 1
}

LLVM IR (-O2):
define i64 @main() {
ret i64 1
}
int main(void) {
  int *b;
  int **c;
  c = b;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%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 i32*
%3 = alloca i32**
store i32 0, i32* %1
%4 = load i32*, i32** %2
%5 = bitcast i32* %4 to i32**
store i32** %5, i32*** %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char const *);
void method_to_label(const char *class_name, const char method_name[],
                     char *label) {
  strcat(label, "_");
  strcat(label, class_name);
  strcat(label, "_");
  strcat(label, method_name);
}


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"_\00"
define void @method_to_label(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** %6
%8 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %6
%10 = load i8*, i8** %4
%11 = call i32 @strcat(i8* %9, i8* %10)
%12 = load i8*, i8** %6
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %6
%15 = load i8*, i8** %5
%16 = call i32 @strcat(i8* %14, i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"_\00"
define void @method_to_label(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcat(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @strcat(i8* %2, i8* %0)
%6 = tail call i32 @strcat(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @strcat(i8* %2, i8* %1)
ret void
}
/* Variables and functions */
int func(int);
int main(int argc, char *argv[], char *envp[]) { return func(42); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x2a,%edi
jmp    1030 <func@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = call i32 @func(i32 42)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @func(i32 42)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ test(int *);
int main(void) {
  int i;
  test(&i);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @test(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
void printerr(int cond, char *msg) {
  if (cond)
    perror(msg);
}


x86 assembly (clang, -O0):
<printerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <printerr+0x22>
mov    -0x10(%rbp),%rdi
call   1030 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printerr>:
test   %edi,%edi
jne    1115 <printerr+0x5>
ret
mov    %rsi,%rdi
jmp    1030 <perror@plt>

LLVM IR (-O0):
define void @printerr(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @perror(i8* %8)
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @printerr(i32 %0, i8* nocapture %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @perror(i8* %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef scalar_t__ u_int;

/* Variables and functions */
int after(u_int seq1, u_int seq2) { return ((int)(seq2 - seq1) < 0); }


x86 assembly (clang, -O0):
<after>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<after>:
mov    %rsi,%rax
sub    %edi,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @after(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = sub nsw i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = icmp slt i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @after(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = trunc i64 %3 to i32
%5 = lshr i32 %4, 31
ret i32 %5
}
int main() {
  int i;
  while (1) {
    i = i / 2 + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x8(%rbp)
jmp    110b <main+0xb>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
void EC_KEY_get0_group(void) {}


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

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

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

LLVM IR (-O2):
define void @EC_KEY_get0_group() {
ret void
}
int intcaller(int (*ipfn)(void)) { return ipfn(); }


x86 assembly (clang, -O0):
<intcaller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcaller>:
jmp    *%rdi

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

LLVM IR (-O2):
define i32 @intcaller(i32 ()* nocapture %0) {
%2 = tail call i32 %0()
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t lfs_min(uint32_t a, uint32_t b) { return (a < b) ? a : b; }


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

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

LLVM IR (-O0):
define i64 @lfs_min(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 slt 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 @lfs_min(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ InitAcquireNim();
void InitNimFunctionPointers(void) { InitAcquireNim(); }


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

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

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

LLVM IR (-O2):
define void @InitNimFunctionPointers() {
%1 = tail call i32 (...) @InitAcquireNim()
ret void
}
int rescaleInteger(int value, int from, int to) {
  return (to * (value + (from / (to * 2)))) / from;
}


x86 assembly (clang, -O0):
<rescaleInteger>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x10(%rbp),%eax
add    %edx,%ecx
imul   %ecx,%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rescaleInteger>:
mov    %edx,%ecx
lea    (%rcx,%rcx,1),%r8d
mov    %esi,%eax
cltd
idiv   %r8d
add    %edi,%eax
imul   %ecx,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @rescaleInteger(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* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = mul nsw i32 %10, 2
%12 = sdiv i32 %9, %11
%13 = add nsw i32 %8, %12
%14 = mul nsw i32 %7, %13
%15 = load i32, i32* %5
%16 = sdiv i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @rescaleInteger(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 %2, 1
%5 = sdiv i32 %1, %4
%6 = add nsw i32 %5, %0
%7 = mul nsw i32 %6, %2
%8 = sdiv i32 %7, %1
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ calculation_tests();
int main(int argv, const char *argc[]) {
  calculation_tests();
  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 <calculation_tests@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <calculation_tests@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 (...) @calculation_tests()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @calculation_tests()
ret i32 0
}
/* Type definitions */
typedef int time_t;

/* Variables and functions */
time_t time(time_t *t) {
  if (t != NULL)
    *t = 1485898104;
  return 1485898104;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     111d <time+0x1d>
mov    -0x8(%rbp),%rax
movl   $0x58910178,(%rax)
mov    $0x58910178,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
test   %rdi,%rdi
je     110b <time+0xb>
movl   $0x58910178,(%rdi)
mov    $0x58910178,%eax
ret

LLVM IR (-O0):
define i32 @time(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32*, i32** %2
store i32 1485898104, i32* %6
br label %7
7: ; preds = %5, %1
ret i32 1485898104
}

LLVM IR (-O2):
define i32 @time(i32* writeonly %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %4, label %3
3: ; preds = %1
store i32 1485898104, i32* %0
br label %4
4: ; preds = %3, %1
ret i32 1485898104
}
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, size_t);
void unmap_file(void *data, size_t size) { munmap(data, size); }


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

x86 assembly (clang, -O2):
<unmap_file>:
jmp    1030 <munmap@plt>

LLVM IR (-O0):
define void @unmap_file(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @munmap(i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
define void @unmap_file(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
ret void
}