#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 /*<<< orphan*/ scanf(char *, float *, ...);
int main() {
  float len, bre, rad;
  float peri, circum, area_rec, area_circle;
  printf("Enter the length and breadth of rectangel: ");
  scanf("%f %f", &len, &bre);
  area_rec = len * bre;
  peri = 2 * (len + bre);
  printf("Rectangle:\nArea = %f\nPerimeter = %f\n", area_rec, peri);
  printf("Enter the radius of circle: ");
  scanf("%f", &rad);
  area_circle = 3.14 * rad * rad;
  circum = 2 * 3.14 * rad;
  printf("Circle:\nArea = %f\nCircumference = %f\n", area_circle, circum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm1
addss  -0xc(%rbp),%xmm1
movss  0xe9c(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeb0(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe3a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe07(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe69(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x14(%rsp),%xmm1
movss  0x10(%rsp),%xmm0
movaps %xmm1,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm0,%xmm1
addss  %xmm1,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xecb(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4f(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
mulsd  0xe43(%rip),%xmm0
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xea3(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Enter the length and breadth of rectangel: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [37 x i8] c"Rectangle:\0AArea = %f\0APerimeter = %f\0A\00"
@.str.3 = [29 x i8] c"Enter the radius of circle: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [38 x i8] c"Circle:\0AArea = %f\0ACircumference = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3)
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fmul float %11, %12
store float %13, float* %7
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fadd float %14, %15
%17 = fmul float 2.000000e+00, %16
store float %17, float* %5
%18 = load float, float* %7
%19 = fpext float %18 to double
%20 = load float, float* %5
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %19, double %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %4)
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = fmul double 3.140000e+00, %26
%28 = load float, float* %4
%29 = fpext float %28 to double
%30 = fmul double %27, %29
%31 = fptrunc double %30 to float
store float %31, float* %8
%32 = load float, float* %4
%33 = fpext float %32 to double
%34 = fmul double 6.280000e+00, %33
%35 = fptrunc double %34 to float
store float %35, float* %6
%36 = load float, float* %8
%37 = fpext float %36 to double
%38 = load float, float* %6
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), double %37, double %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"Enter the length and breadth of rectangel: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [37 x i8] c"Rectangle:\0AArea = %f\0APerimeter = %f\0A\00"
@.str.3 = [29 x i8] c"Enter the radius of circle: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [38 x i8] c"Circle:\0AArea = %f\0ACircumference = %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = fmul float %9, %10
%12 = fadd float %9, %10
%13 = fmul float %12, 2.000000e+00
%14 = fpext float %11 to double
%15 = fpext float %13 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %14, double %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%19 = load float, float* %3
%20 = fpext float %19 to double
%21 = fmul double %20, 3.140000e+00
%22 = fmul double %21, %20
%23 = fptrunc double %22 to float
%24 = fmul double %20, 6.280000e+00
%25 = fptrunc double %24 to float
%26 = fpext float %23 to double
%27 = fpext float %25 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), double %26, double %27)
ret i32 0
}