#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);
int main(void) {
  int width = 3;
  int height = 5;
  printf("Area      = %d\n", width * height);
  printf("Perimeter = %d\n", 2 * width + 2 * height);
  float w = 6.8;
  float h = 2.3;
  printf("Area      = %.3f\n", w * h);
  printf("Perimeter = %.3f\n", 2 * w + 2 * h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    %eax,%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
movss  0xea6(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe95(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
movss  0xe65(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x12,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Area = %d\0A\00"
@.str.1 = [16 x i8] c"Perimeter = %d\0A\00"
@.str.2 = [18 x i8] c"Area = %.3f\0A\00"
@.str.3 = [18 x i8] c"Perimeter = %.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store i32 3, i32* %2
store i32 5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = mul nsw i32 %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = mul nsw i32 2, %10
%12 = load i32, i32* %3
%13 = mul nsw i32 2, %12
%14 = add nsw i32 %11, %13
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %14)
store float 0x401B333340000000, float* %4
store float 0x4002666660000000, float* %5
%16 = load float, float* %4
%17 = load float, float* %5
%18 = fmul float %16, %17
%19 = fptosi float %18 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load float, float* %4
%22 = load float, float* %5
%23 = fmul float 2.000000e+00, %22
%24 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %21, float %23)
%25 = fptosi float %24 to i32
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Area = %d\0A\00"
@.str.1 = [16 x i8] c"Perimeter = %d\0A\00"
@.str.2 = [18 x i8] c"Area = %.3f\0A\00"
@.str.3 = [18 x i8] c"Perimeter = %.3f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 16)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 15)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 18)
ret i32 0
}