#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 EXIT_SUCCESS;
int /*<<< orphan*/ checkInput(double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double width, height;
  double area, perimeter;
  printf("Enter width and height: ");
  checkInput(&width, &height);
  area = width * height;
  perimeter = (2 * width) + (2 * height);
  printf("The perimeter = %.1lf and area = %.1lf", perimeter, area);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <checkInput@plt>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe98(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <checkInput@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm2
addsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter width and height: \00"
@.str.1 = [39 x i8] c"The perimeter = %.1lf and area = %.1lf\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @checkInput(double* %2, double* %3)
%8 = load double, double* %2
%9 = load double, double* %3
%10 = fmul double %8, %9
store double %10, double* %4
%11 = load double, double* %2
%12 = load double, double* %3
%13 = fmul double 2.000000e+00, %12
%14 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %11, double %13)
store double %14, double* %5
%15 = load double, double* %5
%16 = load double, double* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), double %15, double %16)
%18 = load i32, i32* @EXIT_SUCCESS
ret i32 %18
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter width and height: \00"
@.str.1 = [39 x i8] c"The perimeter = %.1lf and area = %.1lf\00"
@EXIT_SUCCESS = global i32 0
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 ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @checkInput(double* %1, double* %2)
%7 = load double, double* %1
%8 = load double, double* %2
%9 = fmul double %7, %8
%10 = fmul double %8, 2.000000e+00
%11 = call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), double %11, double %9)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}