xunge/DecIR huggingface dataset:
/* Variables and functions */
char *string_copy(char *);
char *copy_string1(char *s) { return string_copy(s); }


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

x86 assembly (clang, -O2):
<copy_string1>:
jmp    1030 <string_copy@plt>

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

LLVM IR (-O2):
define i8* @copy_string1(i8* %0) {
%2 = tail call i8* @string_copy(i8* %0)
ret i8* %2
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int number_of_standard_factors(int *nf) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(68, nf, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<number_of_standard_factors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x44,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_of_standard_factors>:
mov    %rdi,%rsi
mov    $0x44,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @number_of_standard_factors(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32* %0, i32** %2
%6 = load i32*, i32** %2
%7 = load i32*, i32** %3
%8 = load double*, double** %5
%9 = call i32 @_ada_use_c2phc4c(i32 68, i32* %6, i32* %7, double* %8, i32 0)
store i32 %9, i32* %4
%10 = load i32, i32* %4
ret i32 %10
}

LLVM IR (-O2):
define i32 @number_of_standard_factors(i32* %0) {
%2 = tail call i32 @_ada_use_c2phc4c(i32 68, i32* %0, i32* undef, double* undef, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Lcd_Draw_Hline(int, int, int, int);
int /*<<< orphan*/ Lcd_Draw_Vine(int, int, int, int);
void Lcd_Draw_Cross(int row, int col, int halflen, int color) {
  Lcd_Draw_Hline(row, col - halflen, col + halflen, color);
  Lcd_Draw_Vine(col, row - halflen, row + halflen, color);
}


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

x86 assembly (clang, -O2):
<Lcd_Draw_Cross>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%r15d
mov    %edi,%ebp
sub    %edx,%esi
lea    (%rbx,%r15,1),%edx
call   1030 <Lcd_Draw_Hline@plt>
mov    %ebp,%esi
sub    %ebx,%esi
add    %ebp,%ebx
mov    %r15d,%edi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <Lcd_Draw_Vine@plt>

LLVM IR (-O0):
define void @Lcd_Draw_Cross(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* %6
%11 = load i32, i32* %7
%12 = sub nsw i32 %10, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = add nsw i32 %13, %14
%16 = load i32, i32* %8
%17 = call i32 @Lcd_Draw_Hline(i32 %9, i32 %12, i32 %15, i32 %16)
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = sub nsw i32 %19, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = add nsw i32 %22, %23
%25 = load i32, i32* %8
%26 = call i32 @Lcd_Draw_Vine(i32 %18, i32 %21, i32 %24, i32 %25)
ret void
}

LLVM IR (-O2):
define void @Lcd_Draw_Cross(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %1, %2
%6 = add nsw i32 %2, %1
%7 = tail call i32 @Lcd_Draw_Hline(i32 %0, i32 %5, i32 %6, i32 %3)
%8 = sub nsw i32 %0, %2
%9 = add nsw i32 %2, %0
%10 = tail call i32 @Lcd_Draw_Vine(i32 %1, i32 %8, i32 %9, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_extern_num() {
  extern int i;
  printf("%d ", i);
}


x86 assembly (clang, -O0):
<print_extern_num>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_extern_num>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@i = external global i32
define void @print_extern_num() {
%1 = load i32, i32* @i
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@i = external global i32
define void @print_extern_num() {
%1 = load i32, i32* @i
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
void ft_striter(char *s, void (*f)(char *)) {
  int i;
  i = 0;
  while (s[i]) {
    f(&s[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_striter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1148 <ft_striter+0x48>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rcx
add    %rcx,%rdi
call   *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <ft_striter+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striter>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     1120 <ft_striter+0x20>
mov    %rsi,%r14
mov    %rdi,%rbx
nop
mov    %rbx,%rdi
call   *%r14
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1110 <ft_striter+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @ft_striter(i8* %0, void (i8*)* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %8, %5 ], [ 0, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
tail call void %1(i8* %7)
%8 = add nuw i64 %6, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
ret void
}
double heading_true_degrees(double lat1, double lon1, double lat2,
                            double lon2) {
  double h = 360.0 - ((heading(lat1, lon1, lat2, lon2)) * 180.0 /
                      3.14159265358979323846);
  if (h >= 360.0)
    h -= 360.0;
  return h;
}


x86 assembly (clang, -O0):
<heading_true_degrees>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
mov    $0x4,%al
call   1030 <heading@plt>
cvtsi2sd %eax,%xmm1
movsd  0xebd(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xea9(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe95(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe7f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11a1 <heading_true_degrees+0x91>
movsd  -0x28(%rbp),%xmm0
movsd  0xe68(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heading_true_degrees>:
push   %rax
mov    $0x4,%al
call   1030 <heading@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xed9(%rip),%xmm1
divsd  0xed9(%rip),%xmm1
movsd  0xed9(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xed5(%rip),%xmm2
addsd  %xmm1,%xmm2
cmpnlesd %xmm1,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @heading_true_degrees(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %5
%11 = load double, double* %6
%12 = load double, double* %7
%13 = load double, double* %8
%14 = call i32 (double, double, double, double, ...) bitcast (i32 (...)* @heading to i32 (double, double, double, double, ...)*)(double %10, double %11, double %12, double %13)
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 1.800000e+02
%17 = fdiv double %16, 0x400921FB54442D18
%18 = fsub double 3.600000e+02, %17
store double %18, double* %9
%19 = load double, double* %9
%20 = fcmp oge double %19, 3.600000e+02
br i1 %20, label %21, label %24
21: ; preds = %4
%22 = load double, double* %9
%23 = fsub double %22, 3.600000e+02
store double %23, double* %9
br label %24
24: ; preds = %21, %4
%25 = load double, double* %9
ret double %25
}

LLVM IR (-O2):
define double @heading_true_degrees(double %0, double %1, double %2, double %3) {
%5 = tail call i32 (double, double, double, double, ...) bitcast (i32 (...)* @heading to i32 (double, double, double, double, ...)*)(double %0, double %1, double %2, double %3)
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 1.800000e+02
%8 = fdiv double %7, 0x400921FB54442D18
%9 = fsub double 3.600000e+02, %8
%10 = fcmp ult double %9, 3.600000e+02
%11 = fadd double %9, -3.600000e+02
%12 = select i1 %10, double %9, double %11
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *readString();
double strtod(char *, int /*<<< orphan*/ *);
double readReal() {
  char *s = readString();
  double val = strtod(s, NULL);
  free(s);
  return val;
}


x86 assembly (clang, -O0):
<readReal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <readString@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <strtod@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readReal>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <readString@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @readReal() {
%1 = alloca i8*
%2 = alloca double
%3 = call i8* (...) @readString()
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call double @strtod(i8* %4, i32* null)
store double %5, double* %2
%6 = load i8*, i8** %1
%7 = call i32 @free(i8* %6)
%8 = load double, double* %2
ret double %8
}

LLVM IR (-O2):
define double @readReal() {
%1 = tail call i8* (...) @readString()
%2 = tail call double @strtod(i8* nocapture %1, i32* null)
%3 = tail call i32 @free(i8* %1)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x5a() {
  Assert_real((isodigit(90) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              455, ("isodigit should be 0 for Z"));
}


x86 assembly (clang, -O0):
<t_isodigit_0x5a>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5a,%edi
call   1040 <isodigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x1c7,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isodigit_0x5a>:
push   %rax
mov    $0x5a,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x1c7,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [27 x i8] c"isodigit should be 0 for Z\00"
define void @t_isodigit_0x5a() {
%1 = call i64 @isodigit(i32 90)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 455, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [27 x i8] c"isodigit should be 0 for Z\00"
define void @t_isodigit_0x5a() {
%1 = tail call i64 @isodigit(i32 90)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 455, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
long min(long a, long b) { return (a < b) ? a : b; }


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

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

LLVM IR (-O0):
define i64 @min(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @min(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
extern int cpufreq_thermal_limit(int cluster, int limit_freq) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cpufreq_thermal_limit(i32 %0, i32 %1) {
ret i32 0
}
int alloca_size(void) { return 8; }


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

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

LLVM IR (-O0):
define i32 @alloca_size() {
ret i32 8
}

LLVM IR (-O2):
define i32 @alloca_size() {
ret i32 8
}
void av_frame_free() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *, int);
scalar_t__ strlen(char *);
void on_line_read(char *line, void *payload) {
  printf("line: '%s' %d\n", line, (int)strlen(line));
  free(line);
}


x86 assembly (clang, -O0):
<on_line_read>:
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    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xea2(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_line_read>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0xec0(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"line: '%s' %d\0A\00"
define void @on_line_read(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = trunc i64 %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %8)
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"line: '%s' %d\0A\00"
define void @on_line_read(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4)
%6 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
struct cmdargs {
  int dummy;
};

/* Variables and functions */
int ShellCommand(struct cmdargs const *, int /*<<< orphan*/);
int FgShellCommand(struct cmdargs const *arg) { return ShellCommand(arg, 0); }


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

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

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

LLVM IR (-O2):
%struct.cmdargs = type { i32 }
define i32 @FgShellCommand(%struct.cmdargs* %0) {
%2 = tail call i32 @ShellCommand(%struct.cmdargs* %0, i32 0)
ret i32 %2
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/);
void my_rewind(struct aFILE *fp) { rewind(_get_actual_fp(fp)); }


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

x86 assembly (clang, -O2):
<my_rewind>:
push   %rax
call   1040 <_get_actual_fp@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <rewind@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define void @my_rewind(%struct.aFILE* %0) {
%2 = alloca %struct.aFILE*
store %struct.aFILE* %0, %struct.aFILE** %2
%3 = load %struct.aFILE*, %struct.aFILE** %2
%4 = call i32 @_get_actual_fp(%struct.aFILE* %3)
%5 = call i32 @rewind(i32 %4)
ret void
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define void @my_rewind(%struct.aFILE* %0) {
%2 = tail call i32 @_get_actual_fp(%struct.aFILE* %0)
%3 = tail call i32 @rewind(i32 %2)
ret void
}
/* Variables and functions */
char **cgi_parse_string(char *);
char *getenv(char *);
char **cgi_parse_query(void) {
  char *qs = getenv("QUERY_STRING");
  if (!qs)
    return (NULL);
  return (cgi_parse_string(qs));
}


x86 assembly (clang, -O0):
<cgi_parse_query>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <cgi_parse_query+0x30>
movq   $0x0,-0x8(%rbp)
jmp    115d <cgi_parse_query+0x3d>
mov    -0x10(%rbp),%rdi
call   1040 <cgi_parse_string@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgi_parse_query>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     113b <cgi_parse_query+0x1b>
mov    %rax,%rdi
pop    %rax
jmp    1040 <cgi_parse_string@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"QUERY_STRING\00"
define i8** @cgi_parse_query() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i8** @cgi_parse_string(i8* %1)
br label %5
5: ; preds = %0, %3
%6 = phi i8** [ %4, %3 ], [ null, %0 ]
ret i8** %6
}
unsigned int cfb24_get_color(unsigned int color) { return color & 0xffffff; }


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

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

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

LLVM IR (-O2):
define i32 @cfb24_get_color(i32 %0) {
%2 = and i32 %0, 16777215
ret i32 %2
}
int power(int n, int p) {
  if (p == 1) {
    return n;
  }
  if (p > 1) {
    return n * power(n, p - 1);
  }
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1133 <power+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115c <power+0x4c>
cmpl   $0x1,-0xc(%rbp)
jle    115c <power+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <power@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
mov    $0x1,%eax
cmp    $0x1,%esi
je     1120 <power+0x20>
mov    $0x1,%eax
nop
cmp    $0x2,%esi
jl     1120 <power+0x20>
add    $0xffffffff,%esi
imul   %edi,%eax
cmp    $0x1,%esi
jne    1110 <power+0x10>
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @power(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 1
br i1 %3, label %12, label %4
4: ; preds = %2, %8
%5 = phi i32 [ %9, %8 ], [ %1, %2 ]
%6 = phi i32 [ %10, %8 ], [ 1, %2 ]
%7 = icmp sgt i32 %5, 1
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = add nsw i32 %5, -1
%10 = mul nsw i32 %6, %0
%11 = icmp eq i32 %9, 1
br i1 %11, label %12, label %4
12: ; preds = %4, %8, %2
%13 = phi i32 [ 1, %2 ], [ %10, %8 ], [ %6, %4 ]
%14 = mul nsw i32 %13, %0
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ free(char **);
int ft_free(char **tab) {
  char **tmp;
  if (tab) {
    tmp = tab;
    while (*tmp)
      free(*(tmp++));
    free(tab);
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1162 <ft_free+0x52>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1159 <ft_free+0x49>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    112f <ft_free+0x1f>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_free>:
test   %rdi,%rdi
je     1150 <ft_free+0x40>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <ft_free+0x31>
lea    0x8(%r14),%rbx
nopl   0x0(%rax,%rax,1)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <ft_free+0x20>
mov    %r14,%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_free(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %12, %6 ], [ %4, %3 ]
%8 = phi i8** [ %9, %6 ], [ %0, %3 ]
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = bitcast i8* %7 to i8**
%11 = tail call i32 @free(i8** %10)
%12 = load i8*, i8** %9
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %6
14: ; preds = %6, %3
%15 = tail call i32 @free(i8** %0)
br label %16
16: ; preds = %14, %1
ret i32 1
}
int test_imm_31int64_midword_reg(long long val) {
  return ((val >> 16) & (0x31 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_31int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0x31,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_31int64_midword_reg>:
test   $0x310000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_31int64_midword_reg(i64 %0) {
%2 = and i64 %0, 3211264
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int strlen(char *);
int is_off_name(char *file) {
  int len;
  len = strlen(file);
  return (len >= 3 && file[len - 2] == '-' && file[len - 1] == 'o');
}


x86 assembly (clang, -O0):
<is_off_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x3,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jl     1170 <is_off_name+0x60>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0xd(%rbp)
jne    1170 <is_off_name+0x60>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x6f,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_off_name>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
jl     1137 <is_off_name+0x27>
lea    -0x2(%rcx),%edx
cmpb   $0x2d,(%rbx,%rdx,1)
jne    1137 <is_off_name+0x27>
add    $0xffffffff,%ecx
xor    %eax,%eax
cmpb   $0x6f,(%rbx,%rcx,1)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_off_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 3
br i1 %7, label %8, label %26
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 45
br i1 %16, label %17, label %26
17: ; preds = %8
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 111
br label %26
26: ; preds = %17, %8, %1
%27 = phi i1 [ false, %8 ], [ false, %1 ], [ %25, %17 ]
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @is_off_name(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 2
br i1 %3, label %4, label %17
4: ; preds = %1
%5 = add nsw i32 %2, -2
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 45
br i1 %9, label %10, label %17
10: ; preds = %4
%11 = add nsw i32 %2, -1
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 111
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %10, %4, %1
%18 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %16, %10 ]
ret i32 %18
}
/* Variables and functions */
double log10(double);
double lin2db(double lin) { return 20.0 * log10(lin); }


x86 assembly (clang, -O0):
<lin2db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lin2db>:
push   %rax
call   1030 <log10@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @lin2db(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log10(double %3)
%5 = fmul double 2.000000e+01, %4
ret double %5
}

LLVM IR (-O2):
define double @lin2db(double %0) {
%2 = tail call double @log10(double %0)
%3 = fmul double %2, 2.000000e+01
ret double %3
}
int strcmp(char *d, char *s) {
  for (; *d == *s; d++, s++)
    if (!*d)
      return 0;
  return *d - *s;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    115d <strcmp+0x5d>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    113b <strcmp+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1170 <strcmp+0x70>
jmp    1140 <strcmp+0x40>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
mov    (%rsi),%dl
cmp    %dl,%al
jne    1124 <strcmp+0x24>
mov    $0x1,%ecx
nopl   (%rax)
test   %al,%al
je     112d <strcmp+0x2d>
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
add    $0x1,%rcx
cmp    %dl,%al
je     1110 <strcmp+0x10>
movsbl %dl,%ecx
movsbl %al,%eax
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2, %11
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = phi i8* [ %13, %11 ], [ %1, %2 ]
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = icmp eq i8 %7, 0
br i1 %10, label %23, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %12
%15 = load i8, i8* %13
%16 = icmp eq i8 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %11, %2
%18 = phi i8 [ %3, %2 ], [ %14, %11 ]
%19 = phi i8 [ %4, %2 ], [ %15, %11 ]
%20 = sext i8 %19 to i32
%21 = sext i8 %18 to i32
%22 = sub nsw i32 %21, %20
br label %23
23: ; preds = %6, %17
%24 = phi i32 [ %22, %17 ], [ 0, %6 ]
ret i32 %24
}
/* Variables and functions */
int /*<<< orphan*/ put8(unsigned char);
void sar_reg64_imm8(unsigned int reg64, unsigned char imm8) {
  put8(0x48);
  put8(0xC1);
  put8(0xF8 + reg64);
  put8(imm8);
}


x86 assembly (clang, -O0):
<sar_reg64_imm8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0xc1,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%eax
add    $0xf8,%eax
movzbl %al,%edi
call   1030 <put8@plt>
movzbl -0x5(%rbp),%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sar_reg64_imm8>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0xc1,%edi
call   1030 <put8@plt>
add    $0xf8,%bpl
movzbl %bpl,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @sar_reg64_imm8(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = call i32 @put8(i8 zeroext 72)
%6 = call i32 @put8(i8 zeroext -63)
%7 = load i32, i32* %3
%8 = add i32 248, %7
%9 = trunc i32 %8 to i8
%10 = call i32 @put8(i8 zeroext %9)
%11 = load i8, i8* %4
%12 = call i32 @put8(i8 zeroext %11)
ret void
}

LLVM IR (-O2):
define void @sar_reg64_imm8(i32 %0, i8 zeroext %1) {
%3 = tail call i32 @put8(i8 zeroext 72)
%4 = tail call i32 @put8(i8 zeroext -63)
%5 = trunc i32 %0 to i8
%6 = add i8 %5, -8
%7 = tail call i32 @put8(i8 zeroext %6)
%8 = tail call i32 @put8(i8 zeroext %1)
ret void
}
/* Type definitions */
struct config_setting_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __config_setting_get_int64(struct config_setting_t const *,
                                              long long *);
long long config_setting_get_int64(const struct config_setting_t *setting) {
  long long value = 0;
  __config_setting_get_int64(setting, &value);
  return (value);
}


x86 assembly (clang, -O0):
<config_setting_get_int64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <__config_setting_get_int64@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_setting_get_int64>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1030 <__config_setting_get_int64@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.config_setting_t = type { i32 }
define i64 @config_setting_get_int64(%struct.config_setting_t* %0) {
%2 = alloca %struct.config_setting_t*
%3 = alloca i64
store %struct.config_setting_t* %0, %struct.config_setting_t** %2
store i64 0, i64* %3
%4 = load %struct.config_setting_t*, %struct.config_setting_t** %2
%5 = call i32 @__config_setting_get_int64(%struct.config_setting_t* %4, i64* %3)
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
%struct.config_setting_t = type { i32 }
define i64 @config_setting_get_int64(%struct.config_setting_t* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%4 = call i32 @__config_setting_get_int64(%struct.config_setting_t* %0, i64* %2)
%5 = load i64, i64* %2
ret i64 %5
}
/* Type definitions */
typedef unsigned int uint16_t;

/* Variables and functions */
uint16_t __be_u16(void *p) {
  const unsigned char *c = (const unsigned char *)p;
  return (((uint16_t)c[0]) << 8U) | (((uint16_t)c[1]) << 0U);
}


x86 assembly (clang, -O0):
<__be_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x0,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__be_u16>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @__be_u16(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl i32 %8, 8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 0
%15 = or i32 %9, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @__be_u16(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
double FMod2p(double x) {
  int i;
  double ret_val;
  ret_val = x;
  i = ret_val / 6.2831853071796;
  ret_val -= i * 6.2831853071796;
  if (ret_val < 0)
    ret_val += 6.2831853071796;
  return (ret_val);
}


x86 assembly (clang, -O0):
<FMod2p>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xee0(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xeac(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1181 <FMod2p+0x81>
movsd  0xe89(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FMod2p>:
movsd  0xef8(%rip),%xmm2
movapd %xmm0,%xmm1
divsd  %xmm2,%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @FMod2p(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
store double %5, double* %4
%6 = load double, double* %4
%7 = fdiv double %6, 0x401921FB54442D28
%8 = fptosi double %7 to i32
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = load double, double* %4
%12 = fneg double %10
%13 = call double @llvm.fmuladd.f64(double %12, double 0x401921FB54442D28, double %11)
store double %13, double* %4
%14 = load double, double* %4
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %19
16: ; preds = %1
%17 = load double, double* %4
%18 = fadd double %17, 0x401921FB54442D28
store double %18, double* %4
br label %19
19: ; preds = %16, %1
%20 = load double, double* %4
ret double %20
}

LLVM IR (-O2):
define double @FMod2p(double %0) {
%2 = fdiv double %0, 0x401921FB54442D28
%3 = fptosi double %2 to i32
%4 = sitofp i32 %3 to double
%5 = fneg double %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double 0x401921FB54442D28, double %0)
%7 = fcmp olt double %6, 0.000000e+00
%8 = fadd double %6, 0x401921FB54442D28
%9 = select i1 %7, double %8, double %6
ret double %9
}
int main(void) {
  asm("main_label: .globl main_label");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)

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

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

LLVM IR (-O2):
define i32 @main() {
tail call void asm sideeffect "main_label: .globl main_label", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}
int preinc_arg_idx(int *p, int i) {
  int j = i + 1;
  __builtin_prefetch(&p[++i], 0, 0);
  return i == j;
}


x86 assembly (clang, -O0):
<preinc_arg_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
prefetchnta (%rax)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<preinc_arg_idx>:
movslq %esi,%rax
prefetchnta 0x4(%rdi,%rax,4)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @preinc_arg_idx(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
store i32 %10, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %8, i64 %11
%13 = bitcast i32* %12 to i8*
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = icmp eq i32 %14, %15
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @preinc_arg_idx(i32* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = bitcast i32* %5 to i8*
tail call void @llvm.prefetch.p0i8(i8* %6, i32 0, i32 0, i32 1)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int mkdir(char *, int);
int /*<<< orphan*/ *opendir(char *);
void local_mkdir(char *path) {
  DIR *dir;
  if (NULL == (dir = opendir(path))) {
    if (-1 == mkdir(path, 0777)) {
      return;
    }
  } else
    closedir(dir);
}


x86 assembly (clang, -O0):
<local_mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <opendir@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    117e <local_mkdir+0x4e>
mov    -0x8(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1179 <local_mkdir+0x49>
jmp    1187 <local_mkdir+0x57>
jmp    1187 <local_mkdir+0x57>
mov    -0x10(%rbp),%rdi
call   1050 <closedir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<local_mkdir>:
push   %rbx
mov    %rdi,%rbx
call   1040 <opendir@plt>
test   %rax,%rax
je     1147 <local_mkdir+0x17>
mov    %rax,%rdi
pop    %rbx
jmp    1050 <closedir@plt>
mov    %rbx,%rdi
mov    $0x1ff,%esi
pop    %rbx
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
define void @local_mkdir(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @opendir(i8* %4)
store i32* %5, i32** %3
%6 = icmp eq i32* null, %5
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @mkdir(i8* %8, i32 511)
%10 = icmp eq i32 -1, %9
br i1 %10, label %11, label %12
11: ; preds = %7
br label %16
12: ; preds = %7
br label %16
13: ; preds = %1
%14 = load i32*, i32** %3
%15 = call i32 @closedir(i32* %14)
br label %16
16: ; preds = %11, %13, %12
ret void
}

LLVM IR (-O2):
define void @local_mkdir(i8* nocapture %0) {
%2 = tail call i32* @opendir(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @mkdir(i8* %0, i32 511)
br label %8
6: ; preds = %1
%7 = tail call i32 @closedir(i32* %2)
br label %8
8: ; preds = %4, %6
ret void
}
/* Variables and functions */
double M_PI;
double rad_of_deg(double d) { return ((d / 180.) * M_PI); }


x86 assembly (clang, -O0):
<rad_of_deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    0x2ec7(%rip),%rax
mulsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad_of_deg>:
divsd  0xef8(%rip),%xmm0
mov    0x2ed9(%rip),%rax
mulsd  (%rax),%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @rad_of_deg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 1.800000e+02
%5 = load double, double* @M_PI
%6 = fmul double %4, %5
ret double %6
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @rad_of_deg(double %0) {
%2 = fdiv double %0, 1.800000e+02
%3 = load double, double* @M_PI
%4 = fmul double %2, %3
ret double %4
}
/* Variables and functions */
int my_strcmp(char *, char *);
int /*<<< orphan*/ printf(char *, int);
void main() {
  char str1[] = "avinash";
  char str2[] = "AvinaSH";
  printf("strcmp result is %d", my_strcmp(str1, str2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <my_strcmp@plt>
mov    %eax,%esi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x6873616e697661,%rax
mov    %rax,0x10(%rsp)
movabs $0x4853616e697641,%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <my_strcmp@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.str1 = [8 x i8] c"avinash\00"
@__const.main.str2 = [8 x i8] c"AvinaSH\00"
@.str = [20 x i8] c"strcmp result is %d\00"
define void @main() {
%1 = alloca [8 x i8]
%2 = alloca [8 x i8]
%3 = bitcast [8 x i8]* %1 to i8*
%4 = bitcast [8 x i8]* %2 to i8*
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%7 = call i32 @my_strcmp(i8* %5, i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"strcmp result is %d\00"
define void @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 29400259879335521, i64* %1
%4 = bitcast i64* %2 to i8*
store i64 20357876252505665, i64* %2
%5 = call i32 @my_strcmp(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}