#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 *, double *);
int main(void) {
  double a, b;
  printf("Enter a\&b:\n");
  while (scanf("%lf%lf", &a, &b) == 2) {
    printf("%.3g - %.3g / %.3g * %.3g = %.3g .\n", a, b, a, b,
           (double)(a - b) / (a * b));
    printf("\n");
    printf("Enter a\&b:\n");
  }
  printf("done!");
  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    0xec8(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    11b5 <main+0x95>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm4
subsd  -0x18(%rbp),%xmm4
movsd  -0x10(%rbp),%xmm5
mulsd  -0x18(%rbp),%xmm5
divsd  %xmm5,%xmm4
lea    0xe86(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xedd(%rip),%rdi
call   1040 <puts@plt>
lea    0xea0(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
jne    11e6 <main+0xa6>
lea    0xe8e(%rip),%r14
lea    0xeb1(%rip),%r15
lea    0xe79(%rip),%r12
lea    0x8(%rsp),%r13
mov    %rsp,%rbx
nop
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
movapd %xmm0,%xmm4
subsd  %xmm1,%xmm4
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm2,%xmm4
mov    %r14,%rdi
movapd %xmm0,%xmm2
movapd %xmm1,%xmm3
mov    $0x5,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
je     1190 <main+0x50>
lea    0xe3e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Enter a&b:\0A\00"
@.str.1 = [7 x i8] c"%lf%lf\00"
@.str.2 = [36 x i8] c"%.3g - %.3g / %.3g * %.3g = %.3g .\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [6 x i8] c"done!\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 ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %8, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load double, double* %2
%10 = load double, double* %3
%11 = load double, double* %2
%12 = load double, double* %3
%13 = load double, double* %2
%14 = load double, double* %3
%15 = fsub double %13, %14
%16 = load double, double* %2
%17 = load double, double* %3
%18 = fmul double %16, %17
%19 = fdiv double %15, %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %9, double %10, double %11, double %12, double %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %5
23: ; preds = %5
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%lf%lf\00"
@.str.2 = [36 x i8] c"%.3g - %.3g / %.3g * %.3g = %.3g .\0A\00"
@.str.4 = [6 x i8] c"done!\00"
@str.5 = [11 x i8] c"Enter a&b:\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 ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %19
8: ; preds = %0, %8
%9 = load double, double* %1
%10 = load double, double* %2
%11 = fsub double %9, %10
%12 = fmul double %9, %10
%13 = fdiv double %11, %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %9, double %10, double %9, double %10, double %13)
%15 = call i32 @putchar(i32 10)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2)
%18 = icmp eq i32 %17, 2
br i1 %18, label %8, label %19
19: ; preds = %8, %0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}