xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ OffEx(unsigned char, unsigned char);
int /*<<< orphan*/ OnEx(unsigned char, unsigned char);
int /*<<< orphan*/ SetPower(unsigned char, char);
int /*<<< orphan*/ usleep(int);
void OnForEx(unsigned char Outputs, int Time, char Power, unsigned char reset) {
  if (Power != -127)
    SetPower(Outputs, Power);
  OnEx(Outputs, reset);
  usleep(Time);
  OffEx(Outputs, reset);
}


x86 assembly (clang, -O0):
<OnForEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xffffff81,%eax
je     1177 <OnForEx+0x37>
mov    -0x1(%rbp),%al
movzbl %al,%edi
movsbl -0x9(%rbp),%esi
call   1040 <SetPower@plt>
mov    -0x1(%rbp),%al
movzbl %al,%edi
movzbl -0xa(%rbp),%esi
call   1030 <OnEx@plt>
mov    -0x8(%rbp),%edi
call   1060 <usleep@plt>
mov    -0x1(%rbp),%al
movzbl %al,%edi
movzbl -0xa(%rbp),%esi
call   1050 <OffEx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OnForEx>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%ebx
mov    %esi,%r14d
movzbl %dil,%ebp
cmp    $0x81,%dl
je     115c <OnForEx+0x1c>
movsbl %dl,%esi
mov    %ebp,%edi
call   1040 <SetPower@plt>
movzbl %bl,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <OnEx@plt>
mov    %r14d,%edi
call   1060 <usleep@plt>
mov    %ebp,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <OffEx@plt>

LLVM IR (-O0):
define void @OnForEx(i8 zeroext %0, i32 %1, i8 signext %2, i8 zeroext %3) {
%5 = alloca i8
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %5
store i32 %1, i32* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i8, i8* %7
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, -127
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i8, i8* %5
%14 = load i8, i8* %7
%15 = call i32 @SetPower(i8 zeroext %13, i8 signext %14)
br label %16
16: ; preds = %12, %4
%17 = load i8, i8* %5
%18 = load i8, i8* %8
%19 = call i32 @OnEx(i8 zeroext %17, i8 zeroext %18)
%20 = load i32, i32* %6
%21 = call i32 @usleep(i32 %20)
%22 = load i8, i8* %5
%23 = load i8, i8* %8
%24 = call i32 @OffEx(i8 zeroext %22, i8 zeroext %23)
ret void
}

LLVM IR (-O2):
define void @OnForEx(i8 zeroext %0, i32 %1, i8 signext %2, i8 zeroext %3) {
%5 = icmp eq i8 %2, -127
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @SetPower(i8 zeroext %0, i8 signext %2)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @OnEx(i8 zeroext %0, i8 zeroext %3)
%10 = tail call i32 @usleep(i32 %1)
%11 = tail call i32 @OffEx(i8 zeroext %0, i8 zeroext %3)
ret void
}
int main() {
  int i;
label:
  i = 0;
  goto label;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %3, %0
store i32 0, i32* %2
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int ZSTD_isError(size_t);
unsigned ZSTDv02_isError(size_t code) { return ZSTD_isError(code); }


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

x86 assembly (clang, -O2):
<ZSTDv02_isError>:
jmp    1030 <ZSTD_isError@plt>

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

LLVM IR (-O2):
define i32 @ZSTDv02_isError(i64 %0) {
%2 = tail call i32 @ZSTD_isError(i64 %0)
ret i32 %2
}
/* Variables and functions */
double modf(double, double *);
int round_value(double value) {
  double integral_part;
  double fractional_part;
  fractional_part = modf(value, &integral_part);
  if (fractional_part >= .5) {
    return (int)(integral_part + 1);
  } else {
    return (int)integral_part;
  }
}


x86 assembly (clang, -O0):
<round_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    -0x18(%rbp),%rdi
call   1030 <modf@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xec3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1160 <round_value+0x50>
movsd  0xeb9(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <round_value+0x58>
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_value>:
push   %rax
mov    %rsp,%rdi
call   1030 <modf@plt>
movsd  (%rsp),%xmm1
movsd  0xeda(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  0xed6(%rip),%xmm3
cmpnlesd %xmm0,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm3
orpd   %xmm1,%xmm3
cvttsd2si %xmm3,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @round_value(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = call double @modf(double %6, double* %4)
store double %7, double* %5
%8 = load double, double* %5
%9 = fcmp oge double %8, 5.000000e-01
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load double, double* %4
%12 = fadd double %11, 1.000000e+00
%13 = fptosi double %12 to i32
store i32 %13, i32* %2
br label %17
14: ; preds = %1
%15 = load double, double* %4
%16 = fptosi double %15 to i32
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @round_value(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call double @modf(double %0, double* %2)
%5 = fcmp ult double %4, 5.000000e-01
%6 = load double, double* %2
%7 = fadd double %6, 1.000000e+00
%8 = select i1 %5, double %6, double %7
%9 = fptosi double %8 to i32
ret i32 %9
}
/* Type definitions */
struct hdhomerun_control_sock_t {
  int dummy;
};

/* Variables and functions */
int hdhomerun_control_get_set(struct hdhomerun_control_sock_t *, char const *,
                              char const *, int /*<<< orphan*/, char **,
                              char **);
int hdhomerun_control_set(struct hdhomerun_control_sock_t *cs, const char *name,
                          const char *value, char **pvalue, char **perror) {
  return hdhomerun_control_get_set(cs, name, value, 0, pvalue, perror);
}


x86 assembly (clang, -O0):
<hdhomerun_control_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
xor    %ecx,%ecx
call   1030 <hdhomerun_control_get_set@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdhomerun_control_set>:
mov    %r8,%r9
mov    %rcx,%r8
xor    %ecx,%ecx
jmp    1030 <hdhomerun_control_get_set@plt>

LLVM IR (-O0):
%struct.hdhomerun_control_sock_t = type { i32 }
define i32 @hdhomerun_control_set(%struct.hdhomerun_control_sock_t* %0, i8* %1, i8* %2, i8** %3, i8** %4) {
%6 = alloca %struct.hdhomerun_control_sock_t*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8**
%10 = alloca i8**
store %struct.hdhomerun_control_sock_t* %0, %struct.hdhomerun_control_sock_t** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8** %3, i8*** %9
store i8** %4, i8*** %10
%11 = load %struct.hdhomerun_control_sock_t*, %struct.hdhomerun_control_sock_t** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = load i8**, i8*** %9
%15 = load i8**, i8*** %10
%16 = call i32 @hdhomerun_control_get_set(%struct.hdhomerun_control_sock_t* %11, i8* %12, i8* %13, i32 0, i8** %14, i8** %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.hdhomerun_control_sock_t = type { i32 }
define i32 @hdhomerun_control_set(%struct.hdhomerun_control_sock_t* %0, i8* %1, i8* %2, i8** %3, i8** %4) {
%6 = tail call i32 @hdhomerun_control_get_set(%struct.hdhomerun_control_sock_t* %0, i8* %1, i8* %2, i32 0, i8** %3, i8** %4)
ret i32 %6
}
int fixb(int val) {
  return (val & ~0x60) | ((val & 0x20) << 1) | ((val & 0x40) >> 1);
}


x86 assembly (clang, -O0):
<fixb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffff9f,%eax
mov    -0x4(%rbp),%ecx
and    $0x20,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0x40,%ecx
sar    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixb>:
mov    %edi,%eax
and    $0xffffff9f,%eax
mov    %edi,%ecx
and    $0x20,%ecx
lea    (%rax,%rcx,2),%eax
shr    %edi
and    $0x20,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @fixb(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -97
%5 = load i32, i32* %2
%6 = and i32 %5, 32
%7 = shl i32 %6, 1
%8 = or i32 %4, %7
%9 = load i32, i32* %2
%10 = and i32 %9, 64
%11 = ashr i32 %10, 1
%12 = or i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @fixb(i32 %0) {
%2 = and i32 %0, -97
%3 = shl i32 %0, 1
%4 = and i32 %3, 64
%5 = or i32 %4, %2
%6 = lshr i32 %0, 1
%7 = and i32 %6, 32
%8 = or i32 %5, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ die(int /*<<< orphan*/);
int do_quit(const char *inputfilename, int lineno, int argc, char **argv) {
  die(0);
  return -1;
}


x86 assembly (clang, -O0):
<do_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
xor    %edi,%edi
call   1030 <die@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_quit>:
push   %rax
xor    %edi,%edi
call   1030 <die@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @do_quit(i8* %0, i32 %1, i32 %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
%9 = call i32 @die(i32 0)
ret i32 -1
}

LLVM IR (-O2):
define i32 @do_quit(i8* nocapture readnone %0, i32 %1, i32 %2, i8** nocapture readnone %3) {
%5 = tail call i32 @die(i32 0)
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
int getx16(FILE *iob) {
  int temp;
  temp = getc(iob);
  return temp | (getc(iob) << 8);
}


x86 assembly (clang, -O0):
<getx16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getx16>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <getc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <getc@plt>
shl    $0x8,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getx16(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = tail call i32 @getc(i32* %0)
%4 = shl i32 %3, 8
%5 = or i32 %4, %2
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ wf_next_argument(char *, int, int /*<<< orphan*/ *);
void wf_skip_line(FILE *fp) {
  char buffer[100];
  while (wf_next_argument(buffer, sizeof buffer, fp) > 0) {
  }
}


x86 assembly (clang, -O0):
<wf_skip_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x64,%esi
call   1030 <wf_next_argument@plt>
cmp    $0x0,%rax
jle    113d <wf_skip_line+0x2d>
jmp    111c <wf_skip_line+0xc>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wf_skip_line>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
nopl   (%rax)
mov    %r14,%rdi
mov    $0x64,%esi
mov    %rbx,%rdx
call   1030 <wf_next_argument@plt>
test   %rax,%rax
jg     1120 <wf_skip_line+0x10>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @wf_skip_line(i32* %0) {
%2 = alloca i32*
%3 = alloca [100 x i8]
store i32* %0, i32** %2
br label %4
4: ; preds = %9, %1
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = call i64 @wf_next_argument(i8* %5, i32 100, i32* %6)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %4
br label %4
10: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @wf_skip_line(i32* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %4, %1
%5 = call i64 @wf_next_argument(i8* %3, i32 100, i32* %0)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %4, label %7
7: ; preds = %4
ret void
}
/* Type definitions */
typedef unsigned long uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t I2CFIFODataPutNonBlocking(uint32_t ui32Base, uint8_t ui8Data) {
  ;
  if ((*((volatile unsigned long *)(ui32Base + 0x00000F08))) & 0x00000002) {
    return (0);
  } else {
    (*((volatile unsigned long *)(ui32Base + 0x00000F00))) = ui8Data;
    return (1);
  }
}


x86 assembly (clang, -O0):
<I2CFIFODataPutNonBlocking>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xf08,%eax
cltq
mov    (%rax),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     1132 <I2CFIFODataPutNonBlocking+0x32>
movl   $0x0,-0x4(%rbp)
jmp    114a <I2CFIFODataPutNonBlocking+0x4a>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%eax
add    $0xf00,%eax
cltq
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CFIFODataPutNonBlocking>:
movslq %edi,%rcx
xor    %eax,%eax
testq  $0x2,0xf08(%rcx)
jne    111e <I2CFIFODataPutNonBlocking+0x1e>
mov    %rsi,0xf00(%rcx)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @I2CFIFODataPutNonBlocking(i32 %0, i64 %1) {
%3 = add nsw i32 %0, 3848
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 2
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = add nsw i32 %0, 3840
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i64*
store volatile i64 %1, i64* %12
br label %13
13: ; preds = %2, %9
%14 = phi i32 [ 1, %9 ], [ 0, %2 ]
ret i32 %14
}
/* Variables and functions */
void *__fpp_protect_internal(void *);
int /*<<< orphan*/ fpp_mutex_lock();
int /*<<< orphan*/ fpp_mutex_unlock();
void *__fpp_protect(void *p) {
  void *ret;
  fpp_mutex_lock();
  ret = __fpp_protect_internal(p);
  fpp_mutex_unlock();
  return ret;
}


x86 assembly (clang, -O0):
<__fpp_protect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <fpp_mutex_lock@plt>
mov    -0x8(%rbp),%rdi
call   1030 <__fpp_protect_internal@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <fpp_mutex_unlock@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fpp_protect>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <fpp_mutex_lock@plt>
mov    %rbx,%rdi
call   1030 <__fpp_protect_internal@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <fpp_mutex_unlock@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @__fpp_protect(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i32 (...) @fpp_mutex_lock()
%5 = load i8*, i8** %2
%6 = call i8* @__fpp_protect_internal(i8* %5)
store i8* %6, i8** %3
%7 = call i32 (...) @fpp_mutex_unlock()
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @__fpp_protect(i8* %0) {
%2 = tail call i32 (...) @fpp_mutex_lock()
%3 = tail call i8* @__fpp_protect_internal(i8* %0)
%4 = tail call i32 (...) @fpp_mutex_unlock()
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void uxmi_color_reset() { printf("\033[0;m"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[0;m\00"
define void @uxmi_color_reset() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[0;m\00"
define void @uxmi_color_reset() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ my_expensive_function();
int /*<<< orphan*/ printf(char *, double);
int main() {
  clock_t tic = clock();
  my_expensive_function();
  clock_t toc = clock();
  printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <my_expensive_function@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e78(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <my_expensive_function@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e90(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Elapsed: %f seconds\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i64 (...) @clock()
store i64 %4, i64* %2
%5 = call i32 (...) @my_expensive_function()
%6 = call i64 (...) @clock()
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = load i64, i64* %2
%9 = sub nsw i64 %7, %8
%10 = sitofp i64 %9 to double
%11 = load double, double* @CLOCKS_PER_SEC
%12 = fdiv double %10, %11
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Elapsed: %f seconds\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main() {
%1 = tail call i64 (...) @clock()
%2 = tail call i32 (...) @my_expensive_function()
%3 = tail call i64 (...) @clock()
%4 = sub nsw i64 %3, %1
%5 = sitofp i64 %4 to double
%6 = load double, double* @CLOCKS_PER_SEC
%7 = fdiv double %5, %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void quit(char *str) {
  perror(str);
  exit(1);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @quit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @quit(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
long sign_case_long(long num, long when_negative, long when_zero,
                    long when_positive) {
  return ((((num)) <= ((0)))
              ? ((((num)) < ((0))) ? ((when_negative)) : ((when_zero)))
              : ((when_positive)));
}


x86 assembly (clang, -O0):
<sign_case_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jg     114c <sign_case_long+0x4c>
cmpq   $0x0,-0x8(%rbp)
jge    1137 <sign_case_long+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    113f <sign_case_long+0x3f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1154 <sign_case_long+0x54>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign_case_long>:
mov    %rsi,%rax
test   %rdi,%rdi
cmove  %rdx,%rax
cmovg  %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @sign_case_long(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = icmp slt i64 %0, 1
%6 = icmp eq i64 %0, 0
%7 = select i1 %6, i64 %2, i64 %1
%8 = select i1 %5, i64 %7, i64 %3
ret i64 %8
}
int Kit_DsdLitIsCompl(int Lit) { return Lit & 1; }


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

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

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

LLVM IR (-O2):
define i32 @Kit_DsdLitIsCompl(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
const char *boolstring(int val) { return val ? "true" : "false"; }


x86 assembly (clang, -O0):
<boolstring>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef4(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<boolstring>:
test   %edi,%edi
lea    0xefc(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @boolstring(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @boolstring(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
int sb_has_quota_loaded(struct super_block *sb, int type) { return 0; }


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

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

LLVM IR (-O0):
%struct.super_block = type opaque
define i32 @sb_has_quota_loaded(%struct.super_block* %0, i32 %1) {
%3 = alloca %struct.super_block*
%4 = alloca i32
store %struct.super_block* %0, %struct.super_block** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.super_block = type opaque
define i32 @sb_has_quota_loaded(%struct.super_block* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int bar(int);
int foo() {
  int a = 0;
  return bar(a);
}


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

x86 assembly (clang, -O2):
<foo>:
xor    %edi,%edi
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 @bar(i32 0)
ret i32 %1
}
int func(void) {
  register int *foo __asm__("%edx") = 0;
  return *foo;
}


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

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

LLVM IR (-O0):
define i32 @func() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = load i32*, i32** %1
%3 = load i32, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @func() {
ret i32 undef
}
/* Variables and functions */
int get_digits(int a) {
  int nod;
  nod = (int)((log10(abs(a))) + 1);
  ;
  return nod;
}


x86 assembly (clang, -O0):
<get_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
cvtsi2sd %eax,%xmm0
call   1040 <log10@plt>
movsd  0xebc(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_digits>:
push   %rax
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cvtsi2sd %eax,%xmm0
call   1030 <log10@plt>
addsd  0xed7(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_digits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @abs(i32 %4)
%6 = sitofp i32 %5 to double
%7 = call double @log10(double %6)
%8 = fadd double %7, 1.000000e+00
%9 = fptosi double %8 to i32
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @get_digits(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = sitofp i32 %2 to double
%4 = tail call double @log10(double %3)
%5 = fadd double %4, 1.000000e+00
%6 = fptosi double %5 to i32
ret i32 %6
}
int low_half(unsigned char num) { return (num % 16); }


x86 assembly (clang, -O0):
<low_half>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @low_half(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = srem i32 %4, 16
ret i32 %5
}

LLVM IR (-O2):
define i32 @low_half(i8 zeroext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void output_color_yellow() { printf("\033[0;33m"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[0;33m\00"
define void @output_color_yellow() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[0;33m\00"
define void @output_color_yellow() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int closefrom_procfs(int);
int closefrom_sysconf(int);
int rep_closefrom(int lower) {
  int ret;
  ret = closefrom_procfs(lower);
  if (ret == 0) {
    return 0;
  }
  return closefrom_sysconf(lower);
}


x86 assembly (clang, -O0):
<rep_closefrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <closefrom_procfs@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114c <rep_closefrom+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1157 <rep_closefrom+0x37>
mov    -0x8(%rbp),%edi
call   1030 <closefrom_sysconf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rep_closefrom>:
push   %rbx
mov    %edi,%ebx
call   1040 <closefrom_procfs@plt>
test   %eax,%eax
je     1134 <rep_closefrom+0x14>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <closefrom_sysconf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @rep_closefrom(i32 %0) {
%2 = tail call i32 @closefrom_procfs(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @closefrom_sysconf(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ testBool(int);
void testByte(char X) {
  printf("%d ", X);
  testBool(X != 0);
}


x86 assembly (clang, -O0):
<testByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xecb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1040 <printf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <testBool@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testByte>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %edi,%edi
test   %bl,%bl
setne  %dil
pop    %rbx
jmp    1030 <testBool@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @testByte(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %3)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @testBool(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @testByte(i8 signext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%3 = icmp ne i8 %0, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @testBool(i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/ *, int);
void set_uint32(char *cp, uint32_t v) { memcpy(cp, &v, sizeof v); }


x86 assembly (clang, -O0):
<set_uint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_uint32>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @set_uint32(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 @memcpy(i8* %5, i32* %4, i32 4)
ret void
}

LLVM IR (-O2):
define void @set_uint32(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @memcpy(i8* %0, i32* %3, i32 4)
ret void
}
/* Type definitions */
struct statvfs {
  int dummy;
};

/* Variables and functions */
int syscall(int, int, int, struct statvfs *);
int fstatvfs(int fd, struct statvfs *buf) {
  return syscall(269, fd, sizeof *buf, buf);
}


x86 assembly (clang, -O0):
<fstatvfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    $0x10d,%edi
mov    $0x4,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fstatvfs>:
mov    %rsi,%rcx
mov    %edi,%esi
mov    $0x10d,%edi
mov    $0x4,%edx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.statvfs = type { i32 }
define i32 @fstatvfs(i32 %0, %struct.statvfs* %1) {
%3 = alloca i32
%4 = alloca %struct.statvfs*
store i32 %0, i32* %3
store %struct.statvfs* %1, %struct.statvfs** %4
%5 = load i32, i32* %3
%6 = load %struct.statvfs*, %struct.statvfs** %4
%7 = call i32 @syscall(i32 269, i32 %5, i32 4, %struct.statvfs* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.statvfs = type { i32 }
define i32 @fstatvfs(i32 %0, %struct.statvfs* %1) {
%3 = tail call i32 @syscall(i32 269, i32 %0, i32 4, %struct.statvfs* %1)
ret i32 %3
}
/* Variables and functions */
int w5100_read_byte(int);
unsigned w5100_readPATR() { return w5100_read_byte(0x001C); }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x1c,%edi
call   1030 <w5100_read_byte@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @w5100_readPATR() {
%1 = call i32 @w5100_read_byte(i32 28)
ret i32 %1
}

LLVM IR (-O2):
define i32 @w5100_readPATR() {
%1 = tail call i32 @w5100_read_byte(i32 28)
ret i32 %1
}
void fdevent_setfd_cloexec(int fd) { ((void)(fd)); }


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

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

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

LLVM IR (-O2):
define void @fdevent_setfd_cloexec(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *);
int unlink(const char p) {
  printk("Write unlink()\n");
  return 0;
}


x86 assembly (clang, -O0):
<unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <printk@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"Write unlink()\0A\00"
define i32 @unlink(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @printk(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Write unlink()\0A\00"
define i32 @unlink(i8 signext %0) {
%2 = tail call i32 @printk(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(
      stderr,
      "    This short program aims to test ioctl functions of the temper\n    "
      "device driver. It takes one argument:\n      - 'i' for in temperature\n "
      "     - 'o' for out temperature\n    The result is printed.\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [199 x i8] c" This short program aims to test ioctl functions of the temper\0A device driver. It takes one argument:\0A - 'i' for in temperature\0A - 'o' for out temperature\0A The result is printed.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([199 x i8], [199 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [199 x i8] c" This short program aims to test ioctl functions of the temper\0A device driver. It takes one argument:\0A - 'i' for in temperature\0A - 'o' for out temperature\0A The result is printed.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([199 x i8], [199 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *_FAT_mem_align(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<_FAT_mem_align>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @_FAT_mem_align(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
void gtk_position_type_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_position_type_get_type() {
ret void
}
void *af(void *a) { return a; }


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

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

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

LLVM IR (-O2):
define i8* @af(i8* readnone returned %0) {
ret i8* %0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int compose_transposed(uint16_t width, uint16_t height, int i, int j) {
  return (i * height + j);
}


x86 assembly (clang, -O0):
<compose_transposed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compose_transposed>:
imul   %edx,%esi
lea    (%rsi,%rcx,1),%eax
ret

LLVM IR (-O0):
define i32 @compose_transposed(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* %7
%10 = load i32, i32* %6
%11 = mul nsw i32 %9, %10
%12 = load i32, i32* %8
%13 = add nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @compose_transposed(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %2, %1
%6 = add nsw i32 %5, %3
ret i32 %6
}
void av_camellia_init() {}


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

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

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

LLVM IR (-O2):
define void @av_camellia_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ at91_serial_putc(char const);
int puts(const char *str) {
  while (*str != 0) {
    at91_serial_putc(*str);
    str++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <puts+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <at91_serial_putc@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <puts+0xc>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <at91_serial_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <puts+0x10>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @at91_serial_putc(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i32 1
}
/* Variables and functions */
void *fixup_null_alloc(size_t const);
void *malloc(size_t const);
void *xmalloc(const size_t n) {
  void *p = malloc(n);
  if (!p)
    p = fixup_null_alloc(n);
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1151 <xmalloc+0x31>
mov    -0x8(%rbp),%rdi
call   1030 <fixup_null_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1130 <xmalloc+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fixup_null_alloc@plt>

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i64, i64* %2
%10 = call i8* @fixup_null_alloc(i64 %9)
store i8* %10, i8** %3
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* @fixup_null_alloc(i64 %0)
br label %6
6: ; preds = %4, %1
%7 = phi i8* [ %2, %1 ], [ %5, %4 ]
ret i8* %7
}
void clear_bss(void) {
  extern int __bss_start, __bss_end__;
  int *p = &__bss_start;
  for (; p < &__bss_end__; p++)
    *p = 0;
}


x86 assembly (clang, -O0):
<clear_bss>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2ec2(%rip),%rax
cmp    %rax,-0x8(%rbp)
jae    113b <clear_bss+0x3b>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <clear_bss+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bss>:
push   %rax
mov    0x2ed0(%rip),%rdi
cmp    0x2eb9(%rip),%rdi
jae    114c <clear_bss+0x3c>
lea    0x4(%rdi),%rax
mov    0x2eac(%rip),%rcx
cmp    %rax,%rcx
cmova  %rcx,%rax
mov    %rdi,%rcx
not    %rcx
lea    (%rcx,%rax,1),%rdx
add    $0x4,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

LLVM IR (-O0):
@__bss_start = external global i32
@__bss_end__ = external global i32
define void @clear_bss() {
%1 = alloca i32*
store i32* @__bss_start, i32** %1
br label %2
2: ; preds = %7, %0
%3 = load i32*, i32** %1
%4 = icmp ult i32* %3, @__bss_end__
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32*, i32** %1
store i32 0, i32* %6
br label %7
7: ; preds = %5
%8 = load i32*, i32** %1
%9 = getelementptr inbounds i32, i32* %8, i32 1
store i32* %9, i32** %1
br label %2
10: ; preds = %2
ret void
}

LLVM IR (-O2):
@__bss_start = external global i32
@__bss_end__ = external global i32
define void @clear_bss() {
br i1 icmp ult (i32* @__bss_start, i32* @__bss_end__), label %1, label %5
1: ; preds = %0
%2 = call i64 @llvm.umax.i64(i64 ptrtoint (i32* @__bss_end__ to i64), i64 add (i64 ptrtoint (i32* @__bss_start to i64), i64 4))
%3 = add i64 %2, add (i64 xor (i64 ptrtoint (i32* @__bss_start to i64), i64 -1), i64 4)
%4 = and i64 %3, -4
br label %5
5: ; preds = %1, %0
ret void
}
/* Variables and functions */
void os_daemonize_terminate(const char *pid_file) {}


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

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

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

LLVM IR (-O2):
define void @os_daemonize_terminate(i8* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ isprint(unsigned char);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(unsigned char);
void print_char(unsigned char c) {
  if (isprint(c))
    putchar(c);
  else
    printf("\\x%02x", (int)c);
}


x86 assembly (clang, -O0):
<print_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     115f <print_char+0x2f>
movzbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    116f <print_char+0x3f>
movzbl -0x1(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_char>:
push   %rbx
mov    %edi,%ebx
call   1050 <isprint@plt>
test   %rax,%rax
je     1146 <print_char+0x16>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <putchar@plt>
movzbl %bl,%esi
lea    0xeb0(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\\x%02x\00"
define void @print_char(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isprint(i8 zeroext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i32 @putchar(i8 zeroext %7)
br label %13
9: ; preds = %1
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\\x%02x\00"
define void @print_char(i8 zeroext %0) {
%2 = tail call i64 @isprint(i8 zeroext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @putchar(i8 zeroext %0)
br label %9
6: ; preds = %1
%7 = zext i8 %0 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %4
ret void
}
int max(int a, int b) {
  if (a > b)
    return (a);
  else
    return (b);
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <max+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <max+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @max(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* %4
%7 = load i32, i32* %5
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %4
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %5
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}