#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 *, float *);
int main(void) {
  float length, width;
  printf("Enter the length of the rectangle: \n");
  while (scanf("%f", &length) == 1) {
    printf("Length = %0.2f: \n", length);
    printf("Enter its width: \n");
    if (scanf("%f", &width) != 1)
      break;
    printf("Width = %0.2f: \n", width);
    printf("Area = %0.2f: \n", length * width);
    printf("Enter the length of the rectangle: \n");
  }
  printf("Done.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11df <main+0xbf>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1199 <main+0x79>
jmp    11df <main+0xbf>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe99(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1208 <main+0xd8>
lea    0xed6(%rip),%r15
lea    0xe93(%rip),%rbx
lea    0x4(%rsp),%r12
lea    0xead(%rip),%rbp
lea    0xece(%rip),%r14
mov    %rsp,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1208 <main+0xd8>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe45(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1190 <main+0x60>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter the length of the rectangle: \0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [18 x i8] c"Length = %0.2f: \0A\00"
@.str.3 = [19 x i8] c"Enter its width: \0A\00"
@.str.4 = [17 x i8] c"Width = %0.2f: \0A\00"
@.str.5 = [16 x i8] c"Area = %0.2f: \0A\00"
@.str.6 = [7 x i8] c"Done.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %16, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %8
br label %26
16: ; preds = %8
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %18)
%20 = load float, float* %2
%21 = load float, float* %3
%22 = fmul float %20, %21
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %5
26: ; preds = %15, %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [18 x i8] c"Length = %0.2f: \0A\00"
@.str.4 = [17 x i8] c"Width = %0.2f: \0A\00"
@.str.5 = [16 x i8] c"Area = %0.2f: \0A\00"
@str.7 = [6 x i8] c"Done.\00"
@str.8 = [18 x i8] c"Enter its width: \00"
@str.9 = [36 x i8] c"Enter the length of the rectangle: \00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.9, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %27
8: ; preds = %0, %15
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %27
15: ; preds = %8
%16 = load float, float* %2
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %17)
%19 = load float, float* %1
%20 = load float, float* %2
%21 = fmul float %19, %20
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.9, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%26 = icmp eq i32 %25, 1
br i1 %26, label %8, label %27
27: ; preds = %15, %8, %0
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}