xunge/DecIR huggingface dataset:
indreg0adr1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*p0) = (*((float *)(11111111 & ~(__alignof__(float) - 1)))); }


x86 assembly (clang, -O0):
<indreg0adr1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    $0xa98ac4,%eax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0adr1_set>:
movss  0xa98ac4,%xmm0
movss  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define i32 @indreg0adr1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float, float* inttoptr (i64 11111108 to float*)
%17 = load float*, float** %12
store float %16, float* %17
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @indreg0adr1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture readnone %5) {
%7 = load float, float* inttoptr (i64 11111108 to float*)
store float %7, float* %4
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ deal_with_declarator(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ read_to_first_identifier(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/ *);
void cdecler(FILE *istream, FILE *ostream) {
  read_to_first_identifier(istream, ostream);
  deal_with_declarator(istream, ostream);
  fprintf(ostream, "\n");
  fflush(ostream);
}


x86 assembly (clang, -O0):
<cdecler>:
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   1040 <read_to_first_identifier@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <deal_with_declarator@plt>
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdecler>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <read_to_first_identifier@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <deal_with_declarator@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fflush@plt>

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

LLVM IR (-O2):
define void @cdecler(i32* %0, i32* %1) {
%3 = tail call i32 @read_to_first_identifier(i32* %0, i32* %1)
%4 = tail call i32 @deal_with_declarator(i32* %0, i32* %1)
%5 = tail call i32 @fputc(i32 10, i32* %1)
%6 = tail call i32 @fflush(i32* %1)
ret void
}
/* Variables and functions */
scalar_t__ ERR;
int /*<<< orphan*/ OK;
scalar_t__ getch();
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
void cmd_DRAIN(int nargs, char **args) {
  while (getch() != ERR)
    ;
  report_count(1);
  report_return(OK);
}


x86 assembly (clang, -O0):
<cmd_DRAIN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getch@plt>
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%rax
je     115b <cmd_DRAIN+0x2b>
jmp    113f <cmd_DRAIN+0xf>
mov    $0x1,%edi
call   1040 <report_count@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1030 <report_return@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_DRAIN>:
push   %rbx
mov    0x2eb0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getch@plt>
cmp    (%rbx),%rax
jne    1140 <cmd_DRAIN+0x10>
mov    $0x1,%edi
call   1040 <report_count@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1030 <report_return@plt>

LLVM IR (-O0):
@ERR = global i64 0
@OK = global i32 0
define void @cmd_DRAIN(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
br label %5
5: ; preds = %9, %2
%6 = call i64 (...) @getch()
%7 = load i64, i64* @ERR
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = call i32 @report_count(i32 1)
%12 = load i32, i32* @OK
%13 = call i32 @report_return(i32 %12)
ret void
}

LLVM IR (-O2):
@ERR = global i64 0
@OK = global i32 0
define void @cmd_DRAIN(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i64 (...) @getch()
%5 = load i64, i64* @ERR
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = tail call i32 @report_count(i32 1)
%9 = load i32, i32* @OK
%10 = tail call i32 @report_return(i32 %9)
ret void
}
const char *find_char_pos(const char *str, char chr) {
  while (*str && *str != chr)
    str++;
  return str;
}


x86 assembly (clang, -O0):
<find_char_pos>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     1136 <find_char_pos+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1146 <find_char_pos+0x46>
jmp    1157 <find_char_pos+0x57>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110e <find_char_pos+0xe>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_char_pos>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <find_char_pos+0x21>
cmp    %sil,%cl
jne    1110 <find_char_pos+0x10>
ret

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

LLVM IR (-O2):
define i8* @find_char_pos(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = icmp eq i8 %5, %1
%8 = or i1 %6, %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void dprint(char *cad) {
  int i = 0;
  while (cad[i] != 0) {
    write(1, &cad[i], 1);
    i++;
  }
}


x86 assembly (clang, -O0):
<dprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115d <dprint+0x4d>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <dprint+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dprint>:
push   %rbx
cmpb   $0x0,(%rdi)
je     113c <dprint+0x2c>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <dprint+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @dprint(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = tail call i32 @write(i32 1, i8* %6, i32 1)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("Usage: ./csim -s [s] -E [E] -b [b] -t [filename]\n");
}


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 = [50 x i8] c"Usage: ./csim -s [s] -E [E] -b [b] -t [filename]\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [49 x i8] c"Usage: ./csim -s [s] -E [E] -b [b] -t [filename]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void printstraightstraight(FILE *fh_out, char *linein) {
  fprintf(fh_out, "%s\n", linein);
  return;
}


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

x86 assembly (clang, -O2):
<printstraightstraight>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @printstraightstraight(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 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @printstraightstraight(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void print(const int *p) { printf("%i\n", *p); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define void @print(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
int iswhitespace(int c) { return ((0 <= c && c <= ' ') || c == 127); }


x86 assembly (clang, -O0):
<iswhitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
jg     1121 <iswhitespace+0x21>
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    112b <iswhitespace+0x2b>
cmpl   $0x7f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswhitespace>:
cmp    $0x21,%edi
setb   %al
cmp    $0x7f,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @iswhitespace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 0, %3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 32
br i1 %7, label %11, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 127
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ true, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @iswhitespace(i32 %0) {
%2 = icmp ult i32 %0, 33
%3 = icmp eq i32 %0, 127
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
long filesize(FILE *fd) {
  long curpos, length;
  curpos = ftell(fd);
  fseek(fd, 0L, SEEK_END);
  length = ftell(fd);
  fseek(fd, curpos, SEEK_SET);
  return length;
}


x86 assembly (clang, -O0):
<filesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea4(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filesize>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <ftell@plt>
mov    %rax,%r14
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %rax,%r15
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <fseek@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @filesize(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i64
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i64 @ftell(i32* %5)
store i64 %6, i64* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i64 0, i32 %8)
%10 = load i32*, i32** %2
%11 = call i64 @ftell(i32* %10)
store i64 %11, i64* %4
%12 = load i32*, i32** %2
%13 = load i64, i64* %3
%14 = load i32, i32* @SEEK_SET
%15 = call i32 @fseek(i32* %12, i64 %13, i32 %14)
%16 = load i64, i64* %4
ret i64 %16
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @filesize(i32* nocapture %0) {
%2 = tail call i64 @ftell(i32* %0)
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %0, i64 0, i32 %3)
%5 = tail call i64 @ftell(i32* %0)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i32 @fseek(i32* %0, i64 %2, i32 %6)
ret i64 %5
}
int calc_gain_index(int data0, int data1) {
  if (!(data1 & 4)) {
    return 65;
  } else {
    if ((data1 & 16)) {
      return 64;
    } else {
      if ((data1 & 8)) {
        return 0;
      } else {
        return (data0 ^ 0x3f);
      }
    }
  }
}


x86 assembly (clang, -O0):
<calc_gain_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1125 <calc_gain_index+0x25>
movl   $0x41,-0x4(%rbp)
jmp    1164 <calc_gain_index+0x64>
mov    -0xc(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1140 <calc_gain_index+0x40>
movl   $0x40,-0x4(%rbp)
jmp    1164 <calc_gain_index+0x64>
mov    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     115b <calc_gain_index+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1164 <calc_gain_index+0x64>
mov    -0x8(%rbp),%eax
xor    $0x3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_gain_index>:
mov    $0x41,%eax
test   $0x4,%sil
je     1122 <calc_gain_index+0x22>
mov    $0x40,%eax
test   $0x10,%sil
jne    1122 <calc_gain_index+0x22>
xor    $0x3f,%edi
xor    %eax,%eax
test   $0x8,%sil
cmove  %edi,%eax
ret

LLVM IR (-O0):
define i32 @calc_gain_index(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = and i32 %6, 4
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %2
store i32 65, i32* %3
br label %23
10: ; preds = %2
%11 = load i32, i32* %5
%12 = and i32 %11, 16
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 64, i32* %3
br label %23
15: ; preds = %10
%16 = load i32, i32* %5
%17 = and i32 %16, 8
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 0, i32* %3
br label %23
20: ; preds = %15
%21 = load i32, i32* %4
%22 = xor i32 %21, 63
store i32 %22, i32* %3
br label %23
23: ; preds = %20, %19, %14, %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @calc_gain_index(i32 %0, i32 %1) {
%3 = and i32 %1, 4
%4 = icmp eq i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = and i32 %1, 16
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = and i32 %1, 8
%10 = icmp eq i32 %9, 0
%11 = xor i32 %0, 63
%12 = select i1 %10, i32 %11, i32 0
br label %13
13: ; preds = %8, %5, %2
%14 = phi i32 [ 65, %2 ], [ 64, %5 ], [ %12, %8 ]
ret i32 %14
}
void gtk_menu_shell_insert() {}


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

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

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

LLVM IR (-O2):
define void @gtk_menu_shell_insert() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello, Auto Makefile!\n");
  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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [23 x i8] c"Hello, Auto Makefile!\0A\00"
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 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"Hello, Auto Makefile!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct addrinfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
void xmms_freeaddrinfo(struct addrinfo *res) { freeaddrinfo(res); }


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

x86 assembly (clang, -O2):
<xmms_freeaddrinfo>:
jmp    1030 <freeaddrinfo@plt>

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

LLVM IR (-O2):
%struct.addrinfo = type { i32 }
define void @xmms_freeaddrinfo(%struct.addrinfo* %0) {
%2 = tail call i32 @freeaddrinfo(%struct.addrinfo* %0)
ret void
}
unsigned short *memsetw(unsigned short *dest, unsigned short val, int count) {
  unsigned short *cdest = (unsigned short *)dest;
  while (*cdest && count > 0) {
    *cdest = val;
    cdest++;
    count--;
  }
  return dest;
}


x86 assembly (clang, -O0):
<memsetw>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzwl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1139 <memsetw+0x39>
cmpl   $0x0,-0x10(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1149 <memsetw+0x49>
jmp    116e <memsetw+0x6e>
mov    -0xa(%rbp),%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    111a <memsetw+0x1a>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memsetw>:
mov    %rdi,%rax
cmpw   $0x0,(%rdi)
je     1138 <memsetw+0x38>
test   %edx,%edx
jle    1138 <memsetw+0x38>
lea    0x2(%rax),%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %si,-0x2(%rcx)
cmpw   $0x0,(%rcx)
je     1138 <memsetw+0x38>
lea    -0x1(%rdx),%edi
add    $0x2,%rcx
cmp    $0x1,%edx
mov    %edi,%edx
ja     1120 <memsetw+0x20>
ret

LLVM IR (-O0):
define i16* @memsetw(i16* %0, i16 zeroext %1, i32 %2) {
%4 = alloca i16*
%5 = alloca i16
%6 = alloca i32
%7 = alloca i16*
store i16* %0, i16** %4
store i16 %1, i16* %5
store i32 %2, i32* %6
%8 = load i16*, i16** %4
store i16* %8, i16** %7
br label %9
9: ; preds = %19, %3
%10 = load i16*, i16** %7
%11 = load i16, i16* %10
%12 = zext i16 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %6
%16 = icmp sgt i32 %15, 0
br label %17
17: ; preds = %14, %9
%18 = phi i1 [ false, %9 ], [ %16, %14 ]
br i1 %18, label %19, label %26
19: ; preds = %17
%20 = load i16, i16* %5
%21 = load i16*, i16** %7
store i16 %20, i16* %21
%22 = load i16*, i16** %7
%23 = getelementptr inbounds i16, i16* %22, i32 1
store i16* %23, i16** %7
%24 = load i32, i32* %6
%25 = add nsw i32 %24, -1
store i32 %25, i32* %6
br label %9
26: ; preds = %17
%27 = load i16*, i16** %4
ret i16* %27
}

LLVM IR (-O2):
define i16* @memsetw(i16* returned %0, i16 zeroext %1, i32 %2) {
%4 = load i16, i16* %0
%5 = icmp ne i16 %4, 0
%6 = icmp sgt i32 %2, 0
%7 = and i1 %5, %6
br i1 %7, label %8, label %17
8: ; preds = %3, %8
%9 = phi i16* [ %11, %8 ], [ %0, %3 ]
%10 = phi i32 [ %12, %8 ], [ %2, %3 ]
store i16 %1, i16* %9
%11 = getelementptr inbounds i16, i16* %9, i64 1
%12 = add nsw i32 %10, -1
%13 = load i16, i16* %11
%14 = icmp ne i16 %13, 0
%15 = icmp ugt i32 %10, 1
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %8, label %17
17: ; preds = %8, %3
ret i16* %0
}
/* Variables and functions */
char *strrchr(char const *, char const);
int strlen_until_after_char(const char *string, const char c) {
  const char *p;
  p = strrchr(string, c);
  if (p)
    return p - string + 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<strlen_until_after_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1155 <strlen_until_after_char+0x45>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,-0x4(%rbp)
jmp    115c <strlen_until_after_char+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen_until_after_char>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strrchr@plt>
mov    %eax,%edx
sub    %ebx,%edx
add    $0x1,%edx
xor    %ecx,%ecx
test   %rax,%rax
cmovne %edx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @strlen_until_after_char(i8* %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8*
store i8* %0, i8** %4
store i8 %1, i8* %5
%7 = load i8*, i8** %4
%8 = load i8, i8* %5
%9 = call i8* @strrchr(i8* %7, i8 signext %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = add nsw i64 %17, 1
%19 = trunc i64 %18 to i32
store i32 %19, i32* %3
br label %21
20: ; preds = %2
store i32 0, i32* %3
br label %21
21: ; preds = %20, %12
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @strlen_until_after_char(i8* %0, i8 signext %1) {
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = add i32 %8, 1
%10 = select i1 %4, i32 0, i32 %9
ret i32 %10
}
/* Variables and functions */
char *nvram_get_default(char const *);
int /*<<< orphan*/ printf(char *, char const *);
int do_get_default(const char *var) {
  const char *val;
  int stat = 1;
  if ((val = nvram_get_default(var)) != NULL) {
    printf("%s\n", val);
    stat = 0;
  }
  return stat;
}


x86 assembly (clang, -O0):
<do_get_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <nvram_get_default@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1161 <do_get_default+0x41>
mov    -0x10(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_get_default>:
push   %rax
call   1040 <nvram_get_default@plt>
test   %rax,%rax
je     113e <do_get_default+0x1e>
lea    0xece(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @do_get_default(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %4
%5 = load i8*, i8** %2
%6 = call i8* @nvram_get_default(i8* %5)
store i8* %6, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
store i32 0, i32* %4
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @do_get_default(i8* %0) {
%2 = tail call i8* @nvram_get_default(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ 0, %4 ], [ 1, %1 ]
ret i32 %7
}
void ssh_packet_put_cstring(struct ssh *ssh, const char *str) {
  int r;
  if ((r = sshpkt_put_cstring(ssh, str)) != 0)
    ssh_fatal("%s: %s", __func__, ssh_err(r));
}


x86 assembly (clang, -O0):
<ssh_packet_put_cstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <sshpkt_put_cstring@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     117c <ssh_packet_put_cstring+0x4c>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1030 <ssh_err@plt>
mov    %eax,%edx
lea    0xe92(%rip),%rdi
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1050 <ssh_fatal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssh_packet_put_cstring>:
push   %rax
xor    %eax,%eax
call   1040 <sshpkt_put_cstring@plt>
test   %eax,%eax
je     115d <ssh_packet_put_cstring+0x2d>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <ssh_err@plt>
lea    0xeb4(%rip),%rdi
lea    0xeb4(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
pop    %rcx
jmp    1050 <ssh_fatal@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.ssh = type opaque
@.str = [7 x i8] c"%s: %s\00"
@__func__.ssh_packet_put_cstring = [23 x i8] c"ssh_packet_put_cstring\00"
define void @ssh_packet_put_cstring(%struct.ssh* %0, i8* %1) {
%3 = alloca %struct.ssh*
%4 = alloca i8*
%5 = alloca i32
store %struct.ssh* %0, %struct.ssh** %3
store i8* %1, i8** %4
%6 = load %struct.ssh*, %struct.ssh** %3
%7 = load i8*, i8** %4
%8 = call i32 (%struct.ssh*, i8*, ...) bitcast (i32 (...)* @sshpkt_put_cstring to i32 (%struct.ssh*, i8*, ...)*)(%struct.ssh* %6, i8* %7)
store i32 %8, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* %5
%12 = call i32 (i32, ...) bitcast (i32 (...)* @ssh_err to i32 (i32, ...)*)(i32 %11)
%13 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @ssh_fatal to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__func__.ssh_packet_put_cstring, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
%struct.ssh = type opaque
@.str = [7 x i8] c"%s: %s\00"
@__func__.ssh_packet_put_cstring = [23 x i8] c"ssh_packet_put_cstring\00"
define void @ssh_packet_put_cstring(%struct.ssh* %0, i8* %1) {
%3 = tail call i32 (%struct.ssh*, i8*, ...) bitcast (i32 (...)* @sshpkt_put_cstring to i32 (%struct.ssh*, i8*, ...)*)(%struct.ssh* %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @ssh_err to i32 (i32, ...)*)(i32 %3)
%7 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @ssh_fatal to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__func__.ssh_packet_put_cstring, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ finalize();
int /*<<< orphan*/ initialize_random_seed();
int /*<<< orphan*/ make_castle();
int /*<<< orphan*/ opencscad_init();
int main(int argc, char *argv[]) {
  initialize_random_seed();
  opencscad_init();
  make_castle();
  finalize();
  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   1040 <initialize_random_seed@plt>
mov    $0x0,%al
call   1050 <opencscad_init@plt>
mov    $0x0,%al
call   1060 <make_castle@plt>
mov    $0x0,%al
call   1030 <finalize@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <initialize_random_seed@plt>
xor    %eax,%eax
call   1050 <opencscad_init@plt>
xor    %eax,%eax
call   1060 <make_castle@plt>
xor    %eax,%eax
call   1030 <finalize@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 (...) @initialize_random_seed()
%7 = call i32 (...) @opencscad_init()
%8 = call i32 (...) @make_castle()
%9 = call i32 (...) @finalize()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initialize_random_seed()
%4 = tail call i32 (...) @opencscad_init()
%5 = tail call i32 (...) @make_castle()
%6 = tail call i32 (...) @finalize()
ret i32 0
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int int_cmp(void *a, void *b) { return *(int32_t *)a - *(int32_t *)b; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
double sancus_frzd(ssize_t v, ssize_t a, ssize_t b) {
  assert((v >= a) && (v <= b));
  return (double)v;
}


x86 assembly (clang, -O0):
<sancus_frzd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jl     1145 <sancus_frzd+0x35>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sancus_frzd>:
push   %rbx
mov    %rdi,%rbx
cmp    %rsi,%rdi
setge  %al
cmp    %rdx,%rdi
setle  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
cvtsi2sd %rbx,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @sancus_frzd(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = icmp sge i64 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i64, i64* %4
%12 = load i64, i64* %6
%13 = icmp sle i64 %11, %12
br label %14
14: ; preds = %10, %3
%15 = phi i1 [ false, %3 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i64, i64* %4
%19 = sitofp i64 %18 to double
ret double %19
}

LLVM IR (-O2):
define double @sancus_frzd(i64 %0, i64 %1, i64 %2) {
%4 = icmp sge i64 %0, %1
%5 = icmp sle i64 %0, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = sitofp i64 %0 to double
ret double %9
}
int p2(int in) {
  int out = 1;
  int ii;
  if (in == 0)
    return 1;
  for (ii = 1; ii <= in; ii++) {
    out *= 2;
  }
  return out;
}


x86 assembly (clang, -O0):
<p2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1124 <p2+0x24>
movl   $0x1,-0x4(%rbp)
jmp    1154 <p2+0x54>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     114e <p2+0x4e>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112b <p2+0x2b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<p2>:
test   %edi,%edi
jle    1118 <p2+0x18>
lea    -0x1(%rdi),%eax
mov    %edi,%ecx
and    $0x7,%ecx
cmp    $0x7,%eax
jae    111e <p2+0x1e>
mov    $0x1,%eax
jmp    1138 <p2+0x38>
mov    $0x1,%eax
ret
and    $0xfffffff8,%edi
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
shl    $0x8,%eax
add    $0xfffffff8,%edi
jne    1130 <p2+0x30>
test   %ecx,%ecx
je     1147 <p2+0x47>
nopl   0x0(%rax)
add    %eax,%eax
add    $0xffffffff,%ecx
jne    1140 <p2+0x40>
ret

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

LLVM IR (-O2):
define i32 @p2(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %25, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = and i32 %0, 7
%6 = icmp ult i32 %4, 7
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = and i32 %0, -8
br label %9
9: ; preds = %9, %7
%10 = phi i32 [ 1, %7 ], [ %12, %9 ]
%11 = phi i32 [ 0, %7 ], [ %13, %9 ]
%12 = shl i32 %10, 8
%13 = add i32 %11, 8
%14 = icmp eq i32 %13, %8
br i1 %14, label %15, label %9
15: ; preds = %9, %3
%16 = phi i32 [ undef, %3 ], [ %12, %9 ]
%17 = phi i32 [ 1, %3 ], [ %12, %9 ]
%18 = icmp eq i32 %5, 0
br i1 %18, label %25, label %19
19: ; preds = %15, %19
%20 = phi i32 [ %22, %19 ], [ %17, %15 ]
%21 = phi i32 [ %23, %19 ], [ 0, %15 ]
%22 = shl nsw i32 %20, 1
%23 = add i32 %21, 1
%24 = icmp eq i32 %23, %5
br i1 %24, label %25, label %19
25: ; preds = %15, %19, %1
%26 = phi i32 [ 1, %1 ], [ %16, %15 ], [ %22, %19 ]
ret i32 %26
}
/* Variables and functions */
int /*<<< orphan*/ array_size_or_die(size_t, size_t);
void *realloc_or_die(void *, int /*<<< orphan*/);
void *reallocarray_or_die(void *memory, size_t count, size_t element_size) {
  return realloc_or_die(memory, array_size_or_die(count, element_size));
}


x86 assembly (clang, -O0):
<reallocarray_or_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <array_size_or_die@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <realloc_or_die@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocarray_or_die>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <array_size_or_die@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <realloc_or_die@plt>

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

LLVM IR (-O2):
define i8* @reallocarray_or_die(i8* %0, i64 %1, i64 %2) {
%4 = tail call i32 @array_size_or_die(i64 %1, i64 %2)
%5 = tail call i8* @realloc_or_die(i8* %0, i32 %4)
ret i8* %5
}
void foo818(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo818(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cls();
scalar_t__ ctr(char *);
int /*<<< orphan*/ locate(int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stndend();
int /*<<< orphan*/ stndout();
void putlabel(char *string) {
  cls();
  locate(0, ctr(string) - 1);
  stndout();
  printf(" %s \n\n", string);
  stndend();
}


x86 assembly (clang, -O0):
<putlabel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1080 <cls@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ctr@plt>
mov    %rax,%rsi
sub    $0x1,%rsi
xor    %edi,%edi
call   1060 <locate@plt>
mov    $0x0,%al
call   1070 <stndout@plt>
mov    -0x8(%rbp),%rsi
lea    0xe64(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <stndend@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putlabel>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1080 <cls@plt>
mov    %rbx,%rdi
call   1040 <ctr@plt>
lea    -0x1(%rax),%rsi
xor    %edi,%edi
call   1060 <locate@plt>
xor    %eax,%eax
call   1070 <stndout@plt>
lea    0xe74(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <stndend@plt>

LLVM IR (-O0):
@.str = [7 x i8] c" %s \0A\0A\00"
define void @putlabel(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @cls()
%4 = load i8*, i8** %2
%5 = call i64 @ctr(i8* %4)
%6 = sub nsw i64 %5, 1
%7 = call i32 @locate(i32 0, i64 %6)
%8 = call i32 (...) @stndout()
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (...) @stndend()
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c" %s \0A\0A\00"
define void @putlabel(i8* %0) {
%2 = tail call i32 (...) @cls()
%3 = tail call i64 @ctr(i8* %0)
%4 = add nsw i64 %3, -1
%5 = tail call i32 @locate(i32 0, i64 %4)
%6 = tail call i32 (...) @stndout()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 (...) @stndend()
ret void
}
/* Variables and functions */
int check_ISBN(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char ISBN[20];
  scanf("%s", ISBN);
  printf("%d\n", check_ISBN(ISBN));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <check_ISBN@plt>
mov    %eax,%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <check_ISBN@plt>
lea    0xead(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @check_ISBN(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct timespec {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ __clock_gettime(int /*<<< orphan*/, struct timespec *);
time_t time(time_t *t) {
  struct timespec ts;
  __clock_gettime(CLOCK_REALTIME, &ts);
  if (t)
    *t = ts.tv_sec;
  return ts.tv_sec;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <__clock_gettime@plt>
cmpq   $0x0,-0x8(%rbp)
je     1142 <time+0x32>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <__clock_gettime@plt>
mov    0x8(%rsp),%eax
test   %rbx,%rbx
je     1136 <time+0x26>
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @time(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.timespec
store i32* %0, i32** %2
%4 = load i32, i32* @CLOCK_REALTIME
%5 = call i32 @__clock_gettime(i32 %4, %struct.timespec* %3)
%6 = load i32*, i32** %2
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load i32*, i32** %2
store i32 %10, i32* %11
br label %12
12: ; preds = %8, %1
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @time(i32* writeonly %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = load i32, i32* @CLOCK_REALTIME
%5 = call i32 @__clock_gettime(i32 %4, %struct.timespec* %2)
%6 = icmp eq i32* %0, null
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%8 = load i32, i32* %7
br i1 %6, label %10, label %9
9: ; preds = %1
store i32 %8, i32* %0
br label %10
10: ; preds = %1, %9
ret i32 %8
}
/* Variables and functions */
int gob_end_struct(char *buf, size_t buf_size) {
  if (buf_size >= 1) {
    *buf = '\0';
  }
  return 1;
}


x86 assembly (clang, -O0):
<gob_end_struct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
jb     111e <gob_end_struct+0x1e>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gob_end_struct>:
test   %rsi,%rsi
je     1108 <gob_end_struct+0x8>
movb   $0x0,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @gob_end_struct(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp uge i64 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i8*, i8** %3
store i8 0, i8* %8
br label %9
9: ; preds = %7, %2
ret i32 1
}

LLVM IR (-O2):
define i32 @gob_end_struct(i8* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %5, label %4
4: ; preds = %2
store i8 0, i8* %0
br label %5
5: ; preds = %4, %2
ret i32 1
}
void RTFileAioCtxGetMaxReqCount(void) {}


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

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

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

LLVM IR (-O2):
define void @RTFileAioCtxGetMaxReqCount() {
ret void
}
char *foo(char *p, long unsigned int i) {
  return (char *)i + (long unsigned int)p;
}


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

x86 assembly (clang, -O2):
<foo>:
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i8* @foo(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = inttoptr i64 %5 to i8*
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
ret i8* %9
}

LLVM IR (-O2):
define i8* @foo(i8* %0, i64 %1) {
%3 = inttoptr i64 %1 to i8*
%4 = ptrtoint i8* %0 to i64
%5 = getelementptr inbounds i8, i8* %3, i64 %4
ret i8* %5
}