#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 */

/* Variables and functions */
int /*<<< orphan*/ discardUnnecessaryInput();
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, float *, float *);
float Division(float a, float b) {
  while (b == 0) {
    printf("\nThis is- divide by zero error, which is invalid.\n");
    printf("\nPlease re-enter your numbers,seperated by a space: ");
    while (2 != scanf("%f %f", &a, &b)) {
      printf("\nError reading your numbers, please re-enter both numbers: ");
      discardUnnecessaryInput();
    }
  }
  printf("\nResult of Division %.2f and %.2f is %.2f.", a, b, a / b);
  return a / b;
}


x86 assembly (clang, -O0):
<Division>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11b7 <Division+0x87>
jp     11b7 <Division+0x87>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
je     11b2 <Division+0x82>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <discardUnnecessaryInput@plt>
jmp    1175 <Division+0x45>
jmp    1142 <Division+0x12>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x4(%rbp),%xmm2
divss  -0x8(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xecc(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Division>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
movss  %xmm1,(%rsp)
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jne    11ec <Division+0xac>
jp     11ec <Division+0xac>
lea    0xf37(%rip),%r14
lea    0xe8e(%rip),%r15
lea    0xebc(%rip),%r12
lea    0x4(%rsp),%r13
mov    %rsp,%rbx
lea    0xeb3(%rip),%rbp
jmp    11a0 <Division+0x60>
xchg   %ax,%ax
movss  (%rsp),%xmm1
ucomiss 0xe64(%rip),%xmm1
jne    11e6 <Division+0xa6>
jp     11e6 <Division+0xa6>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
je     1190 <Division+0x50>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <discardUnnecessaryInput@plt>
jmp    11c0 <Division+0x80>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm4
cvtss2sd %xmm1,%xmm3
divss  %xmm1,%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
lea    0xe75(%rip),%rdi
movaps %xmm4,%xmm0
movaps %xmm3,%xmm1
mov    $0x3,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
divss  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"\0AThis is- divide by zero error, which is invalid.\0A\00"
@.str.1 = [53 x i8] c"\0APlease re-enter your numbers,seperated by a space: \00"
@.str.2 = [6 x i8] c"%f %f\00"
@.str.3 = [60 x i8] c"\0AError reading your numbers, please re-enter both numbers: \00"
@.str.4 = [43 x i8] c"\0AResult of Division %.2f and %.2f is %.2f.\00"
define float @Division(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
br label %5
5: ; preds = %17, %2
%6 = load float, float* %4
%7 = fcmp oeq float %6, 0.000000e+00
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %14, %8
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), float* %3, float* %4)
%13 = icmp ne i32 2, %12
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (...) @discardUnnecessaryInput()
br label %11
17: ; preds = %11
br label %5
18: ; preds = %5
%19 = load float, float* %3
%20 = fpext float %19 to double
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = load float, float* %3
%24 = load float, float* %4
%25 = fdiv float %23, %24
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), double %20, double %22, double %26)
%28 = load float, float* %3
%29 = load float, float* %4
%30 = fdiv float %28, %29
ret float %30
}

LLVM IR (-O2):
@.str.1 = [53 x i8] c"\0APlease re-enter your numbers,seperated by a space: \00"
@.str.2 = [6 x i8] c"%f %f\00"
@.str.3 = [60 x i8] c"\0AError reading your numbers, please re-enter both numbers: \00"
@.str.4 = [43 x i8] c"\0AResult of Division %.2f and %.2f is %.2f.\00"
@str = [50 x i8] c"\0AThis is- divide by zero error, which is invalid.\00"
define float @Division(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = fcmp oeq float %1, 0.000000e+00
br i1 %5, label %9, label %21
6: ; preds = %14, %9
%7 = load float, float* %4
%8 = fcmp oeq float %7, 0.000000e+00
br i1 %8, label %9, label %19
9: ; preds = %2, %6
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), float* %3, float* %4)
%13 = icmp eq i32 %12, 2
br i1 %13, label %6, label %14
14: ; preds = %9, %14
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (...) @discardUnnecessaryInput()
%17 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), float* %3, float* %4)
%18 = icmp eq i32 %17, 2
br i1 %18, label %6, label %14
19: ; preds = %6
%20 = load float, float* %3
br label %21
21: ; preds = %19, %2
%22 = phi float [ %0, %2 ], [ %20, %19 ]
%23 = phi float [ %1, %2 ], [ %7, %19 ]
%24 = fpext float %22 to double
%25 = fpext float %23 to double
%26 = fdiv float %22, %23
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), double %24, double %25, double %27)
%29 = load float, float* %3
%30 = load float, float* %4
%31 = fdiv float %29, %30
ret float %31
}