#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(int, 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 *, int);
scalar_t__ naturalNumber(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
void divisionToFile(float a) {
  FILE *f = fopen("divisionResult", "wb+");
  int 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, "%d\n", i);
      }
    }
    rewind(f);
  }
  while (fgets(line, 100, f) != NULL) {
    sscanf(line, "%d", &c);
    printf("%d\n", c);
  }
  fclose(f);
}


x86 assembly (clang, -O0):
<divisionToFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%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     126a <divisionToFile+0xca>
movl   $0x0,-0x14(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm1
movss  0xdea(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1261 <divisionToFile+0xc1>
mov    -0x14(%rbp),%edi
movss  -0x4(%rbp),%xmm0
call   1070 <divisor@plt>
cmp    $0x0,%rax
je     124e <divisionToFile+0xae>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xde4(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1253 <divisionToFile+0xb3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1209 <divisionToFile+0x69>
mov    -0x10(%rbp),%rdi
call   1050 <rewind@plt>
jmp    126f <divisionToFile+0xcf>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     12b5 <divisionToFile+0x115>
lea    -0x80(%rbp),%rdi
lea    0xd9b(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1090 <sscanf@plt>
mov    -0x18(%rbp),%esi
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    126f <divisionToFile+0xcf>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisionToFile>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
movss  %xmm0,0x4(%rsp)
lea    0xe37(%rip),%rdi
lea    0xe3f(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12ea <divisionToFile+0x13a>
mov    %rax,%r15
movss  0x4(%rsp),%xmm0
call   10c0 <naturalNumber@plt>
test   %rax,%rax
je     126e <divisionToFile+0xbe>
movss  0xe03(%rip),%xmm1
movss  0x4(%rsp),%xmm2
addss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
movss  %xmm1,0x8(%rsp)
ucomiss %xmm0,%xmm1
jbe    1266 <divisionToFile+0xb6>
movaps %xmm2,%xmm0
xor    %ebx,%ebx
lea    0xdf6(%rip),%r14
jmp    124b <divisionToFile+0x9b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
jbe    1266 <divisionToFile+0xb6>
mov    %ebx,%edi
call   1080 <divisor@plt>
test   %rax,%rax
je     1230 <divisionToFile+0x80>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1090 <fprintf@plt>
jmp    1230 <divisionToFile+0x80>
mov    %r15,%rdi
call   1060 <rewind@plt>
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     12d1 <divisionToFile+0x121>
lea    0xd8f(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r12
lea    0xd7a(%rip),%r13
nopl   (%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   10a0 <sscanf@plt>
mov    0xc(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
jne    12a0 <divisionToFile+0xf0>
mov    %r15,%rdi
call   1040 <fclose@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xd2d(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ce3(%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 = [4 x i8] c"%d\0A\00"
@.str.4 = [3 x i8] c"%d\00"
define void @divisionToFile(float %0) {
%2 = alloca float
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%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 i32 0, i32* %4
br label %19
19: ; preds = %35, %18
%20 = load i32, i32* %4
%21 = sitofp i32 %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 i32, i32* %4
%27 = load float, float* %2
%28 = call i64 @divisor(i32 %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 i32, i32* %4
%33 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %30, %25
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %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 ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%50 = load i32, i32* %5
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %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 = [4 x i8] c"%d\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@str = [21 x i8] c"\0AError loading file!\00"
define void @divisionToFile(float %0) {
%2 = alloca i32
%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 i32* %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 i32 [ %25, %24 ], [ 0, %15 ]
%20 = tail call i64 @divisor(i32 %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 ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %24
24: ; preds = %18, %22
%25 = add nuw nsw i32 %19, 1
%26 = sitofp i32 %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 ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %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
}