#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*/ printf(char *, ...);
int scanf(char *, double *);
int main(void) {
  double first, second;
  printf("Enter your first float number (q to exit):\n");
  while (scanf("%lf", &first) == 1) {
    printf("Enter your second float number (q to exit):\n");
    while (scanf("%lf", &second) == 1) {
      printf("The result is %f\n", (first - second) / (first * second));
      break;
    }
    printf("Enter your first float number (q to exit):\n");
  }
  printf("Thank you!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11b6 <main+0x96>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11a3 <main+0x83>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xec1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11e8 <main+0xb8>
lea    0xeb6(%rip),%r14
lea    0xe8e(%rip),%rbx
lea    0x10(%rsp),%r15
lea    0xe86(%rip),%r12
lea    0xec8(%rip),%r13
lea    0x8(%rsp),%rbp
jmp    11a8 <main+0x78>
nopl   0x0(%rax)
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11e8 <main+0xb8>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1190 <main+0x60>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1190 <main+0x60>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Enter your first float number (q to exit):\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [45 x i8] c"Enter your second float number (q to exit):\0A\00"
@.str.3 = [18 x i8] c"The result is %f\0A\00"
@.str.4 = [12 x i8] c"Thank you!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %22, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load double, double* %2
%15 = load double, double* %3
%16 = fsub double %14, %15
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fmul double %17, %18
%20 = fdiv double %16, %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %20)
br label %22
22: ; preds = %13, %10
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %5
24: ; preds = %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.3 = [18 x i8] c"The result is %f\0A\00"
@str.5 = [11 x i8] c"Thank you!\00"
@str.6 = [44 x i8] c"Enter your second float number (q to exit):\00"
@str.7 = [43 x i8] c"Enter your first float number (q to exit):\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.7, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %23
8: ; preds = %0, %19
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load double, double* %1
%14 = load double, double* %2
%15 = fsub double %13, %14
%16 = fmul double %13, %14
%17 = fdiv double %15, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %17)
br label %19
19: ; preds = %12, %8
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.7, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%22 = icmp eq i32 %21, 1
br i1 %22, label %8, label %23
23: ; preds = %19, %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}