xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ft_putendl(char *);
int /*<<< orphan*/ ft_putnbr(int);
int /*<<< orphan*/ ft_putstr(char *);
void ft_putnbrendl_succ(int nb) {
  ft_putstr("\x1B[32m");
  ft_putnbr(nb);
  ft_putendl("\x1B[0m");
}


x86 assembly (clang, -O0):
<ft_putnbrendl_succ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1050 <ft_putstr@plt>
mov    -0x4(%rbp),%edi
call   1040 <ft_putnbr@plt>
lea    0xeb0(%rip),%rdi
call   1030 <ft_putendl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbrendl_succ>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1050 <ft_putstr@plt>
mov    %ebx,%edi
call   1040 <ft_putnbr@plt>
lea    0xeb9(%rip),%rdi
pop    %rbx
jmp    1030 <ft_putendl@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[32m\00"
@.str.1 = [5 x i8] c"\1B[0m\00"
define void @ft_putnbrendl_succ(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @ft_putstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @ft_putnbr(i32 %4)
%6 = call i32 @ft_putendl(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[32m\00"
@.str.1 = [5 x i8] c"\1B[0m\00"
define void @ft_putnbrendl_succ(i32 %0) {
%2 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @ft_putnbr(i32 %0)
%4 = tail call i32 @ft_putendl(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int hal_io_apic_read32(int);
int /*<<< orphan*/ hal_io_apic_write32(int, int);
void enable_apic() {
  hal_io_apic_write32(0x000000F0, hal_io_apic_read32(0x000000F0) | 0x100);
  return;
}


x86 assembly (clang, -O0):
<enable_apic>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf0,%edi
call   1030 <hal_io_apic_read32@plt>
mov    %eax,%esi
or     $0x100,%esi
mov    $0xf0,%edi
call   1040 <hal_io_apic_write32@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_apic>:
push   %rax
mov    $0xf0,%edi
call   1030 <hal_io_apic_read32@plt>
or     $0x100,%eax
mov    $0xf0,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <hal_io_apic_write32@plt>

LLVM IR (-O0):
define void @enable_apic() {
%1 = call i32 @hal_io_apic_read32(i32 240)
%2 = or i32 %1, 256
%3 = call i32 @hal_io_apic_write32(i32 240, i32 %2)
ret void
}

LLVM IR (-O2):
define void @enable_apic() {
%1 = tail call i32 @hal_io_apic_read32(i32 240)
%2 = or i32 %1, 256
%3 = tail call i32 @hal_io_apic_write32(i32 240, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int _XGetScanlinePad() {
  printf("_XGetScanlinePad called\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"_XGetScanlinePad called\0A\00"
define i32 @_XGetScanlinePad() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"_XGetScanlinePad called\00"
define i32 @_XGetScanlinePad() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printa(const char *array, const int size) {
  int i;
  for (i = 0; i < size; i++)
    printf("%c", array[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<printa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <printa+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printa+0x16>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printa>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <printa+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <printa+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @printa(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = tail call i32 @putchar(i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
int inflateInit_(struct z_stream_s *stream, const char *version,
                 int stream_size) {
  return -2;
}


x86 assembly (clang, -O0):
<inflateInit_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xfffffffe,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.z_stream_s = type opaque
define i32 @inflateInit_(%struct.z_stream_s* %0, i8* %1, i32 %2) {
%4 = alloca %struct.z_stream_s*
%5 = alloca i8*
%6 = alloca i32
store %struct.z_stream_s* %0, %struct.z_stream_s** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 -2
}

LLVM IR (-O2):
%struct.z_stream_s = type opaque
define i32 @inflateInit_(%struct.z_stream_s* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
ret i32 -2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long);
int main() { printf("%I64d", (long long int)0); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"%I64d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS7_SIGNED;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS7_SIGNED_it;
int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &PKCS7_SIGNED_it);
}


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

x86 assembly (clang, -O2):
<i2d_PKCS7_SIGNED>:
mov    0x2ec9(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

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

LLVM IR (-O2):
@PKCS7_SIGNED_it = global i32 0
define i32 @i2d_PKCS7_SIGNED(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @PKCS7_SIGNED_it)
ret i32 %3
}
/* Variables and functions */
float __ocml_ncdfinv_f32(float);
float normcdfinvf(float x) { return __ocml_ncdfinv_f32(x); }


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

x86 assembly (clang, -O2):
<normcdfinvf>:
jmp    1030 <__ocml_ncdfinv_f32@plt>

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

LLVM IR (-O2):
define float @normcdfinvf(float %0) {
%2 = tail call float @__ocml_ncdfinv_f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ __write(char);
void ATReplyWithChar(char c) { __write(c); }


x86 assembly (clang, -O0):
<ATReplyWithChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <__write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ATReplyWithChar>:
jmp    1030 <__write@plt>

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

LLVM IR (-O2):
define void @ATReplyWithChar(i8 signext %0) {
%2 = tail call i32 @__write(i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main() {
  const char *string = "hello";
  const char *p;
  p = string ? string : "NULL";
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1152 <main+0x32>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1162 <main+0x42>
lea    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1162 <main+0x42>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [5 x i8] c"NULL\00"
@.str.2 = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = load i8*, i8** %2
br label %9
8: ; preds = %0
br label %9
9: ; preds = %8, %6
%10 = phi i8* [ %7, %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %8 ]
store i8* %10, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ cumnor(double *, double *, double *);
void cdfnor(double *p, double *q, double *x, double *mean, double *sd) {
  static double z;
  z = (*x - *mean) / *sd;
  cumnor(&z, p, q);
}


x86 assembly (clang, -O0):
<cdfnor>:
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    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,0x2ee4(%rip)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0x2ed5(%rip),%rdi
call   1030 <cumnor@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdfnor>:
mov    %rsi,%rax
mov    %rdi,%rsi
movsd  (%rdx),%xmm0
subsd  (%rcx),%xmm0
divsd  (%r8),%xmm0
movsd  %xmm0,0x2f05(%rip)
lea    0x2efe(%rip),%rdi
mov    %rax,%rdx
jmp    1030 <cumnor@plt>

LLVM IR (-O0):
@cdfnor.z = internal global double 0.000000e+00
define void @cdfnor(double* %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%11 = load double*, double** %8
%12 = load double, double* %11
%13 = load double*, double** %9
%14 = load double, double* %13
%15 = fsub double %12, %14
%16 = load double*, double** %10
%17 = load double, double* %16
%18 = fdiv double %15, %17
store double %18, double* @cdfnor.z
%19 = load double*, double** %6
%20 = load double*, double** %7
%21 = call i32 @cumnor(double* @cdfnor.z, double* %19, double* %20)
ret void
}

LLVM IR (-O2):
@cdfnor.z = internal global double 0.000000e+00
define void @cdfnor(double* %0, double* %1, double* nocapture %2, double* nocapture %3, double* nocapture %4) {
%6 = load double, double* %2
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = load double, double* %4
%10 = fdiv double %8, %9
store double %10, double* @cdfnor.z
%11 = tail call i32 @cumnor(double* @cdfnor.z, double* %0, double* %1)
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, char);
int main() {
  char c;
  c = getchar();
  if (c >= 'a' && c <= 'z') {
    c = ((122 - c) + 97);
    printf("%c\n", c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1174 <main+0x54>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1174 <main+0x54>
movsbl -0x5(%rbp),%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
add    $0x61,%eax
mov    %al,-0x5(%rbp)
lea    0xe95(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1143 <main+0x23>
mov    $0xdb,%cl
sub    %al,%cl
movsbl %cl,%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %19
7: ; preds = %0
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = sub nsw i32 122, %13
%15 = add nsw i32 %14, 97
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
%17 = load i8, i8* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %17)
br label %19
19: ; preds = %11, %7, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = add i8 %1, -97
%3 = icmp ult i8 %2, 26
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = sub nuw i8 -37, %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
br label %7
7: ; preds = %4, %0
ret i32 0
}
/* Type definitions */
struct termios {
  int dummy;
};
typedef int /*<<< orphan*/ speed_t;

/* Variables and functions */
int cfsetspeed(struct termios *, int /*<<< orphan*/);
int cfsetispeed(struct termios *p, speed_t s) { return cfsetspeed(p, s); }


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

x86 assembly (clang, -O2):
<cfsetispeed>:
jmp    1030 <cfsetspeed@plt>

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

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @cfsetispeed(%struct.termios* %0, i32 %1) {
%3 = tail call i32 @cfsetspeed(%struct.termios* %0, i32 %1)
ret i32 %3
}
void swapl(long *a, long *b) {
  *a ^= *b;
  *b ^= *a;
  *a ^= *b;
}


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

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

LLVM IR (-O0):
define void @swapl(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
store i64* %0, i64** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = load i64, i64* %5
%7 = load i64*, i64** %3
%8 = load i64, i64* %7
%9 = xor i64 %8, %6
store i64 %9, i64* %7
%10 = load i64*, i64** %3
%11 = load i64, i64* %10
%12 = load i64*, i64** %4
%13 = load i64, i64* %12
%14 = xor i64 %13, %11
store i64 %14, i64* %12
%15 = load i64*, i64** %4
%16 = load i64, i64* %15
%17 = load i64*, i64** %3
%18 = load i64, i64* %17
%19 = xor i64 %18, %16
store i64 %19, i64* %17
ret void
}

LLVM IR (-O2):
define void @swapl(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %1
%4 = load i64, i64* %0
%5 = xor i64 %4, %3
store i64 %5, i64* %0
%6 = load i64, i64* %1
%7 = xor i64 %6, %5
store i64 %7, i64* %1
%8 = load i64, i64* %0
%9 = xor i64 %8, %7
store i64 %9, i64* %0
ret void
}
/* Variables and functions */
int get_asr17();
int cpu_index() { return (get_asr17() >> 28) & 0x0f; }


x86 assembly (clang, -O0):
<cpu_index>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <get_asr17@plt>
sar    $0x1c,%eax
and    $0xf,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_index>:
push   %rax
xor    %eax,%eax
call   1030 <get_asr17@plt>
shr    $0x1c,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cpu_index() {
%1 = call i32 (...) @get_asr17()
%2 = ashr i32 %1, 28
%3 = and i32 %2, 15
ret i32 %3
}

LLVM IR (-O2):
define i32 @cpu_index() {
%1 = tail call i32 (...) @get_asr17()
%2 = lshr i32 %1, 28
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
unsigned int pthread_mutex_lock(int /*<<< orphan*/ *);
unsigned int OSAL_MutexGet(pthread_mutex_t *mutex) {
  return pthread_mutex_lock(mutex);
}


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

x86 assembly (clang, -O2):
<OSAL_MutexGet>:
jmp    1030 <pthread_mutex_lock@plt>

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

LLVM IR (-O2):
define i32 @OSAL_MutexGet(i32* %0) {
%2 = tail call i32 @pthread_mutex_lock(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int str_len(char *);
int main(void) {
  char *str;
  int len;
  str = "Holberton!";
  len = str_len(str);
  printf("%d\n", len);
  return (0);
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"Holberton!\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @str_len(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
void reverseWord(char *from, char *to) {
  char temp;
  while (from < to) {
    temp = *from;
    *from++ = *to;
    *to-- = temp;
  }
}


x86 assembly (clang, -O0):
<reverseWord>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1153 <reverseWord+0x53>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    110c <reverseWord+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverseWord>:
cmp    %rsi,%rdi
jae    112c <reverseWord+0x2c>
add    $0xffffffffffffffff,%rsi
nopl   0x0(%rax)
movzbl (%rdi),%eax
movzbl 0x1(%rsi),%ecx
mov    %cl,(%rdi)
add    $0x1,%rdi
mov    %al,0x1(%rsi)
lea    -0x1(%rsi),%rax
cmp    %rsi,%rdi
mov    %rax,%rsi
jb     1110 <reverseWord+0x10>
ret

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

LLVM IR (-O2):
define void @reverseWord(i8* %0, i8* %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i8* [ %9, %4 ], [ %0, %2 ]
%6 = phi i8* [ %10, %4 ], [ %1, %2 ]
%7 = load i8, i8* %5
%8 = load i8, i8* %6
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %8, i8* %5
%10 = getelementptr inbounds i8, i8* %6, i64 -1
store i8 %7, i8* %6
%11 = icmp ult i8* %9, %10
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *);
void rm_block_SIGUSR1(sigset_t *old_sigs) {
  if (sigprocmask(SIG_SETMASK, old_sigs, NULL) != 0) {
    perror("sigprocmask remove block\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<rm_block_SIGUSR1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
cmp    $0x0,%rax
je     1172 <rm_block_SIGUSR1+0x42>
lea    0xe9d(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rm_block_SIGUSR1>:
push   %rax
mov    %rdi,%rsi
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
test   %rax,%rax
jne    114b <rm_block_SIGUSR1+0x1b>
pop    %rax
ret
lea    0xeae(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIG_SETMASK = global i32 0
@.str = [26 x i8] c"sigprocmask remove block\0A\00"
define void @rm_block_SIGUSR1(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @SIG_SETMASK
%4 = load i32*, i32** %2
%5 = call i64 @sigprocmask(i32 %3, i32* %4, i32* null)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
@.str = [26 x i8] c"sigprocmask remove block\0A\00"
define void @rm_block_SIGUSR1(i32* %0) {
%2 = load i32, i32* @SIG_SETMASK
%3 = tail call i64 @sigprocmask(i32 %2, i32* %0, i32* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
float fromRep32(int);
float makeQNaN32(void) { return fromRep32(0x7fc00000U); }


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

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

LLVM IR (-O0):
define float @makeQNaN32() {
%1 = call float @fromRep32(i32 2143289344)
ret float %1
}

LLVM IR (-O2):
define float @makeQNaN32() {
%1 = tail call float @fromRep32(i32 2143289344)
ret float %1
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("Hello, world!");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ebc(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
int func0(void) {
  if (1)
    return (1);
  else if (2)
    return (2);
  else
    return (0);
  while (1)
    return (1);
  for (; 1;)
    return (1);
}


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

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

LLVM IR (-O0):
define i32 @func0() {
ret i32 1
}

LLVM IR (-O2):
define i32 @func0() {
ret i32 1
}
/* Variables and functions */
int csi_set_base_addr(unsigned int, unsigned long);
int bsp_csi_set_base_addr(unsigned int sel, unsigned long addr) {
  return csi_set_base_addr(sel, addr);
}


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

x86 assembly (clang, -O2):
<bsp_csi_set_base_addr>:
jmp    1030 <csi_set_base_addr@plt>

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

LLVM IR (-O2):
define i32 @bsp_csi_set_base_addr(i32 %0, i64 %1) {
%3 = tail call i32 @csi_set_base_addr(i32 %0, i64 %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
scalar_t__ eb128_compose_264(int /*<<< orphan*/ const,
                             int /*<<< orphan*/ const);
bool eb128_less_264(const uint64_t alo, const uint64_t ahi, const uint64_t blo,
                    const uint64_t bhi) {
  return eb128_compose_264(alo, ahi) < eb128_compose_264(blo, bhi);
}


x86 assembly (clang, -O0):
<eb128_less_264>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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
call   1030 <eb128_compose_264@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <eb128_compose_264@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eb128_less_264>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
call   1030 <eb128_compose_264@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <eb128_compose_264@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
setl   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @eb128_less_264(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 = call i64 @eb128_compose_264(i32 %9, i32 %10)
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i64 @eb128_compose_264(i32 %12, i32 %13)
%15 = icmp slt i64 %11, %14
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @eb128_less_264(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @eb128_compose_264(i32 %0, i32 %1)
%6 = tail call i64 @eb128_compose_264(i32 %2, i32 %3)
%7 = icmp slt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int Cdnan(double *val) {
  int code;
  short *sptr = (short *)val + 3;
  code = ((*sptr & 0x7FF0) == 0x7FF0 ? 1 : (*sptr & 0x7FF0) == 0 ? 2 : 0);
  if (code == 2)
    *val = 0.0;
  return (code != 0);
}


x86 assembly (clang, -O0):
<Cdnan>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movswl (%rax),%eax
and    $0x7ff0,%eax
cmp    $0x7ff0,%eax
jne    1138 <Cdnan+0x38>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <Cdnan+0x55>
mov    -0x18(%rbp),%rax
movswl (%rax),%edx
and    $0x7ff0,%edx
xor    %eax,%eax
mov    $0x2,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    1170 <Cdnan+0x70>
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x0,-0xc(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cdnan>:
mov    $0x7ff0,%ax
and    0x6(%rdi),%ax
jne    1111 <Cdnan+0x11>
movq   $0x0,(%rdi)
test   %ax,%ax
sete   %cl
movzwl %ax,%eax
cmp    $0x7ff0,%eax
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @Cdnan(double* %0) {
%2 = alloca double*
%3 = alloca i32
%4 = alloca i16*
store double* %0, double** %2
%5 = load double*, double** %2
%6 = bitcast double* %5 to i16*
%7 = getelementptr inbounds i16, i16* %6, i64 3
store i16* %7, i16** %4
%8 = load i16*, i16** %4
%9 = load i16, i16* %8
%10 = sext i16 %9 to i32
%11 = and i32 %10, 32752
%12 = icmp eq i32 %11, 32752
br i1 %12, label %13, label %14
13: ; preds = %1
br label %22
14: ; preds = %1
%15 = load i16*, i16** %4
%16 = load i16, i16* %15
%17 = sext i16 %16 to i32
%18 = and i32 %17, 32752
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 2, i32 0
br label %22
22: ; preds = %14, %13
%23 = phi i32 [ 1, %13 ], [ %21, %14 ]
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load double*, double** %2
store double 0.000000e+00, double* %27
br label %28
28: ; preds = %26, %22
%29 = load i32, i32* %3
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i32
ret i32 %31
}

LLVM IR (-O2):
define i32 @Cdnan(double* nocapture %0) {
%2 = bitcast double* %0 to i16*
%3 = getelementptr inbounds i16, i16* %2, i64 3
%4 = load i16, i16* %3
%5 = and i16 %4, 32752
%6 = icmp eq i16 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store double 0.000000e+00, double* %0
br label %8
8: ; preds = %7, %1
%9 = icmp eq i16 %5, 32752
%10 = or i1 %9, %6
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int S_IRUSR;
int S_IWUSR;
int S_IXUSR;
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ printf(char *);
void makeDirectory(char *directory) {
  if ((mkdir(directory, S_IRUSR | S_IWUSR | S_IXUSR)) != 0)
    printf("Error, can't create directory.\n");
}


x86 assembly (clang, -O0):
<makeDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    0x2ea0(%rip),%rax
or     (%rax),%esi
mov    0x2e9f(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     1166 <makeDirectory+0x46>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeDirectory>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2eae(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     1153 <makeDirectory+0x33>
lea    0xeb3(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@.str = [32 x i8] c"Error, can't create directory.\0A\00"
define void @makeDirectory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @S_IRUSR
%5 = load i32, i32* @S_IWUSR
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IXUSR
%8 = or i32 %6, %7
%9 = call i64 @mkdir(i8* %3, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@str = [31 x i8] c"Error, can't create directory.\00"
define void @makeDirectory(i8* nocapture %0) {
%2 = load i32, i32* @S_IRUSR
%3 = load i32, i32* @S_IWUSR
%4 = or i32 %3, %2
%5 = load i32, i32* @S_IXUSR
%6 = or i32 %4, %5
%7 = tail call i64 @mkdir(i8* %0, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
ret void
}
/* Type definitions */
struct rig_t {
  int dummy;
};

/* Variables and functions */
int post_event(struct rig_t *, int /*<<< orphan*/);
int rig_awaken(struct rig_t *rig) { return post_event(rig, 0); }


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

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

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

LLVM IR (-O2):
%struct.rig_t = type { i32 }
define i32 @rig_awaken(%struct.rig_t* %0) {
%2 = tail call i32 @post_event(%struct.rig_t* %0, i32 0)
ret i32 %2
}
void console_render(void) {}


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

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

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

LLVM IR (-O2):
define void @console_render() {
ret void
}
void stress_set_proc_name_init(int argc, char *argv[], char *envp[]) {
  (void)argc;
  (void)argv;
  (void)envp;
}


x86 assembly (clang, -O0):
<stress_set_proc_name_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @stress_set_proc_name_init(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load i8**, i8*** %6
ret void
}

LLVM IR (-O2):
define void @stress_set_proc_name_init(i32 %0, i8** nocapture %1, i8** nocapture %2) {
ret void
}
/* Type definitions */
typedef int __le16;

/* Variables and functions */
int cpu_to_le16(int);
int ieee80211_has_tods(__le16 fc) { return (fc & cpu_to_le16(0x0100)) != 0; }


x86 assembly (clang, -O0):
<ieee80211_has_tods>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x100,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee80211_has_tods>:
push   %rbx
mov    %edi,%ebx
mov    $0x100,%edi
call   1030 <cpu_to_le16@plt>
xor    %ecx,%ecx
test   %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ieee80211_has_tods(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cpu_to_le16(i32 256)
%5 = and i32 %3, %4
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @ieee80211_has_tods(i32 %0) {
%2 = tail call i32 @cpu_to_le16(i32 256)
%3 = and i32 %2, %0
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ SYS_exit;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int);
void exit(int status) {
  ;
  syscall(SYS_exit, status);
  abort();
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
call   1040 <syscall@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<exit>:
push   %rax
mov    %edi,%esi
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
call   1040 <syscall@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@SYS_exit = global i32 0
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SYS_exit
%4 = load i32, i32* %2
%5 = call i32 @syscall(i32 %3, i32 %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@SYS_exit = global i32 0
define void @exit(i32 %0) {
%2 = load i32, i32* @SYS_exit
%3 = tail call i32 @syscall(i32 %2, i32 %0)
%4 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int core1_safe(char const *);
int U_EMRPOLYBEZIER_safe(const char *record) { return (core1_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMRPOLYBEZIER_safe>:
jmp    1030 <core1_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRPOLYBEZIER_safe(i8* %0) {
%2 = tail call i32 @core1_safe(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int execvp(char *, char **);
int main(int argc, char **argv) {
  for (int i = 3; i < 1024; i++)
    close(i);
  return execvp(argv[1], &argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x400,-0x14(%rbp)
jge    1160 <main+0x40>
mov    -0x14(%rbp),%edi
call   1030 <close@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <execvp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    $0x3,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <close@plt>
add    $0x1,%ebp
cmp    $0x400,%ebp
jne    1130 <main+0x10>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <execvp@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
br label %7
3: ; preds = %7
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @execvp(i8* %5, i8** %4)
ret i32 %6
7: ; preds = %2, %7
%8 = phi i32 [ 3, %2 ], [ %10, %7 ]
%9 = tail call i32 @close(i32 %8)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, 1024
br i1 %11, label %3, label %7
}
void rop3_190_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T ^ S;
  stk1 = *D | stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_190_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_190_1_0>:
xor    %esi,%edx
mov    (%rdi),%al
or     %al,%dl
xor    %dl,%al
and    %sil,%al
xor    %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_190_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = xor i32 %10, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %8
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = or i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = load i8, i8* %5
%25 = zext i8 %24 to i32
%26 = xor i32 %25, -1
%27 = and i32 %23, %26
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i8, i8* %5
%32 = zext i8 %31 to i32
%33 = and i32 %30, %32
%34 = or i32 %27, %33
%35 = trunc i32 %34 to i8
%36 = load i8*, i8** %4
store i8 %35, i8* %36
ret void
}

LLVM IR (-O2):
define void @rop3_190_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %2, %1
%5 = load i8, i8* %0
%6 = or i8 %5, %4
%7 = xor i8 %1, -1
%8 = and i8 %6, %7
%9 = and i8 %5, %1
%10 = or i8 %8, %9
store i8 %10, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ selfn_strdup(char **, char *);
int /*<<< orphan*/ uinttostr_noalloc(char *, int, unsigned int const);
char *uinttostr(const unsigned val) {
  char buf[16], *str = NULL;
  (void)uinttostr_noalloc(buf, sizeof(buf), val);
  selfn_strdup(&str, buf);
  return str;
}


x86 assembly (clang, -O0):
<uinttostr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    $0x10,%esi
call   1040 <uinttostr_noalloc@plt>
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdi
call   1030 <selfn_strdup@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uinttostr>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%edx
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <uinttostr_noalloc@plt>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <selfn_strdup@plt>
mov    0x8(%rsp),%rax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @uinttostr(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x i8]
%4 = alloca i8*
store i32 %0, i32* %2
store i8* null, i8** %4
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 @uinttostr_noalloc(i8* %5, i32 16, i32 %6)
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%9 = call i32 @selfn_strdup(i8** %4, i8* %8)
%10 = load i8*, i8** %4
ret i8* %10
}

LLVM IR (-O2):
define i8* @uinttostr(i32 %0) {
%2 = alloca [16 x i8]
%3 = alloca i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = call i32 @uinttostr_noalloc(i8* %4, i32 16, i32 %0)
%7 = call i32 @selfn_strdup(i8** %3, i8* %4)
%8 = load i8*, i8** %3
ret i8* %8
}