#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 leng, wid;
  printf("Enter length of rectangle:");
  while (scanf("%f", &leng) == 1) {
    printf("Enter width of rectangle:");
    if (scanf("%f", &wid) != 1)
      break;
    printf("Area = %.2f .\n", leng * wid);
    printf("Enter length of rectangle:");
  }
  printf("Done!");
  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    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11b1 <main+0x91>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1182 <main+0x62>
jmp    11b1 <main+0x91>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
lea    0xe8f(%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    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11cd <main+0xad>
lea    0xec6(%rip),%r14
lea    0xebc(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xecd(%rip),%r12
lea    0xe8e(%rip),%r13
mov    %rsp,%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11cd <main+0xad>
movss  (%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1180 <main+0x60>
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter length of rectangle:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"Enter width of rectangle:\00"
@.str.3 = [15 x i8] c"Area = %.2f .\0A\00"
@.str.4 = [6 x i8] c"Done!\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 ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %13, %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 %20
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%11 = icmp ne i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %8
br label %20
13: ; preds = %8
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fmul float %14, %15
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %5
20: ; preds = %12, %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter length of rectangle:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"Enter width of rectangle:\00"
@.str.3 = [15 x i8] c"Area = %.2f .\0A\00"
@.str.4 = [6 x i8] c"Done!\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, 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 %21
8: ; preds = %0, %12
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load float, float* %1
%14 = load float, float* %2
%15 = fmul float %13, %14
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%20 = icmp eq i32 %19, 1
br i1 %20, label %8, label %21
21: ; preds = %12, %8, %0
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}