xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ getopt(int, char **, char *);
int8_t next_option(int argc, char **argv) {
  return getopt(argc, argv, "d:f:h");
}


x86 assembly (clang, -O0):
<next_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xed3(%rip),%rdx
call   1030 <getopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_option>:
lea    0xee9(%rip),%rdx
jmp    1030 <getopt@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"d:f:h\00"
define i32 @next_option(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
char *COM_SkipPath(char *pathname) {
  char *last;
  last = pathname;
  while (*pathname) {
    if (*pathname == '/')
      last = pathname + 1;
    pathname++;
  }
  return last;
}


x86 assembly (clang, -O0):
<COM_SkipPath>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114a <COM_SkipPath+0x4a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1139 <COM_SkipPath+0x39>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <COM_SkipPath+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<COM_SkipPath>:
mov    %rdi,%rax
lea    0x1(%rdi),%rcx
jmp    1117 <COM_SkipPath+0x17>
nopl   0x0(%rax)
mov    %rcx,%rax
add    $0x1,%rcx
movzbl -0x1(%rcx),%edx
cmp    $0x2f,%dl
je     1110 <COM_SkipPath+0x10>
test   %dl,%dl
jne    1113 <COM_SkipPath+0x13>
ret

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

LLVM IR (-O2):
define i8* @COM_SkipPath(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i8* [ %0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 47, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i8* %4
}
/* Variables and functions */
double exp(double);
double sloppy_exp(double x) {
  if ((x > 0 && x < 0.001) || (x < 0 && x > -0.001))
    return 1 + x;
  return exp(x);
}


x86 assembly (clang, -O0):
<sloppy_exp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1142 <sloppy_exp+0x32>
movsd  0xec9(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1167 <sloppy_exp+0x57>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    117e <sloppy_exp+0x6e>
movsd  -0x10(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117e <sloppy_exp+0x6e>
movsd  0xea1(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    118d <sloppy_exp+0x7d>
movsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sloppy_exp>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1128 <sloppy_exp+0x18>
movsd  0xede(%rip),%xmm2
ucomisd %xmm0,%xmm2
ja     1138 <sloppy_exp+0x28>
ucomisd %xmm0,%xmm1
jbe    1141 <sloppy_exp+0x31>
ucomisd 0xed2(%rip),%xmm0
jbe    1141 <sloppy_exp+0x31>
addsd  0xed0(%rip),%xmm0
ret
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @sloppy_exp(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = fcmp olt double %7, 1.000000e-03
br i1 %8, label %15, label %9
9: ; preds = %6, %1
%10 = load double, double* %3
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load double, double* %3
%14 = fcmp ogt double %13, -1.000000e-03
br i1 %14, label %15, label %18
15: ; preds = %12, %6
%16 = load double, double* %3
%17 = fadd double 1.000000e+00, %16
store double %17, double* %2
br label %21
18: ; preds = %12, %9
%19 = load double, double* %3
%20 = call double @exp(double %19)
store double %20, double* %2
br label %21
21: ; preds = %18, %15
%22 = load double, double* %2
ret double %22
}

LLVM IR (-O2):
define double @sloppy_exp(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = fcmp olt double %0, 1.000000e-03
%4 = and i1 %2, %3
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = fcmp olt double %0, 0.000000e+00
%7 = fcmp ogt double %0, -1.000000e-03
%8 = and i1 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5, %1
%10 = fadd double %0, 1.000000e+00
br label %13
11: ; preds = %5
%12 = tail call double @exp(double %0)
br label %13
13: ; preds = %11, %9
%14 = phi double [ %10, %9 ], [ %12, %11 ]
ret double %14
}
int str_isempty(const char *str) { return (str[0] == 0); }


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

x86 assembly (clang, -O2):
<str_isempty>:
xor    %eax,%eax
cmpb   $0x0,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @str_isempty(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @str_isempty(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
double log(double);
double ra_func(double Zt, double d0m, double z0m, double Psih, double ustar,
               double K) {
  double ra;
  ra = (log((Zt - d0m) * 7.0 / z0m) - Psih) / (ustar * K);
  return (ra);
}


x86 assembly (clang, -O0):
<ra_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
subsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ra_func>:
sub    $0x18,%rsp
movsd  %xmm5,0x10(%rsp)
movsd  %xmm4,0x8(%rsp)
movsd  %xmm3,(%rsp)
subsd  %xmm1,%xmm0
mulsd  0xecf(%rip),%xmm0
divsd  %xmm2,%xmm0
call   1030 <log@plt>
subsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @ra_func(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%14 = load double, double* %7
%15 = load double, double* %8
%16 = fsub double %14, %15
%17 = fmul double %16, 7.000000e+00
%18 = load double, double* %9
%19 = fdiv double %17, %18
%20 = call double @log(double %19)
%21 = load double, double* %10
%22 = fsub double %20, %21
%23 = load double, double* %11
%24 = load double, double* %12
%25 = fmul double %23, %24
%26 = fdiv double %22, %25
store double %26, double* %13
%27 = load double, double* %13
ret double %27
}

LLVM IR (-O2):
define double @ra_func(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double %0, %1
%8 = fmul double %7, 7.000000e+00
%9 = fdiv double %8, %2
%10 = tail call double @log(double %9)
%11 = fsub double %10, %3
%12 = fmul double %4, %5
%13 = fdiv double %11, %12
ret double %13
}
/* Variables and functions */
scalar_t__ rand();
float drnd() { return ((float)rand() / (float)0x7fffffff); }


x86 assembly (clang, -O0):
<drnd>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
movss  0xed8(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drnd>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mulss  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @drnd() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = fdiv float %2, 0x41E0000000000000
ret float %3
}

LLVM IR (-O2):
define float @drnd() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = fmul float %2, 0x3E00000000000000
ret float %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ kill_subprocess_status(int /*<<< orphan*/ const,
                                          int /*<<< orphan*/ *);
void kill_subprocess(const pid_t pid) { kill_subprocess_status(pid, NULL); }


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

x86 assembly (clang, -O2):
<kill_subprocess>:
xor    %esi,%esi
jmp    1030 <kill_subprocess_status@plt>

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

LLVM IR (-O2):
define void @kill_subprocess(i32 %0) {
%2 = tail call i32 @kill_subprocess_status(i32 %0, i32* null)
ret void
}
/* Variables and functions */
int board_get_revision();
int board_with_es8316(void) {
  return ((board_get_revision() == 0x1) || (board_get_revision() == 0x7) ||
          (board_get_revision() == 0x3));
}


x86 assembly (clang, -O0):
<board_with_es8316>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <board_get_revision@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x1(%rbp)
je     1156 <board_with_es8316+0x46>
mov    $0x0,%al
call   1030 <board_get_revision@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x7,%ecx
mov    %al,-0x1(%rbp)
je     1156 <board_with_es8316+0x46>
mov    $0x0,%al
call   1030 <board_get_revision@plt>
cmp    $0x3,%eax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_with_es8316>:
push   %rbx
xor    %eax,%eax
call   1030 <board_get_revision@plt>
mov    $0x1,%ebx
cmp    $0x1,%eax
je     113d <board_with_es8316+0x2d>
xor    %eax,%eax
call   1030 <board_get_revision@plt>
cmp    $0x7,%eax
je     113d <board_with_es8316+0x2d>
xor    %eax,%eax
call   1030 <board_get_revision@plt>
xor    %ebx,%ebx
cmp    $0x3,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @board_with_es8316() {
%1 = call i32 (...) @board_get_revision()
%2 = icmp eq i32 %1, 1
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = call i32 (...) @board_get_revision()
%5 = icmp eq i32 %4, 7
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = call i32 (...) @board_get_revision()
%8 = icmp eq i32 %7, 3
br label %9
9: ; preds = %6, %3, %0
%10 = phi i1 [ true, %3 ], [ true, %0 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @board_with_es8316() {
%1 = tail call i32 (...) @board_get_revision()
%2 = icmp eq i32 %1, 1
br i1 %2, label %10, label %3
3: ; preds = %0
%4 = tail call i32 (...) @board_get_revision()
%5 = icmp eq i32 %4, 7
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 (...) @board_get_revision()
%8 = icmp eq i32 %7, 3
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %0
%11 = phi i32 [ 1, %3 ], [ 1, %0 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void w_quick_sort_string_free(void *key) { free(key); }


x86 assembly (clang, -O0):
<w_quick_sort_string_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):
<w_quick_sort_string_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @w_quick_sort_string_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 @w_quick_sort_string_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ usleep(int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc == 2) {
    usleep(atoi(argv[1]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1154 <main+0x34>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jne    113a <main+0x1a>
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <atoi@plt>
mov    %eax,%edi
call   1040 <usleep@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
%13 = call i32 @usleep(i32 %12)
br label %14
14: ; preds = %8, %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = tail call i32 @usleep(i32 %7)
br label %9
9: ; preds = %4, %2
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void print_usage(char *name, uint8_t code) {
  printf("usage: %s program_name\n", name);
  exit(code);
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"usage: %s program_name\0A\00"
define void @print_usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"usage: %s program_name\0A\00"
define void @print_usage(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 %1)
unreachable
}
void av_log_once() {}


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

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

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

LLVM IR (-O2):
define void @av_log_once() {
ret void
}
/* Variables and functions */
int memcmp(void const *, void const *, int);
int binCollFunc(void *NotUsed, int nKey1, const void *pKey1, int nKey2,
                const void *pKey2) {
  int rc, n;
  n = nKey1 < nKey2 ? nKey1 : nKey2;
  rc = memcmp(pKey1, pKey2, n);
  if (rc == 0) {
    rc = nKey1 - nKey2;
  }
  return rc;
}


x86 assembly (clang, -O0):
<binCollFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1141 <binCollFunc+0x31>
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    1147 <binCollFunc+0x37>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%edx
call   1030 <memcmp@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1173 <binCollFunc+0x63>
mov    -0xc(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binCollFunc>:
push   %rbx
mov    %rdx,%rdi
mov    %esi,%ebx
sub    %ecx,%ebx
cmovl  %esi,%ecx
mov    %r8,%rsi
mov    %ecx,%edx
call   1030 <memcmp@plt>
test   %eax,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @binCollFunc(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%13 = load i32, i32* %7
%14 = load i32, i32* %9
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %5
%17 = load i32, i32* %7
br label %20
18: ; preds = %5
%19 = load i32, i32* %9
br label %20
20: ; preds = %18, %16
%21 = phi i32 [ %17, %16 ], [ %19, %18 ]
store i32 %21, i32* %12
%22 = load i8*, i8** %8
%23 = load i8*, i8** %10
%24 = load i32, i32* %12
%25 = call i32 @memcmp(i8* %22, i8* %23, i32 %24)
store i32 %25, i32* %11
%26 = load i32, i32* %11
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %20
%29 = load i32, i32* %7
%30 = load i32, i32* %9
%31 = sub nsw i32 %29, %30
store i32 %31, i32* %11
br label %32
32: ; preds = %28, %20
%33 = load i32, i32* %11
ret i32 %33
}

LLVM IR (-O2):
define i32 @binCollFunc(i8* nocapture readnone %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = icmp slt i32 %1, %3
%7 = select i1 %6, i32 %1, i32 %3
%8 = tail call i32 @memcmp(i8* %2, i8* %4, i32 %7)
%9 = icmp eq i32 %8, 0
%10 = sub nsw i32 %1, %3
%11 = select i1 %9, i32 %10, i32 %8
ret i32 %11
}
int sensor_remove(struct i2c_client *client) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.i2c_client = type opaque
define i32 @sensor_remove(%struct.i2c_client* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main() {
  int pid;
  switch (pid = fork()) {
  case 0:
    printf(" \n This is Child \n");
    exit(0);
    break;
  default:
    printf("\n In Parent .. Running for 60 seconds\n");
    sleep(60);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1060 <fork@plt>
mov    %eax,-0x8(%rbp)
test   %eax,%eax
jne    1179 <main+0x39>
jmp    1166 <main+0x26>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3c,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     1166 <main+0x26>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3c,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c" \0A This is Child \0A\00"
@.str.1 = [39 x i8] c"\0A In Parent .. Running for 60 seconds\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @fork()
store i32 %3, i32* %2
switch i32 %3, label %7 [
i32 0, label %4
]
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 0)
unreachable
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @sleep(i32 60)
br label %10
10: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@str = [38 x i8] c"\0A In Parent .. Running for 60 seconds\00"
@str.2 = [18 x i8] c" \0A This is Child \00"
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @sleep(i32 60)
ret i32 0
}
/* Variables and functions */
unsigned long mdc(unsigned long, unsigned long);
unsigned long mmc(unsigned long a, unsigned long b) {
  unsigned long r = a * b / mdc(a, b);
  return r;
}


x86 assembly (clang, -O0):
<mmc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <mdc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmc>:
push   %rbx
mov    %rsi,%rbx
imul   %rdi,%rbx
call   1030 <mdc@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1133 <mmc+0x23>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i64 @mmc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = mul i64 %6, %7
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = call i64 @mdc(i64 %9, i64 %10)
%12 = udiv i64 %8, %11
store i64 %12, i64* %5
%13 = load i64, i64* %5
ret i64 %13
}

LLVM IR (-O2):
define i64 @mmc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i64 @mdc(i64 %0, i64 %1)
%5 = udiv i64 %3, %4
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void ptyControlWrite(FILE *output, int control) {}


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

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

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

LLVM IR (-O2):
define void @ptyControlWrite(i32* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ c_fstr2hecmw_connect_conv(int, int *, int *, int *);
void FSTR2HECMW_CONNECT_CONV(int *n_elem, int elem_type[],
                             int elem_node_index[], int elem_node_item[]) {
  c_fstr2hecmw_connect_conv(*n_elem, elem_type, elem_node_index,
                            elem_node_item);
}


x86 assembly (clang, -O0):
<FSTR2HECMW_CONNECT_CONV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <c_fstr2hecmw_connect_conv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FSTR2HECMW_CONNECT_CONV>:
mov    (%rdi),%edi
jmp    1030 <c_fstr2hecmw_connect_conv@plt>

LLVM IR (-O0):
define void @FSTR2HECMW_CONNECT_CONV(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 = load i32, i32* %9
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = call i32 @c_fstr2hecmw_connect_conv(i32 %10, i32* %11, i32* %12, i32* %13)
ret void
}

LLVM IR (-O2):
define void @FSTR2HECMW_CONNECT_CONV(i32* nocapture %0, i32* %1, i32* %2, i32* %3) {
%5 = load i32, i32* %0
%6 = tail call i32 @c_fstr2hecmw_connect_conv(i32 %5, i32* %1, i32* %2, i32* %3)
ret void
}
long shalloced_replicas(long addr, long nth) {
  long inc;
  inc = 0x60000000000 / 3;
  inc = addr + inc * nth;
  return inc;
}


x86 assembly (clang, -O0):
<shalloced_replicas>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x20000000000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
imul   -0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shalloced_replicas>:
shl    $0x29,%rsi
lea    (%rsi,%rdi,1),%rax
ret

LLVM IR (-O0):
define i64 @shalloced_replicas(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
store i64 2199023255552, i64* %5
%6 = load i64, i64* %3
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = mul nsw i64 %7, %8
%10 = add nsw i64 %6, %9
store i64 %10, i64* %5
%11 = load i64, i64* %5
ret i64 %11
}

LLVM IR (-O2):
define i64 @shalloced_replicas(i64 %0, i64 %1) {
%3 = shl nsw i64 %1, 41
%4 = add nsw i64 %3, %0
ret i64 %4
}
short short_swap(unsigned short s) {
  return ((s & 0xFF00) >> 8) | ((s & 0xFF) << 8);
}


x86 assembly (clang, -O0):
<short_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
movzwl -0x2(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<short_swap>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define signext i16 @short_swap(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 65280
%6 = ashr i32 %5, 8
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = and i32 %8, 255
%10 = shl i32 %9, 8
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @short_swap(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ clog_write(int *, char *);
void CLOG_WRITE(int *clen, char *c) { clog_write(clen, c); }


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

x86 assembly (clang, -O2):
<CLOG_WRITE>:
jmp    1030 <clog_write@plt>

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

LLVM IR (-O2):
define void @CLOG_WRITE(i32* %0, i8* %1) {
%3 = tail call i32 @clog_write(i32* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printBanner() { printf("\n\n\rPROGRAMMA gira nel ring\n\n\r"); }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"\0A\0A\0DPROGRAMMA gira nel ring\0A\0A\0D\00"
define void @printBanner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"\0A\0A\0DPROGRAMMA gira nel ring\0A\0A\0D\00"
define void @printBanner() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned getRand(unsigned *state) {
  *state = (1103515245 * *state + 12345) % 0x7FFFFFFF;
  return *state;
}


x86 assembly (clang, -O0):
<getRand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x41c64e6d,(%rax),%eax
add    $0x3039,%eax
mov    $0x7fffffff,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x8(%rbp),%rax
mov    %edx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRand>:
imul   $0x41c64e6d,(%rdi),%eax
lea    0x3039(%rax),%ecx
lea    (%rcx,%rcx,2),%rdx
shr    $0x20,%rdx
sub    %edx,%ecx
shr    %ecx
add    %edx,%ecx
shr    $0x1e,%ecx
mov    %ecx,%edx
shl    $0x1f,%edx
sub    %edx,%ecx
add    %ecx,%eax
add    $0x3039,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @getRand(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = mul i32 1103515245, %4
%6 = add i32 %5, 12345
%7 = urem i32 %6, 2147483647
%8 = load i32*, i32** %2
store i32 %7, i32* %8
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @getRand(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul i32 %2, 1103515245
%4 = add i32 %3, 12345
%5 = urem i32 %4, 2147483647
store i32 %5, i32* %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("\n");
  printf(" Options\n");
  printf(" -s   Enable 6V power rail for servos.\n");
  printf(" -e   Disable 6V power rail for ESCs.\n");
  printf(" -h   Print this messege.\n\n");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
lea    0xf00(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [10 x i8] c" Options\0A\00"
@.str.2 = [40 x i8] c" -s Enable 6V power rail for servos.\0A\00"
@.str.3 = [39 x i8] c" -e Disable 6V power rail for ESCs.\0A\00"
@.str.4 = [28 x i8] c" -h Print this messege.\0A\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c" Options\00"
@str.5 = [39 x i8] c" -s Enable 6V power rail for servos.\00"
@str.6 = [38 x i8] c" -e Disable 6V power rail for ESCs.\00"
@str.7 = [27 x i8] c" -h Print this messege.\0A\00"
define void @print_usage() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.7, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ reverse_str(char *, int, int);
int strlen(char *);
void rotate(char *s, int n) {
  int len = strlen(s);
  reverse_str(s, 0, n - 1);
  reverse_str(s, n, len - 1);
  reverse_str(s, 0, len - 1);
}


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

x86 assembly (clang, -O2):
<rotate>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    -0x1(%r14),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <reverse_str@plt>
add    $0xffffffff,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <reverse_str@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <reverse_str@plt>

LLVM IR (-O0):
define void @rotate(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = call i32 @reverse_str(i8* %8, i32 0, i32 %10)
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = call i32 @reverse_str(i8* %12, i32 %13, i32 %15)
%17 = load i8*, i8** %3
%18 = load i32, i32* %5
%19 = sub nsw i32 %18, 1
%20 = call i32 @reverse_str(i8* %17, i32 0, i32 %19)
ret void
}

LLVM IR (-O2):
define void @rotate(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add nsw i32 %1, -1
%5 = tail call i32 @reverse_str(i8* %0, i32 0, i32 %4)
%6 = add nsw i32 %3, -1
%7 = tail call i32 @reverse_str(i8* %0, i32 %1, i32 %6)
%8 = tail call i32 @reverse_str(i8* %0, i32 0, i32 %6)
ret void
}
void UARTIntDisable(unsigned int baseAdd, unsigned int intFlags) {
  (*((volatile unsigned int *)(baseAdd + (0x4)))) &=
      ~(intFlags &
        ((0x00000008u) | (0x00000004u) | (0x00000002u) | (0x00000001u)));
}


x86 assembly (clang, -O0):
<UARTIntDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
and    $0xf,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTIntDisable>:
not    %esi
or     $0xfffffff0,%esi
add    $0x4,%edi
and    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @UARTIntDisable(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 = and i32 %5, 15
%7 = xor i32 %6, -1
%8 = load i32, i32* %3
%9 = add i32 %8, 4
%10 = zext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = and i32 %12, %7
store volatile i32 %13, i32* %11
ret void
}

LLVM IR (-O2):
define void @UARTIntDisable(i32 %0, i32 %1) {
%3 = and i32 %1, 15
%4 = xor i32 %3, -1
%5 = add i32 %0, 4
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, %4
store volatile i32 %9, i32* %7
ret void
}
/* Variables and functions */
int respond(int, int, char *);
int respond_ok(void) { return respond(200, 1, "OK."); }


x86 assembly (clang, -O0):
<respond_ok>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc8,%edi
mov    $0x1,%esi
lea    0xedb(%rip),%rdx
call   1030 <respond@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<respond_ok>:
lea    0xee9(%rip),%rdx
mov    $0xc8,%edi
mov    $0x1,%esi
jmp    1030 <respond@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"OK.\00"
define i32 @respond_ok() {
%1 = call i32 @respond(i32 200, i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [4 x i8] c"OK.\00"
define i32 @respond_ok() {
%1 = tail call i32 @respond(i32 200, i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ read_input();
int main(int argc, char const *argv[]) {
  read_input();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @read_input()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @read_input()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ add_to_buffer();
int /*<<< orphan*/ rtl_irq_handler();
int /*<<< orphan*/ tick();
void irq_handler(int irq_number) {
  switch (irq_number) {
  case 0x00:
    tick();
    break;
  case 0x01:
    add_to_buffer();
    break;
  case 0x0B:
    rtl_irq_handler();
    break;
  }
}


x86 assembly (clang, -O0):
<irq_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1170 <irq_handler+0x40>
jmp    114e <irq_handler+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     117c <irq_handler+0x4c>
jmp    115f <irq_handler+0x2f>
mov    -0x8(%rbp),%eax
sub    $0xb,%eax
je     1188 <irq_handler+0x58>
jmp    118f <irq_handler+0x5f>
mov    $0x0,%al
call   1030 <tick@plt>
jmp    118f <irq_handler+0x5f>
mov    $0x0,%al
call   1040 <add_to_buffer@plt>
jmp    118f <irq_handler+0x5f>
mov    $0x0,%al
call   1050 <rtl_irq_handler@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_handler>:
cmp    $0xb,%edi
je     1145 <irq_handler+0x15>
cmp    $0x1,%edi
je     114c <irq_handler+0x1c>
test   %edi,%edi
jne    1153 <irq_handler+0x23>
xor    %eax,%eax
jmp    1030 <tick@plt>
xor    %eax,%eax
jmp    1050 <rtl_irq_handler@plt>
xor    %eax,%eax
jmp    1040 <add_to_buffer@plt>
ret

LLVM IR (-O0):
define void @irq_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 0, label %4
i32 1, label %6
i32 11, label %8
]
4: ; preds = %1
%5 = call i32 (...) @tick()
br label %10
6: ; preds = %1
%7 = call i32 (...) @add_to_buffer()
br label %10
8: ; preds = %1
%9 = call i32 (...) @rtl_irq_handler()
br label %10
10: ; preds = %1, %8, %6, %4
ret void
}

LLVM IR (-O2):
define void @irq_handler(i32 %0) {
switch i32 %0, label %8 [
i32 0, label %2
i32 1, label %4
i32 11, label %6
]
2: ; preds = %1
%3 = tail call i32 (...) @tick()
br label %8
4: ; preds = %1
%5 = tail call i32 (...) @add_to_buffer()
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @rtl_irq_handler()
br label %8
8: ; preds = %1, %6, %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int array[], int size) {
  if (size != 0) {
    printf("%d", array[0]);
  } else {
    printf("\n");
    return;
  }
  printArray(array + 1, size - 1);
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1152 <printArray+0x32>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1165 <printArray+0x45>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1178 <printArray+0x58>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1040 <printArray@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printArray(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %19
14: ; preds = %7
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
br label %19
19: ; preds = %14, %12
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printArray(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ %1, %2 ]
%6 = phi i32* [ %9, %4 ], [ %0, %2 ]
%7 = load i32, i32* %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds i32, i32* %6, i64 1
%10 = add nsw i32 %5, -1
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const wchar_t;

/* Variables and functions */
int /*<<< orphan*/ wcscat(int /*<<< orphan*/ const *,
                          int /*<<< orphan*/ const *const);
void uninitvar_wcscat(wchar_t *dest, const wchar_t *const source) {
  wchar_t *deststr;
  wchar_t *srcstr;
  (void)wcscat(deststr, srcstr);
  (void)wcscat(dest, srcstr);
  (void)wcscat(deststr, source);
  (void)wcscat(dest, source);
}


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

x86 assembly (clang, -O2):
<uninitvar_wcscat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <wcscat@plt>
mov    %rbx,%rdi
call   1030 <wcscat@plt>
mov    %r14,%rsi
call   1030 <wcscat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <wcscat@plt>

LLVM IR (-O0):
define void @uninitvar_wcscat(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** %5
%8 = load i32*, i32** %6
%9 = call i32 @wcscat(i32* %7, i32* %8)
%10 = load i32*, i32** %3
%11 = load i32*, i32** %6
%12 = call i32 @wcscat(i32* %10, i32* %11)
%13 = load i32*, i32** %5
%14 = load i32*, i32** %4
%15 = call i32 @wcscat(i32* %13, i32* %14)
%16 = load i32*, i32** %3
%17 = load i32*, i32** %4
%18 = call i32 @wcscat(i32* %16, i32* %17)
ret void
}

LLVM IR (-O2):
define void @uninitvar_wcscat(i32* %0, i32* %1) {
%3 = tail call i32 @wcscat(i32* undef, i32* undef)
%4 = tail call i32 @wcscat(i32* %0, i32* undef)
%5 = tail call i32 @wcscat(i32* undef, i32* %1)
%6 = tail call i32 @wcscat(i32* %0, i32* %1)
ret void
}
void logging_Info(char *fct_name, char *text) {}


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

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

LLVM IR (-O0):
define void @logging_Info(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @logging_Info(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void __attribute__((constructor)) initialize1() {
  printf(__func__);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<initialize1>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@__func__.initialize1 = [12 x i8] c"initialize1\00"
@.str = [2 x i8] c"\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @initialize1, i8* null }]
define void @initialize1() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.initialize1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.initialize1 = [12 x i8] c"initialize1\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @initialize1, i8* null }]
define void @initialize1() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.initialize1, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret void
}
unsigned int ulog2(x)
unsigned long int x;
{
  unsigned int i;
  for (i = 0; x != 0; i++)
    x >>= 1;
  return i;
}


x86 assembly (clang, -O0):
<ulog2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1134 <ulog2+0x34>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ulog2+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulog2>:
xor    %eax,%eax
test   %rdi,%rdi
je     111f <ulog2+0x1f>
mov    %rdi,%rcx
nopw   0x0(%rax,%rax,1)
shr    %rcx
add    $0x1,%eax
cmp    $0x1,%rdi
mov    %rcx,%rdi
ja     1110 <ulog2+0x10>
ret

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

LLVM IR (-O2):
define i32 @ulog2(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i64 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i64 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}