#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*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, float *);
double sqrt(double);
int main() {
  float value;
  double answer;
  printf("0! Computer, find me the square root of %c ", 16);
  scanf("%f", &value);
  if (value < 0.0)
    abort();
  answer = sqrt((double)value);
  printf("\n\nThe computer says the answer is %f\n", answer);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea2(%rip),%rdi
movsd  0xe92(%rip),%xmm0
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11a0 <main+0x50>
mov    $0x0,%al
call   1030 <abort@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb0(%rip),%rdi
movsd  0xea0(%rip),%xmm0
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    118b <main+0x3b>
xor    %eax,%eax
call   1030 <abort@plt>
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     119e <main+0x4e>
sqrtsd %xmm0,%xmm0
jmp    11a3 <main+0x53>
call   1060 <sqrt@plt>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"0! Computer, find me the square root of %c \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [38 x i8] c"\0A\0AThe computer says the answer is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), double 1.600000e+01)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = load float, float* %2
%7 = fpext float %6 to double
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %0
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = call double @sqrt(double %13)
store double %14, double* %3
%15 = load double, double* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %15)
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [44 x i8] c"0! Computer, find me the square root of %c \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [38 x i8] c"\0A\0AThe computer says the answer is %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), double 1.600000e+01)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp olt float %5, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
%10 = fpext float %5 to double
%11 = call double @sqrt(double %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %11)
%13 = call i32 @exit(i32 0)
unreachable
}