#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*/ calculation(double, double);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *, double *);
int main(void) {
  double num1, num2;
  printf("Enter a pair of floating-point numbers, ");
  printf("or q to exit.\n");
  while (scanf("%lf %lf", &num1, &num2) == 2) {
    printf("(%lf - %lf) / (%lf * %lf) = %lf\n", num1, num2, num1, num2,
           calculation(num1, num2));
    printf("Enter the next pair of floating-point numbers: ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11e6 <main+0xb6>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <calculation@plt>
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
mov    %eax,%esi
lea    0xe74(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    115b <main+0x2b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf20(%rip),%rdi
call   1040 <puts@plt>
lea    0xebb(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
jne    11f7 <main+0xb7>
lea    0xeaa(%rip),%r14
lea    0xec4(%rip),%r15
lea    0xe94(%rip),%r12
lea    0x8(%rsp),%r13
mov    %rsp,%rbx
nopl   (%rax)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
call   1030 <calculation@plt>
mov    %r14,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
movaps %xmm1,%xmm3
mov    %eax,%esi
mov    $0x4,%al
call   1050 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
je     11a0 <main+0x60>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Enter a pair of floating-point numbers, \00"
@.str.1 = [15 x i8] c"or q to exit.\0A\00"
@.str.2 = [8 x i8] c"%lf %lf\00"
@.str.3 = [33 x i8] c"(%lf - %lf) / (%lf * %lf) = %lf\0A\00"
@.str.4 = [48 x i8] c"Enter the next pair of floating-point numbers: \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 ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %9, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double* %2, double* %3)
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load double, double* %2
%11 = load double, double* %3
%12 = load double, double* %2
%13 = load double, double* %3
%14 = load double, double* %2
%15 = load double, double* %3
%16 = call i32 @calculation(double %14, double %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), double %10, double %11, double %12, double %13, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Enter a pair of floating-point numbers, \00"
@.str.2 = [8 x i8] c"%lf %lf\00"
@.str.3 = [33 x i8] c"(%lf - %lf) / (%lf * %lf) = %lf\0A\00"
@.str.4 = [48 x i8] c"Enter the next pair of floating-point numbers: \00"
@str = [14 x i8] c"or 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double* %1, double* %2)
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %17
9: ; preds = %0, %9
%10 = load double, double* %1
%11 = load double, double* %2
%12 = call i32 @calculation(double %10, double %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), double %10, double %11, double %10, double %11, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double* %1, double* %2)
%16 = icmp eq i32 %15, 2
br i1 %16, label %9, label %17
17: ; preds = %9, %0
ret i32 0
}