xunge/DecIR huggingface dataset:
int kstrcmp(const char *str1, const char *str2) {
  while (*str1 && (*str1 == *str2)) {
    str1++;
    str2++;
  }
  return *(const unsigned char *)str1 - *(const unsigned char *)str2;
}


x86 assembly (clang, -O0):
<kstrcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1137 <kstrcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <kstrcmp+0x47>
jmp    1164 <kstrcmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <kstrcmp+0xc>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kstrcmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <kstrcmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    1125 <kstrcmp+0x25>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <kstrcmp+0x10>
xor    %eax,%eax
movzbl %al,%eax
movzbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @kstrcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %20, %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 %18
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 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %13, %16
br label %18
18: ; preds = %10, %5
%19 = phi i1 [ false, %5 ], [ %17, %10 ]
br i1 %19, label %20, label %25
20: ; preds = %18
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
br label %5
25: ; preds = %18
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = sub nsw i32 %28, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @kstrcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ], [ %7, %5 ]
%18 = phi i8 [ 0, %2 ], [ 0, %11 ], [ %6, %5 ]
%19 = zext i8 %18 to i32
%20 = load i8, i8* %17
%21 = zext i8 %20 to i32
%22 = sub nsw i32 %19, %21
ret i32 %22
}
int do_749() { return 749; }


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

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

LLVM IR (-O0):
define i32 @do_749() {
ret i32 749
}

LLVM IR (-O2):
define i32 @do_749() {
ret i32 749
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "Usage: sonic [OPTION]... infile outfile\n"
      "    -c         -- Modify pitch by emulating vocal chords vibrating\n"
      "                  faster or slower.\n"
      "    -p pitch   -- Set pitch scaling factor.  1.3 means 30%% higher.\n"
      "    -q         -- Disable speed-up heuristics.  May increase quality.\n"
      "    -r rate    -- Set playback rate.  2.0 means 2X faster, and 2X "
      "pitch.\n"
      "    -s speed   -- Set speed up factor.  2.0 means 2X faster.\n"
      "    -v volume  -- Scale volume by a constant factor.\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [469 x i8] c"Usage: sonic [OPTION]... infile outfile\0A -c -- Modify pitch by emulating vocal chords vibrating\0A faster or slower.\0A -p pitch -- Set pitch scaling factor. 1.3 means 30%% higher.\0A -q -- Disable speed-up heuristics. May increase quality.\0A -r rate -- Set playback rate. 2.0 means 2X faster, and 2X pitch.\0A -s speed -- Set speed up factor. 2.0 means 2X faster.\0A -v volume -- Scale volume by a constant factor.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([469 x i8], [469 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [469 x i8] c"Usage: sonic [OPTION]... infile outfile\0A -c -- Modify pitch by emulating vocal chords vibrating\0A faster or slower.\0A -p pitch -- Set pitch scaling factor. 1.3 means 30%% higher.\0A -q -- Disable speed-up heuristics. May increase quality.\0A -r rate -- Set playback rate. 2.0 means 2X faster, and 2X pitch.\0A -s speed -- Set speed up factor. 2.0 means 2X faster.\0A -v volume -- Scale volume by a constant factor.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([469 x i8], [469 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ countingNumberofOnesIn1toN_test();
int main(int argc, char **argv) {
  countingNumberofOnesIn1toN_test();
  return (EXIT_SUCCESS);
}


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

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

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
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 (...) @countingNumberofOnesIn1toN_test()
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @countingNumberofOnesIn1toN_test()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(void *);
void thrd_exit(int res) { pthread_exit((void *)(long)res); }


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

x86 assembly (clang, -O2):
<thrd_exit>:
movslq %edi,%rdi
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define void @thrd_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = call i32 @pthread_exit(i8* %5)
ret void
}

LLVM IR (-O2):
define void @thrd_exit(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @pthread_exit(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ system(char *);
void handover() {
  char enter;
  system("cls");
  fflush(stdin);
  printf("Its other player's turn now!\nPlease, hanodover the device to the "
         "next player and then press Enter.\n");
  scanf("%c", &enter);
}


x86 assembly (clang, -O0):
<handover>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <system@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1060 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handover>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <system@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1060 <scanf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@stdin = global i32 0
@.str.1 = [100 x i8] c"Its other player's turn now!\0APlease, hanodover the device to the next player and then press Enter.\0A\00"
@.str.2 = [3 x i8] c"%c\00"
define void @handover() {
%1 = alloca i8
%2 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdin
%4 = call i32 @fflush(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@stdin = global i32 0
@.str.2 = [3 x i8] c"%c\00"
@str = [99 x i8] c"Its other player's turn now!\0APlease, hanodover the device to the next player and then press Enter.\00"
define void @handover() {
%1 = alloca i8
%2 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdin
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
ret void
}
float radians_degrees(float degrees) { return degrees * 180 / 3.14; }


x86 assembly (clang, -O0):
<radians_degrees>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xede(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<radians_degrees>:
mulss  0xef8(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @radians_degrees(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 1.800000e+02
%5 = fpext float %4 to double
%6 = fdiv double %5, 3.140000e+00
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @radians_degrees(float %0) {
%2 = fmul float %0, 1.800000e+02
%3 = fpext float %2 to double
%4 = fdiv double %3, 3.140000e+00
%5 = fptrunc double %4 to float
ret float %5
}
intsize() { return (4); }


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

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

LLVM IR (-O0):
define i32 @intsize() {
ret i32 4
}

LLVM IR (-O2):
define i32 @intsize() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void *malloc(int);
void *ccmalloc(int size) {
  void *rv;
  if ((rv = malloc(size)) == NULL)
    error("malloc failed");
  return rv;
}


x86 assembly (clang, -O0):
<ccmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114d <ccmalloc+0x2d>
lea    0xeb8(%rip),%rdi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <ccmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"malloc failed\00"
define i8* @ccmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [14 x i8] c"malloc failed\00"
define noalias i8* @ccmalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ japi_multiplemode(int, int);
void j_multiplemode(int arg0, int arg1) { japi_multiplemode(arg0, arg1); }


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

x86 assembly (clang, -O2):
<j_multiplemode>:
jmp    1030 <japi_multiplemode@plt>

LLVM IR (-O0):
define void @j_multiplemode(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 @japi_multiplemode(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @j_multiplemode(i32 %0, i32 %1) {
%3 = tail call i32 @japi_multiplemode(i32 %0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, size_t, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_time_string(char *buffer, size_t buffer_length) {
  time_t now = time(NULL);
  struct tm *t = localtime(&now);
  strftime(buffer, buffer_length, "%m/%d/%Y %r", t);
}


x86 assembly (clang, -O0):
<get_time_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
lea    0xe94(%rip),%rdx
call   1050 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xeaa(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rcx
call   1050 <strftime@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [12 x i8] c"%m/%d/%Y %r\00"
define void @get_time_string(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca %struct.tm*
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = call i32 @time(i32* null)
store i32 %7, i32* %5
%8 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %8, %struct.tm** %6
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = load %struct.tm*, %struct.tm** %6
%12 = call i32 @strftime(i8* %9, i64 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [12 x i8] c"%m/%d/%Y %r\00"
define void @get_time_string(i8* %0, i64 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
%7 = call i32 @strftime(i8* %0, i64 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ai_rand_free(void *context) { free(context); }


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

x86 assembly (clang, -O2):
<ai_rand_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @ai_rand_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int func_1();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int a;
  a = func_1();
  printf("Answer: %d\n", a);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Answer: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func_1()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ rbx;

/* Variables and functions */
int /*<<< orphan*/ cpuid(int, int *, int *, int *, int *);
int cpuid_pkg_MaxLogicalProcessors(void) {
  uint64_t rax, rbx, rcx, rdx;
  int leaf = 1;
  cpuid(leaf, &rax, &rbx, &rcx, &rdx);
  return (((uint64_t)(rbx) &
           ((((uint64_t)1 << (((23)) - ((16)) + 1)) - 1) << ((16)))) >>
          (16));
}


x86 assembly (clang, -O0):
<cpuid_pkg_MaxLogicalProcessors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x8(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_pkg_MaxLogicalProcessors>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0x1,%edi
call   1030 <cpuid@plt>
movzbl 0xa(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cpuid_pkg_MaxLogicalProcessors() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 1, i32* %5
%6 = load i32, i32* %5
%7 = call i32 @cpuid(i32 %6, i32* %1, i32* %2, i32* %3, i32* %4)
%8 = load i32, i32* %2
%9 = and i32 %8, 16711680
%10 = ashr i32 %9, 16
ret i32 %10
}

LLVM IR (-O2):
define i32 @cpuid_pkg_MaxLogicalProcessors() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %2
%11 = lshr i32 %10, 16
%12 = and i32 %11, 255
ret i32 %12
}
int _getpid(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_getpid() {
ret i32 0
}
void limit_procs(const int procs) { (void)procs; }


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

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

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

LLVM IR (-O2):
define void @limit_procs(i32 %0) {
ret void
}
unsigned char color_lsb(unsigned char *color_sample) {
  return (*color_sample & 0x1) == 0x1;
}


x86 assembly (clang, -O0):
<color_lsb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
and    $0x1,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @color_lsb(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 1
ret i8 %3
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *my_basename(const char *path) {
  const char *p;
  if (path == NULL)
    return NULL;
  p = strrchr(path, '/');
  if (p != NULL)
    return p + 1;
  else
    return path;
}


x86 assembly (clang, -O0):
<my_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <my_basename+0x24>
movq   $0x0,-0x8(%rbp)
jmp    116a <my_basename+0x5a>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1162 <my_basename+0x52>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    116a <my_basename+0x5a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_basename>:
test   %rdi,%rdi
je     1133 <my_basename+0x23>
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,%rcx
add    $0x1,%rax
test   %rcx,%rcx
cmove  %rbx,%rax
pop    %rbx
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @my_basename(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i8* @strrchr(i8* %0, i8 signext 47)
%5 = icmp eq i8* %4, null
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = select i1 %5, i8* %0, i8* %6
br label %8
8: ; preds = %3, %1
%9 = phi i8* [ null, %1 ], [ %7, %3 ]
ret i8* %9
}
/* Variables and functions */
char *gu_str_next(char const *);
const char *gu_str_advance(const char *str, size_t n) {
  const char *ptr = str;
  while (n-- > 0) {
    ptr = gu_str_next(ptr);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<gu_str_advance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
jbe    1153 <gu_str_advance+0x43>
mov    -0x18(%rbp),%rdi
call   1030 <gu_str_next@plt>
mov    %rax,-0x18(%rbp)
jmp    1128 <gu_str_advance+0x18>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gu_str_advance>:
push   %rbx
mov    %rdi,%rax
test   %rsi,%rsi
je     112e <gu_str_advance+0x1e>
mov    %rsi,%rbx
nopl   0x0(%rax)
mov    %rax,%rdi
call   1030 <gu_str_next@plt>
add    $0xffffffffffffffff,%rbx
jne    1120 <gu_str_advance+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @gu_str_advance(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %8, %4 ], [ %0, %2 ]
%6 = phi i64 [ %7, %4 ], [ %1, %2 ]
%7 = add i64 %6, -1
%8 = tail call i8* @gu_str_next(i8* %5)
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %4
10: ; preds = %4, %2
%11 = phi i8* [ %0, %2 ], [ %8, %4 ]
ret i8* %11
}
void bn_sub_words(void) {}


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

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

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

LLVM IR (-O2):
define void @bn_sub_words() {
ret void
}
int parse_decimal(char ch) {
  if ('0' > ch)
    return -1;
  if ('9' >= ch)
    return ch - '0';
  return -1;
}


x86 assembly (clang, -O0):
<parse_decimal>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jle    1127 <parse_decimal+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <parse_decimal+0x4e>
movsbl -0x5(%rbp),%ecx
mov    $0x39,%eax
cmp    %ecx,%eax
jl     1147 <parse_decimal+0x47>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    114e <parse_decimal+0x4e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_decimal>:
lea    -0x30(%rdi),%eax
lea    -0x30(%rdi),%ecx
cmp    $0xa,%al
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @parse_decimal(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sgt i32 48, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %17
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp sge i32 57, %10
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 48
store i32 %15, i32* %2
br label %17
16: ; preds = %8
store i32 -1, i32* %2
br label %17
17: ; preds = %16, %12, %7
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @parse_decimal(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -48
%4 = icmp ult i8 %3, 10
%5 = add nsw i32 %2, -48
%6 = select i1 %4, i32 %5, i32 -1
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
int open_file(FILE **fp, char *fname, char *mode, int line, char *file) {
  if ((*fp = fopen(fname, mode)) == NULL) {
    fprintf(stderr, "[%s:%d] open_file() failed\n", file, line);
  }
  return (0);
}


x86 assembly (clang, -O0):
<open_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fopen@plt>
mov    -0x8(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1175 <open_file+0x55>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_file>:
push   %rbp
push   %r14
push   %rbx
mov    %r8,%r14
mov    %ecx,%ebp
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <fopen@plt>
mov    %rax,(%rbx)
test   %rax,%rax
jne    1159 <open_file+0x39>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
mov    %r14,%rdx
mov    %ebp,%ecx
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"[%s:%d] open_file() failed\0A\00"
define i32 @open_file(i32** nocapture writeonly %0, i8* nocapture %1, i8* nocapture %2, i32 %3, i8* %4) {
%6 = tail call i32* @fopen(i8* %1, i8* %2)
store i32* %6, i32** %0
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %3)
br label %11
11: ; preds = %8, %5
ret i32 0
}
void throw(void) { asm("int $66"); }


x86 assembly (clang, -O0):
<throw>:
push   %rbp
mov    %rsp,%rbp
int    $0x42
pop    %rbp
ret

x86 assembly (clang, -O2):
<throw>:
int    $0x42
ret

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

LLVM IR (-O2):
define void @throw() {
tail call void asm sideeffect "int $$66", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ SHA256_CTX;

/* Variables and functions */
int /*<<< orphan*/ SHA256_Final(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ SHA256_Init(int /*<<< orphan*/ *);
int /*<<< orphan*/ SHA256_Update(int /*<<< orphan*/ *, void const *, int);
void hash(const void *buf, int n, void *outbuf) {
  SHA256_CTX c;
  SHA256_Init(&c);
  SHA256_Update(&c, buf, n);
  SHA256_Final(outbuf, &c);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
call   1030 <SHA256_Init@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    -0x1c(%rbp),%rdi
call   1050 <SHA256_Update@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <SHA256_Final@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x4(%rsp),%r15
mov    %r15,%rdi
call   1030 <SHA256_Init@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <SHA256_Update@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <SHA256_Final@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @hash(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = call i32 @SHA256_Init(i32* %7)
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @SHA256_Update(i32* %7, i8* %9, i32 %10)
%12 = load i8*, i8** %6
%13 = call i32 @SHA256_Final(i8* %12, i32* %7)
ret void
}

LLVM IR (-O2):
define void @hash(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @SHA256_Init(i32* %4)
%7 = call i32 @SHA256_Update(i32* %4, i8* %0, i32 %1)
%8 = call i32 @SHA256_Final(i8* %2, i32* %4)
ret void
}
/* Type definitions */
struct tokenizer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct tokenizer *);
void tk_free_tokenizer(struct tokenizer *state) { free(state); }


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

x86 assembly (clang, -O2):
<tk_free_tokenizer>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.tokenizer = type { i32 }
define void @tk_free_tokenizer(%struct.tokenizer* nocapture %0) {
%2 = tail call i32 @free(%struct.tokenizer* %0)
ret void
}
/* Variables and functions */
scalar_t__ geteuid();
scalar_t__ getuid();
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  printf("uid = %d, euid = %d\n", (int)getuid(), (int)geteuid());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <geteuid@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <geteuid@plt>
lea    0xeb7(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"uid = %d, euid = %d\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @getuid()
%2 = trunc i64 %1 to i32
%3 = tail call i64 (...) @geteuid()
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ tss_t;

/* Variables and functions */
void *kthread_getspecific(int /*<<< orphan*/);
void *tss_get(tss_t key) { return kthread_getspecific(key); }


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

x86 assembly (clang, -O2):
<tss_get>:
jmp    1030 <kthread_getspecific@plt>

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

LLVM IR (-O2):
define i8* @tss_get(i32 %0) {
%2 = tail call i8* @kthread_getspecific(i32 %0)
ret i8* %2
}
float mus_char_to_lfloat(const unsigned char *inp) {
  float o;
  unsigned char *outp;
  outp = (unsigned char *)&o;
  outp[0] = inp[3];
  outp[1] = inp[2];
  outp[2] = inp[1];
  outp[3] = inp[0];
  return (o);
}


x86 assembly (clang, -O0):
<mus_char_to_lfloat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_char_to_lfloat>:
mov    (%rdi),%eax
bswap  %eax
movd   %eax,%xmm0
ret

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

LLVM IR (-O2):
define float @mus_char_to_lfloat(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 16
%14 = or i32 %9, %13
%15 = load i8, i8* %0
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %14, %17
%19 = bitcast i32 %18 to float
ret float %19
}
/* Type definitions */
typedef int uint_least16_t;
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t determine_system_endianness(void) {
  union {
    uint_least16_t value;
    uint8_t result;
  } endian_test;
  endian_test.value = 1;
  return endian_test.result;
}


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

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

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

LLVM IR (-O2):
define i32 @determine_system_endianness() {
ret i32 1
}
/* Variables and functions */
scalar_t__ sbrk(int /*<<< orphan*/);
int main(void) {
  int *i = (int *)sbrk(0);
  return *i;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @sbrk(i32 0)
%2 = inttoptr i64 %1 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
int main(int argc, char **argv) {
  long double x = 1.48734 + (long double)argc;
  return (int)__builtin_fabsl(x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
fildl  -0x28(%rbp)
fldl   0xedf(%rip)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fabs
fnstcw -0x2a(%rbp)
movzwl -0x2a(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x2c(%rbp)
fldcw  -0x2c(%rbp)
fistpl -0x24(%rbp)
fldcw  -0x2a(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    %edi,-0x8(%rsp)
fildl  -0x8(%rsp)
faddl  0xef2(%rip)
fabs
fnstcw -0xc(%rsp)
movzwl -0xc(%rsp),%eax
or     $0xc00,%eax
mov    %ax,-0xa(%rsp)
fldcw  -0xa(%rsp)
fistpl -0x4(%rsp)
fldcw  -0xc(%rsp)
mov    -0x4(%rsp),%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca x86_fp80
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to x86_fp80
%9 = fadd x86_fp80 0xK3FFFBE612839042D9000, %8
store x86_fp80 %9, x86_fp80* %6
%10 = load x86_fp80, x86_fp80* %6
%11 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %10)
%12 = fptosi x86_fp80 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = sitofp i32 %0 to x86_fp80
%4 = fadd x86_fp80 %3, 0xK3FFFBE612839042D9000
%5 = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %4)
%6 = fptosi x86_fp80 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ sys_lock();
int /*<<< orphan*/ sys_unlock();
extern void pd_term_systems(void) {
  sys_lock();
  sys_unlock();
}


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

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

LLVM IR (-O0):
define void @pd_term_systems() {
%1 = call i32 (...) @sys_lock()
%2 = call i32 (...) @sys_unlock()
ret void
}

LLVM IR (-O2):
define void @pd_term_systems() {
%1 = tail call i32 (...) @sys_lock()
%2 = tail call i32 (...) @sys_unlock()
ret void
}
double hypot3_sqr(double x, double y, double z) {
  return x * x + y * y + z * z;
}


x86 assembly (clang, -O0):
<hypot3_sqr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypot3_sqr>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @hypot3_sqr(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* %4
%9 = load double, double* %5
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = call double @llvm.fmuladd.f64(double %7, double %8, double %11)
%13 = load double, double* %6
%14 = load double, double* %6
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double %12)
ret double %15
}

LLVM IR (-O2):
define double @hypot3_sqr(double %0, double %1, double %2) {
%4 = fmul double %1, %1
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %4)
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void main() {
  int V1 = 4, V2 = 3;
  int V3 = (V1, V2);
  printf("%d\n", V3);
}


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

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x3,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret void
}
unsigned idx_right(unsigned idx) { return 2 * idx + 2; }


x86 assembly (clang, -O0):
<idx_right>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<idx_right>:
lea    (%rdi,%rdi,1),%eax
add    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @idx_right(i32 %0) {
%2 = shl i32 %0, 1
%3 = add i32 %2, 2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *);
int /*<<< orphan*/ panic();
void print_error() {
  kprintf("OH SHIT I/O Error!\nPanicing\n");
  panic();
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <kprintf@plt>
mov    $0x0,%al
call   1030 <panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <kprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <panic@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"OH SHIT I/O Error!\0APanicing\0A\00"
define void @print_error() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @panic()
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"OH SHIT I/O Error!\0APanicing\0A\00"
define void @print_error() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @panic()
ret void
}
void SetBit(int A[], int k) { A[k / 32] |= 1 << (k % 32); }


x86 assembly (clang, -O0):
<SetBit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetBit>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
lea    0x1f(%rcx),%edx
test   %esi,%esi
cmovns %ecx,%edx
sar    $0x5,%edx
movslq %edx,%rcx
or     %eax,(%rdi,%rcx,4)
ret

LLVM IR (-O0):
define void @SetBit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = srem i32 %5, 32
%7 = shl i32 1, %6
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 32
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %8, i64 %11
%13 = load i32, i32* %12
%14 = or i32 %13, %7
store i32 %14, i32* %12
ret void
}

LLVM IR (-O2):
define void @SetBit(i32* nocapture %0, i32 %1) {
%3 = and i32 %1, 31
%4 = shl nuw i32 1, %3
%5 = sdiv i32 %1, 32
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = or i32 %8, %4
store i32 %9, i32* %7
ret void
}
char *base64_encode(char *str, int size) { return str; }


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

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

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

LLVM IR (-O2):
define i8* @base64_encode(i8* readnone returned %0, i32 %1) {
ret i8* %0
}