#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 *);
float getValidLength(int side) {
  float sideLength = 0;
  while (sideLength <= 0) {
    printf("Enter the length of side #%d: ", side);
    scanf("%f", &sideLength);
    if (sideLength <= 0)
      printf("Side length must be greater than zero.\n");
  }
  return sideLength;
}


x86 assembly (clang, -O0):
<getValidLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1181 <getValidLength+0x61>
mov    -0x4(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     117c <getValidLength+0x5c>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1133 <getValidLength+0x13>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getValidLength>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0x0,0xc(%rsp)
lea    0xeb2(%rip),%r14
lea    0xeca(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xec1(%rip),%r13
jmp    1175 <getValidLength+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
ucomiss %xmm0,%xmm1
jb     11ad <getValidLength+0x7d>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
xorps  %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
ucomiss %xmm0,%xmm1
jb     1170 <getValidLength+0x40>
mov    %r13,%rdi
call   1030 <puts@plt>
xorps  %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
jmp    1170 <getValidLength+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Enter the length of side #%d: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [40 x i8] c"Side length must be greater than zero.\0A\00"
define float @getValidLength(i32 %0) {
%2 = alloca i32
%3 = alloca float
store i32 %0, i32* %2
store float 0.000000e+00, float* %3
br label %4
4: ; preds = %15, %1
%5 = load float, float* %3
%6 = fcmp ole float %5, 0.000000e+00
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%11 = load float, float* %3
%12 = fcmp ole float %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %7
br label %4
16: ; preds = %4
%17 = load float, float* %3
ret float %17
}

LLVM IR (-O2):
@.str = [31 x i8] c"Enter the length of side #%d: \00"
@.str.1 = [3 x i8] c"%f\00"
@str = [39 x i8] c"Side length must be greater than zero.\00"
define float @getValidLength(i32 %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
br label %4
4: ; preds = %1, %12
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = load float, float* %2
%8 = fcmp ugt float %7, 0.000000e+00
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%11 = load float, float* %2
br label %12
12: ; preds = %9, %4
%13 = phi float [ %11, %9 ], [ %7, %4 ]
%14 = fcmp ugt float %13, 0.000000e+00
br i1 %14, label %15, label %4
15: ; preds = %12
ret float %13
}