#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ divisor(unsigned long, float);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned long);
scalar_t__ naturalNumber(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, unsigned long *);
void divisionToFile(float a) {
  FILE *f = fopen("divisionResult", "wb+");
  unsigned long i, c;
  char line[100];
  if (f == NULL) {
    printf("\nError loading file!\n");
    exit(EXIT_FAILURE);
  }
  if (naturalNumber(a)) {
    for (i = 0; i < a + 1; i++) {
      if (divisor(i, a)) {
        fprintf(f, "%lu\n", i);
      }
    }
    rewind(f);
  }
  while (fgets(line, 100, f) != NULL) {
    sscanf(line, "%lu", &c);
    printf("%lu\n", c);
  }
  fclose(f);
}


x86 assembly (clang, -O0):
<divisionToFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movss  %xmm0,-0x4(%rbp)
lea    0xe4d(%rip),%rdi
lea    0xe55(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11ee <divisionToFile+0x4e>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
movss  -0x4(%rbp),%xmm0
call   10b0 <naturalNumber@plt>
cmp    $0x0,%rax
je     12bc <divisionToFile+0x11c>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x98(%rbp)
ff
test   %rax,%rax
movss  %xmm0,-0x94(%rbp)
ff
js     1253 <divisionToFile+0xb3>
movss  -0x98(%rbp),%xmm0
ff
movss  %xmm0,-0x94(%rbp)
ff
movss  -0x94(%rbp),%xmm1
ff
movss  0xd9d(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    12b3 <divisionToFile+0x113>
mov    -0x18(%rbp),%rdi
movss  -0x4(%rbp),%xmm0
call   1070 <divisor@plt>
cmp    $0x0,%rax
je     129d <divisionToFile+0xfd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd95(%rip),%rsi
call   1080 <fprintf@plt>
jmp    12a2 <divisionToFile+0x102>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    120a <divisionToFile+0x6a>
mov    -0x10(%rbp),%rdi
call   1050 <rewind@plt>
jmp    12c1 <divisionToFile+0x121>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     130e <divisionToFile+0x16e>
lea    -0x90(%rbp),%rdi
lea    0xd44(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1090 <sscanf@plt>
mov    -0x20(%rbp),%rsi
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c1 <divisionToFile+0x121>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisionToFile>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
movss  %xmm0,(%rsp)
lea    0xe38(%rip),%rdi
lea    0xe40(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     130b <divisionToFile+0x15b>
mov    %rax,%r14
movss  (%rsp),%xmm0
call   10c0 <naturalNumber@plt>
test   %rax,%rax
je     128d <divisionToFile+0xdd>
movss  0xe01(%rip),%xmm1
movss  (%rsp),%xmm2
addss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
movss  %xmm1,0x4(%rsp)
ucomiss %xmm0,%xmm1
jbe    1285 <divisionToFile+0xd5>
movaps %xmm2,%xmm0
xor    %ebx,%ebx
lea    0xdf5(%rip),%r15
jmp    1248 <divisionToFile+0x98>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorps  %xmm1,%xmm1
cvtsi2ss %rbx,%xmm1
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm2
ucomiss %xmm1,%xmm2
jbe    1285 <divisionToFile+0xd5>
mov    %rbx,%rdi
call   1080 <divisor@plt>
test   %rax,%rax
je     1263 <divisionToFile+0xb3>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1090 <fprintf@plt>
add    $0x1,%rbx
jns    1230 <divisionToFile+0x80>
mov    %rbx,%rax
shr    %rax
mov    %ebx,%ecx
and    $0x1,%ecx
or     %rax,%rcx
xorps  %xmm1,%xmm1
cvtsi2ss %rcx,%xmm1
addss  %xmm1,%xmm1
jmp    1238 <divisionToFile+0x88>
mov    %r14,%rdi
call   1060 <rewind@plt>
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     12f2 <divisionToFile+0x142>
lea    0xd71(%rip),%r15
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r12
lea    0xd5b(%rip),%r13
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   10a0 <sscanf@plt>
mov    0x8(%rsp),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
jne    12c0 <divisionToFile+0x110>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xd0e(%rip),%rdi
call   1030 <puts@plt>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"divisionResult\00"
@.str.1 = [4 x i8] c"wb+\00"
@.str.2 = [22 x i8] c"\0AError loading file!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [5 x i8] c"%lu\0A\00"
@.str.4 = [4 x i8] c"%lu\00"
define void @divisionToFile(float %0) {
%2 = alloca float
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca [100 x i8]
store float %0, float* %2
%7 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %3
%8 = load i32*, i32** %3
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load float, float* %2
%16 = call i64 @naturalNumber(float %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %41
18: ; preds = %14
store i64 0, i64* %4
br label %19
19: ; preds = %35, %18
%20 = load i64, i64* %4
%21 = uitofp i64 %20 to float
%22 = load float, float* %2
%23 = fadd float %22, 1.000000e+00
%24 = fcmp olt float %21, %23
br i1 %24, label %25, label %38
25: ; preds = %19
%26 = load i64, i64* %4
%27 = load float, float* %2
%28 = call i64 @divisor(i64 %26, float %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %25
%31 = load i32*, i32** %3
%32 = load i64, i64* %4
%33 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 %32)
br label %34
34: ; preds = %30, %25
br label %35
35: ; preds = %34
%36 = load i64, i64* %4
%37 = add i64 %36, 1
store i64 %37, i64* %4
br label %19
38: ; preds = %19
%39 = load i32*, i32** %3
%40 = call i32 @rewind(i32* %39)
br label %41
41: ; preds = %38, %14
br label %42
42: ; preds = %47, %41
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%44 = load i32*, i32** %3
%45 = call i32* @fgets(i8* %43, i32 100, i32* %44)
%46 = icmp ne i32* %45, null
br i1 %46, label %47, label %52
47: ; preds = %42
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%49 = call i32 @sscanf(i8* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64* %5)
%50 = load i64, i64* %5
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 %50)
br label %42
52: ; preds = %42
%53 = load i32*, i32** %3
%54 = call i32 @fclose(i32* %53)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"divisionResult\00"
@.str.1 = [4 x i8] c"wb+\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [5 x i8] c"%lu\0A\00"
@.str.4 = [4 x i8] c"%lu\00"
@str = [21 x i8] c"\0AError loading file!\00"
define void @divisionToFile(float %0) {
%2 = alloca i64
%3 = alloca [100 x i8]
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i64* %2 to i8*
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = icmp eq i32* %4, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
%13 = tail call i64 @naturalNumber(float %0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %30, label %15
15: ; preds = %12
%16 = fadd float %0, 1.000000e+00
%17 = fcmp ogt float %16, 0.000000e+00
br i1 %17, label %18, label %28
18: ; preds = %15, %24
%19 = phi i64 [ %25, %24 ], [ 0, %15 ]
%20 = tail call i64 @divisor(i64 %19, float %0)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 %19)
br label %24
24: ; preds = %18, %22
%25 = add i64 %19, 1
%26 = uitofp i64 %25 to float
%27 = fcmp ogt float %16, %26
br i1 %27, label %18, label %28
28: ; preds = %24, %15
%29 = tail call i32 @rewind(i32* %4)
br label %30
30: ; preds = %28, %12
%31 = call i32* @fgets(i8* %6, i32 100, i32* %4)
%32 = icmp eq i32* %31, null
br i1 %32, label %39, label %33
33: ; preds = %30, %33
%34 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64* %2)
%35 = load i64, i64* %2
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 %35)
%37 = call i32* @fgets(i8* %6, i32 100, i32* %4)
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %33
39: ; preds = %33, %30
%40 = call i32 @fclose(i32* %4)
ret void
}