xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n;
  for (n = 1; n <= 50; n = n + 1) {
    printf("%i. Czesc!\n", n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jg     114d <main+0x3d>
mov    -0x8(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x33,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%i. Czesc!\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 51
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
void nonzeroMemseti8() {
  char arr[33] = {
      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  };
}


x86 assembly (clang, -O0):
<nonzeroMemseti8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
mov    $0x2a,%esi
mov    $0x21,%edx
call   1030 <memset@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @nonzeroMemseti8() {
%1 = alloca [33 x i8]
%2 = bitcast [33 x i8]* %1 to i8*
ret void
}

LLVM IR (-O2):
define void @nonzeroMemseti8() {
ret void
}
/* Variables and functions */
unsigned char inb(unsigned int);
unsigned char t1_fifostatus(unsigned int base) { return inb(base + 0x06); }


x86 assembly (clang, -O0):
<t1_fifostatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x6,%edi
call   1030 <inb@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1_fifostatus>:
add    $0x6,%edi
jmp    1030 <inb@plt>

LLVM IR (-O0):
define zeroext i8 @t1_fifostatus(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 6
%5 = call zeroext i8 @inb(i32 %4)
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @t1_fifostatus(i32 %0) {
%2 = add i32 %0, 6
%3 = tail call zeroext i8 @inb(i32 %2)
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *twkb2esriJSON_fromIndexedFile2D(char *, int, double, double, double,
                                      double);
char *test_filereading2esrijson_indexed() {
  char *file_name = "testdata/arealdekke_indexed.twkb";
  char *txt = twkb2esriJSON_fromIndexedFile2D(file_name, 4326, 11.79, 60.58,
                                              11.93, 60.67);
  free(txt);
  return 0;
}


x86 assembly (clang, -O0):
<test_filereading2esrijson_indexed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x10e6,%esi
movsd  0xebc(%rip),%xmm0
movsd  0xebc(%rip),%xmm1
movsd  0xebc(%rip),%xmm2
movsd  0xebc(%rip),%xmm3
call   1040 <twkb2esriJSON_fromIndexedFile2D@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_filereading2esrijson_indexed>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xed0(%rip),%xmm0
movsd  0xed0(%rip),%xmm1
movsd  0xed0(%rip),%xmm2
movsd  0xed0(%rip),%xmm3
mov    $0x10e6,%esi
call   1040 <twkb2esriJSON_fromIndexedFile2D@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"testdata/arealdekke_indexed.twkb\00"
define i8* @test_filereading2esrijson_indexed() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = load i8*, i8** %1
%4 = call i8* @twkb2esriJSON_fromIndexedFile2D(i8* %3, i32 4326, double 1.179000e+01, double 6.058000e+01, double 1.193000e+01, double 6.067000e+01)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @free(i8* %5)
ret i8* null
}

LLVM IR (-O2):
@.str = [33 x i8] c"testdata/arealdekke_indexed.twkb\00"
define noalias i8* @test_filereading2esrijson_indexed() {
%1 = tail call i8* @twkb2esriJSON_fromIndexedFile2D(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 4326, double 1.179000e+01, double 6.058000e+01, double 1.193000e+01, double 6.067000e+01)
%2 = tail call i32 @free(i8* %1)
ret i8* null
}
/* Type definitions */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
scalar_t__ read_str(char *, char *, char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int read_int(char *b, char *f, int *n) {
  char buff[256];
  if (read_str(b, f, buff, sizeof(buff)) < 0)
    return -1;
  sscanf(buff, "%d", n);
  return 0;
}


x86 assembly (clang, -O0):
<read_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    $0x100,%ecx
call   1040 <read_str@plt>
cmp    $0x0,%rax
jge    1166 <read_int+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    1184 <read_int+0x64>
lea    -0x120(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1030 <sscanf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int>:
push   %rbx
sub    $0x100,%rsp
mov    %rdx,%rbx
mov    %rsp,%rdx
mov    $0x100,%ecx
call   1040 <read_str@plt>
test   %rax,%rax
js     1153 <read_int+0x33>
lea    0xebc(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1030 <sscanf@plt>
xor    %eax,%eax
jmp    1158 <read_int+0x38>
mov    $0xffffffff,%eax
add    $0x100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @read_int(i8* %0, i8* %1, i32* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i64 @read_str(i8* %0, i8* %1, i8* %5, i32 256)
%7 = icmp slt i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %3, %8
%11 = phi i32 [ 0, %8 ], [ -1, %3 ]
ret i32 %11
}
double millimetresToFeet(double millimetres) { return millimetres * 3280.8; }


x86 assembly (clang, -O0):
<millimetresToFeet>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<millimetresToFeet>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @millimetresToFeet(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.280800e+03
ret double %4
}

LLVM IR (-O2):
define double @millimetresToFeet(double %0) {
%2 = fmul double %0, 3.280800e+03
ret double %2
}
int tsWrite(int ts) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tsWrite(i32 %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int matches_value(int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
int matches_udp(uint16_t port, int perc11, int perc10, int perc01) {
  return matches_value(ntohs(port), perc11, perc10, perc01);
}


x86 assembly (clang, -O0):
<matches_udp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ntohs@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <matches_value@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matches_udp>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
call   1030 <ntohs@plt>
mov    %eax,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <matches_value@plt>

LLVM IR (-O0):
define i32 @matches_udp(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = call i32 @ntohs(i32 %9)
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @matches_value(i32 %10, i32 %11, i32 %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @matches_udp(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @ntohs(i32 %0)
%6 = tail call i32 @matches_value(i32 %5, i32 %1, i32 %2, i32 %3)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
double SampleQuery(const char *szMsg) {
  if (szMsg)
    printf("%s\n", szMsg);
  return 999;
}


x86 assembly (clang, -O0):
<SampleQuery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1137 <SampleQuery+0x27>
mov    -0x8(%rbp),%rsi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
movsd  0xec1(%rip),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SampleQuery>:
push   %rax
test   %rdi,%rdi
je     1125 <SampleQuery+0x15>
mov    %rdi,%rsi
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
movsd  0xed3(%rip),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define double @SampleQuery(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %5
5: ; preds = %3, %1
ret double 9.990000e+02
}
/* Variables and functions */
int /*<<< orphan*/ Com_Printf(char *);
int /*<<< orphan*/ Cvar_InfoString_Big(int);
int /*<<< orphan*/ Info_Print(int /*<<< orphan*/);
void SV_Systeminfo_f(void) {
  Com_Printf("System info settings:\n");
  Info_Print(Cvar_InfoString_Big(0x0008));
}


x86 assembly (clang, -O0):
<SV_Systeminfo_f>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <Com_Printf@plt>
mov    $0x8,%edi
call   1030 <Cvar_InfoString_Big@plt>
mov    %eax,%edi
call   1050 <Info_Print@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SV_Systeminfo_f>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <Com_Printf@plt>
mov    $0x8,%edi
call   1030 <Cvar_InfoString_Big@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <Info_Print@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"System info settings:\0A\00"
define void @SV_Systeminfo_f() {
%1 = call i32 @Com_Printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @Cvar_InfoString_Big(i32 8)
%3 = call i32 @Info_Print(i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"System info settings:\0A\00"
define void @SV_Systeminfo_f() {
%1 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @Cvar_InfoString_Big(i32 8)
%3 = tail call i32 @Info_Print(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void startall_usage(int code) {
  fprintf(stderr,
          "Starts all available VM instances managed by honeycomb.\n"
          "\n"
          "Usage: %s startall\n"
          "\n",
          "hc");
  exit(code);
}


x86 assembly (clang, -O0):
<startall_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
lea    0xf0c(%rip),%rdx
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<startall_usage>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
lea    0xf14(%rip),%rdx
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [78 x i8] c"Starts all available VM instances managed by honeycomb.\0A\0AUsage: %s startall\0A\0A\00"
@.str.1 = [3 x i8] c"hc\00"
define void @startall_usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [78 x i8] c"Starts all available VM instances managed by honeycomb.\0A\0AUsage: %s startall\0A\0A\00"
@.str.1 = [3 x i8] c"hc\00"
define void @startall_usage(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void CloseFrameBuffer(int fh) { close(fh); }


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

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

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

LLVM IR (-O2):
define void @CloseFrameBuffer(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
void foo_c(struct _Data$$2 *p) { ; }


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

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

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

LLVM IR (-O2):
%"struct._Data$$2" = type opaque
define void @foo_c(%"struct._Data$$2"* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putch(char const);
void IO_puts(const char *str) {
  if (str == NULL)
    return;
  while (*str != 0) {
    putch(*str);
    str++;
  }
}


x86 assembly (clang, -O0):
<IO_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <IO_puts+0x1c>
jmp    115e <IO_puts+0x4e>
jmp    1131 <IO_puts+0x21>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115e <IO_puts+0x4e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putch@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1131 <IO_puts+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_puts>:
push   %rbx
test   %rdi,%rdi
je     1143 <IO_puts+0x33>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1143 <IO_puts+0x33>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <putch@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <IO_puts+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @IO_puts(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %11, %6 ], [ %4, %3 ]
%8 = phi i8* [ %10, %6 ], [ %0, %3 ]
%9 = tail call i32 @putch(i8 signext %7)
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
ret void
}
/* Type definitions */
struct buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bufput(struct buf *, char *, int);
int rndr_linebreak(struct buf *ob, void *opaque) {
  bufput(ob, "<br />\n", sizeof "<br />\n" - 1);
  return 1;
}


x86 assembly (clang, -O0):
<rndr_linebreak>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x7,%edx
call   1030 <bufput@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rndr_linebreak>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x7,%edx
call   1030 <bufput@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.buf = type { i32 }
@.str = [8 x i8] c"<br />\0A\00"
define i32 @rndr_linebreak(%struct.buf* %0, i8* %1) {
%3 = alloca %struct.buf*
%4 = alloca i8*
store %struct.buf* %0, %struct.buf** %3
store i8* %1, i8** %4
%5 = load %struct.buf*, %struct.buf** %3
%6 = call i32 @bufput(%struct.buf* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
ret i32 1
}

LLVM IR (-O2):
%struct.buf = type { i32 }
@.str = [8 x i8] c"<br />\0A\00"
define i32 @rndr_linebreak(%struct.buf* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @bufput(%struct.buf* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
ret i32 1
}
/* Variables and functions */
double limit_degrees(double);
double observer_hour_angle(double nu, double longitude, double alpha_deg) {
  return limit_degrees(nu + longitude - alpha_deg);
}


x86 assembly (clang, -O0):
<observer_hour_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <limit_degrees@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<observer_hour_angle>:
addsd  %xmm1,%xmm0
subsd  %xmm2,%xmm0
jmp    1030 <limit_degrees@plt>

LLVM IR (-O0):
define double @observer_hour_angle(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fadd double %7, %8
%10 = load double, double* %6
%11 = fsub double %9, %10
%12 = call double @limit_degrees(double %11)
ret double %12
}

LLVM IR (-O2):
define double @observer_hour_angle(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fsub double %4, %2
%6 = tail call double @limit_degrees(double %5)
ret double %6
}
float __ocl_convert_float_short(short src) { return (float)src; }


x86 assembly (clang, -O0):
<__ocl_convert_float_short>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_convert_float_short>:
cvtsi2ss %edi,%xmm0
ret

LLVM IR (-O0):
define float @__ocl_convert_float_short(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sitofp i16 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @__ocl_convert_float_short(i16 signext %0) {
%2 = sitofp i16 %0 to float
ret float %2
}
/* Variables and functions */
int foo(int);
int main() { return foo(2); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 2)
ret i32 %1
}
void bitSet(unsigned int *x, int n) {
  int res, mask;
  mask = 1 << n;
  *x = *x | mask;
  return;
}


x86 assembly (clang, -O0):
<bitSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitSet>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     %eax,(%rdi)
ret

LLVM IR (-O0):
define void @bitSet(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = shl i32 1, %7
store i32 %8, i32* %6
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = load i32, i32* %6
%12 = or i32 %10, %11
%13 = load i32*, i32** %3
store i32 %12, i32* %13
ret void
}

LLVM IR (-O2):
define void @bitSet(i32* nocapture %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = load i32, i32* %0
%5 = or i32 %4, %3
store i32 %5, i32* %0
ret void
}
/* Variables and functions */
long strtol(char *, char **, int);
int StrUtil_isLongInteger(long *retVal, char *str) {
  char *endPtr;
  *retVal = strtol(str, &endPtr, 10);
  if (*endPtr != '\0' || endPtr == str) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<StrUtil_isLongInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    115a <StrUtil_isLongInteger+0x4a>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1166 <StrUtil_isLongInteger+0x56>
movl   $0x0,-0x4(%rbp)
jmp    116d <StrUtil_isLongInteger+0x5d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrUtil_isLongInteger>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,(%r14)
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
sete   %cl
cmp    %rbx,%rax
setne  %al
and    %cl,%al
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @StrUtil_isLongInteger(i64* nocapture writeonly %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i64 @strtol(i8* %1, i8** %3, i32 10)
store i64 %5, i64* %0
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = icmp ne i8* %6, %1
%10 = and i1 %9, %8
%11 = zext i1 %10 to i32
ret i32 %11
}
int isLeapYear(int const year) {
  if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    112f <isLeapYear+0x2f>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1143 <isLeapYear+0x43>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <isLeapYear+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    1156 <isLeapYear+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeapYear>:
test   $0x3,%dil
sete   %al
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
cmp    $0x28f5c29,%edx
setae  %dl
and    %al,%dl
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
setb   %al
or     %dl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @isLeapYear(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* %3
%9 = srem i32 %8, 100
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7, %1
%12 = load i32, i32* %3
%13 = srem i32 %12, 400
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %7
store i32 1, i32* %2
br label %17
16: ; preds = %11
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @isLeapYear(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp ne i32 %4, 0
%6 = and i1 %3, %5
%7 = srem i32 %0, 400
%8 = icmp eq i32 %7, 0
%9 = or i1 %8, %6
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ settitle(char *);
int Xnam(int modifier, char *label, char *mnemo, char *oper) {
  if (!oper)
    error("need an operand");
  settitle(oper);
  return 0;
}


x86 assembly (clang, -O0):
<Xnam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    114e <Xnam+0x2e>
lea    0xeb7(%rip),%rdi
call   1030 <error@plt>
mov    -0x20(%rbp),%rdi
call   1040 <settitle@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Xnam>:
push   %rbx
mov    %rcx,%rbx
test   %rcx,%rcx
jne    1135 <Xnam+0x15>
lea    0xed0(%rip),%rdi
call   1030 <error@plt>
mov    %rbx,%rdi
call   1040 <settitle@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"need an operand\00"
define i32 @Xnam(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %4
%12 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %4
%14 = load i8*, i8** %8
%15 = call i32 @settitle(i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"need an operand\00"
define i32 @Xnam(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* %3) {
%5 = icmp eq i8* %3, null
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @settitle(i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void errorMessage(char *str) {
  printf("Can't open %s.\n", str);
  return;
}


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"Can't open %s.\0A\00"
define void @errorMessage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int get_salt_size(void) { return 32; }


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

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

LLVM IR (-O0):
define i32 @get_salt_size() {
ret i32 32
}

LLVM IR (-O2):
define i32 @get_salt_size() {
ret i32 32
}
/* Variables and functions */
char tolower(char);
int hextodec(char c) {
  c = tolower(c);
  if ('0' <= c && c <= '9')
    return c - '0';
  return c - 'a' + 10;
}


x86 assembly (clang, -O0):
<hextodec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <tolower@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     1157 <hextodec+0x47>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1157 <hextodec+0x47>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1164 <hextodec+0x54>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hextodec>:
push   %rax
call   1030 <tolower@plt>
movsbl %al,%eax
lea    -0x30(%rax),%ecx
lea    -0x57(%rax),%edx
add    $0xffffffd0,%eax
cmp    $0xa,%cl
cmovae %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hextodec(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call signext i8 @tolower(i8 signext %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sle i32 48, %7
br i1 %8, label %9, label %17
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 57
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 48
store i32 %16, i32* %2
br label %22
17: ; preds = %9, %1
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 97
%21 = add nsw i32 %20, 10
store i32 %21, i32* %2
br label %22
22: ; preds = %17, %13
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @hextodec(i8 signext %0) {
%2 = tail call signext i8 @tolower(i8 signext %0)
%3 = sext i8 %2 to i32
%4 = add i8 %2, -48
%5 = icmp ult i8 %4, 10
%6 = select i1 %5, i32 -48, i32 -87
%7 = add nsw i32 %6, %3
ret i32 %7
}
void swap(int data[], int s, int t) {
  int tmp;
  tmp = data[s];
  data[s] = data[t];
  data[t] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage: motorola-bin [-device] [trxfile] [binfile]\n\n");
  printf("Known devices: 1 - WR850G | 2 - WA840G | 3 - WE800G\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Usage: motorola-bin [-device] [trxfile] [binfile]\0A\0A\00"
@.str.1 = [53 x i8] c"Known devices: 1 - WR850G | 2 - WA840G | 3 - WE800G\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [51 x i8] c"Usage: motorola-bin [-device] [trxfile] [binfile]\0A\00"
@str.2 = [52 x i8] c"Known devices: 1 - WR850G | 2 - WA840G | 3 - WE800G\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int console_handle_char(uint8_t byte) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @console_handle_char(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void main() {
  puts("Hi NetOS.git");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
jmp    1120 <main+0x10>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
nopl   (%rax)
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [13 x i8] c"Hi NetOS.git\00"
define void @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hi NetOS.git\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ system(char *);
int _Getch(void) {
  int ch;
  system("stty -echo -icanon min 1 time 0");
  ch = getchar();
  system("stty echo icanon");
  return ch;
}


x86 assembly (clang, -O0):
<_Getch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Getch>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
lea    0xee3(%rip),%rdi
call   1030 <system@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"stty -echo -icanon min 1 time 0\00"
@.str.1 = [17 x i8] c"stty echo icanon\00"
define i32 @_Getch() {
%1 = alloca i32
%2 = call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
%4 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@.str = [32 x i8] c"stty -echo -icanon min 1 time 0\00"
@.str.1 = [17 x i8] c"stty echo icanon\00"
define i32 @_Getch() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 %2
}
int converged(double old, double new) {
  double t;
  t = (old - new) / old;
  if (t < 0)
    t = -t;
  return t <= (1e-6);
}


x86 assembly (clang, -O0):
<converged>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1151 <converged+0x51>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xea7(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<converged>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
movapd 0xeec(%rip),%xmm0
xorpd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
movapd %xmm2,%xmm3
cmpltsd %xmm1,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm3
orpd   %xmm0,%xmm3
movsd  0xed7(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm3,%xmm0
setae  %al
ret

LLVM IR (-O0):
define i32 @converged(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fsub double %6, %7
%9 = load double, double* %3
%10 = fdiv double %8, %9
store double %10, double* %5
%11 = load double, double* %5
%12 = fcmp olt double %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load double, double* %5
%15 = fneg double %14
store double %15, double* %5
br label %16
16: ; preds = %13, %2
%17 = load double, double* %5
%18 = fcmp ole double %17, 0x3EB0C6F7A0B5ED8D
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @converged(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fdiv double %3, %0
%5 = fcmp olt double %4, 0.000000e+00
%6 = fneg double %4
%7 = select i1 %5, double %6, double %4
%8 = fcmp ole double %7, 0x3EB0C6F7A0B5ED8D
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
bool socket_ipv6_is_supported(void) {
  if (access("/proc/net/if_inet6", F_OK) != 0)
    return false;
  return true;
}


x86 assembly (clang, -O0):
<socket_ipv6_is_supported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
lea    0xed8(%rip),%rdi
call   1030 <access@plt>
cmp    $0x0,%rax
je     1143 <socket_ipv6_is_supported+0x33>
movl   $0x0,-0x4(%rbp)
jmp    114a <socket_ipv6_is_supported+0x3a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_ipv6_is_supported>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"/proc/net/if_inet6\00"
@F_OK = global i32 0
define i32 @socket_ipv6_is_supported() {
%1 = alloca i32
%2 = load i32, i32* @F_OK
%3 = call i64 @access(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %7
6: ; preds = %0
store i32 1, i32* %1
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [19 x i8] c"/proc/net/if_inet6\00"
@F_OK = global i32 0
define i32 @socket_ipv6_is_supported() {
%1 = load i32, i32* @F_OK
%2 = tail call i64 @access(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int _plat__NvCommit() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_plat__NvCommit() {
ret i32 0
}
/* Variables and functions */
int copro_mc6809nc_read(unsigned int);
unsigned read_stack16(unsigned addr) {
  return (copro_mc6809nc_read(addr) << 8) |
         copro_mc6809nc_read((addr + 1) & 0xffff);
}


x86 assembly (clang, -O0):
<read_stack16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <copro_mc6809nc_read@plt>
shl    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
and    $0xffff,%edi
call   1030 <copro_mc6809nc_read@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_stack16>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <copro_mc6809nc_read@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
add    $0x1,%ebx
movzwl %bx,%edi
call   1030 <copro_mc6809nc_read@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_stack16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @copro_mc6809nc_read(i32 %3)
%5 = shl i32 %4, 8
%6 = load i32, i32* %2
%7 = add i32 %6, 1
%8 = and i32 %7, 65535
%9 = call i32 @copro_mc6809nc_read(i32 %8)
%10 = or i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @read_stack16(i32 %0) {
%2 = tail call i32 @copro_mc6809nc_read(i32 %0)
%3 = shl i32 %2, 8
%4 = add i32 %0, 1
%5 = and i32 %4, 65535
%6 = tail call i32 @copro_mc6809nc_read(i32 %5)
%7 = or i32 %3, %6
ret i32 %7
}
int test_imm_BEint32_mem(int *val) {
  return ((*val) & (0xBE << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BEint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 190
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(unsigned long);
int /*<<< orphan*/ printf(char *, int, unsigned long);
__attribute__((__noreturn__)) void exitfunc4(int status, void *arg) {
  printf("Executing exitfunc"
         "4"
         " (status=%d, arg=%lu)\n",
         status, (unsigned long)arg);
  exit((unsigned long)arg);
}


x86 assembly (clang, -O0):
<exitfunc4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc4>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Executing exitfunc4 (status=%d, arg=%lu)\0A\00"
define void @exitfunc4(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 = ptrtoint i8* %6 to i64
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5, i64 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
%11 = call i32 @exit(i64 %10)
unreachable
}

LLVM IR (-O2):
@.str = [42 x i8] c"Executing exitfunc4 (status=%d, arg=%lu)\0A\00"
define void @exitfunc4(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0, i64 %3)
%5 = tail call i32 @exit(i64 %3)
unreachable
}