#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 *, ...);
char scanf(char *, long double *, long double *, long double *);
int main() {
  long double a, b, c, sum;
  printf("PLease enter three numbers separated with space: ");
  char matches = scanf("%llf %llf %llf", &a, &b, &c);
  if (matches != 3) {
    printf("Incorrect input\n");
    return -1;
  }
  sum = a + b + c;
  printf("%.2Lf + %.2Lf + %.2Lf = %.2Lf\n", a, b, c, sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1040 <scanf@plt>
mov    %al,-0x51(%rbp)
movsbl -0x51(%rbp),%eax
cmp    $0x3,%eax
je     1182 <main+0x62>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c1 <main+0xa1>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
faddp  %st,%st(1)
fldt   -0x40(%rbp)
faddp  %st,%st(1)
fstpt  -0x50(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
fldt   -0x50(%rbp)
mov    %rsp,%rax
fstpt  0x30(%rax)
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0x60(%rsp),%rsi
lea    0x50(%rsp),%rdx
lea    0x40(%rsp),%rcx
call   1050 <scanf@plt>
cmp    $0x3,%al
jne    1197 <main+0x67>
fldt   0x60(%rsp)
fldt   0x50(%rsp)
fld    %st(1)
fadd   %st(1),%st
fldt   0x40(%rsp)
fadd   %st,%st(1)
fxch   %st(1)
fstpt  0x30(%rsp)
fstpt  0x20(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a8 <main+0x78>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"PLease enter three numbers separated with space: \00"
@.str.1 = [15 x i8] c"%llf %llf %llf\00"
@.str.2 = [17 x i8] c"Incorrect input\0A\00"
@.str.3 = [31 x i8] c"%.2Lf + %.2Lf + %.2Lf = %.2Lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca i8
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%8 = call signext i8 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), x86_fp80* %2, x86_fp80* %3, x86_fp80* %4)
store i8 %8, i8* %6
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %25
14: ; preds = %0
%15 = load x86_fp80, x86_fp80* %2
%16 = load x86_fp80, x86_fp80* %3
%17 = fadd x86_fp80 %15, %16
%18 = load x86_fp80, x86_fp80* %4
%19 = fadd x86_fp80 %17, %18
store x86_fp80 %19, x86_fp80* %5
%20 = load x86_fp80, x86_fp80* %2
%21 = load x86_fp80, x86_fp80* %3
%22 = load x86_fp80, x86_fp80* %4
%23 = load x86_fp80, x86_fp80* %5
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %20, x86_fp80 %21, x86_fp80 %22, x86_fp80 %23)
store i32 0, i32* %1
br label %25
25: ; preds = %14, %12
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [50 x i8] c"PLease enter three numbers separated with space: \00"
@.str.1 = [15 x i8] c"%llf %llf %llf\00"
@.str.3 = [31 x i8] c"%.2Lf + %.2Lf + %.2Lf = %.2Lf\0A\00"
@str = [16 x i8] c"Incorrect input\00"
define i32 @main() {
%1 = alloca x86_fp80
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = bitcast x86_fp80* %1 to i8*
%5 = bitcast x86_fp80* %2 to i8*
%6 = bitcast x86_fp80* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%8 = call signext i8 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), x86_fp80* %1, x86_fp80* %2, x86_fp80* %3)
%9 = icmp eq i8 %8, 3
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %19
12: ; preds = %0
%13 = load x86_fp80, x86_fp80* %1
%14 = load x86_fp80, x86_fp80* %2
%15 = fadd x86_fp80 %13, %14
%16 = load x86_fp80, x86_fp80* %3
%17 = fadd x86_fp80 %15, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %13, x86_fp80 %14, x86_fp80 %16, x86_fp80 %17)
br label %19
19: ; preds = %12, %10
%20 = phi i32 [ -1, %10 ], [ 0, %12 ]
ret i32 %20
}