#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 */
double atof(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
double sqrt(double);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stdout, "%s Version %d.%d\n", argv[0], 1, 0);
    return 1;
  }
  double inputValue = atof(argv[1]);
  double outputValue = sqrt(inputValue);
  fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1182 <main+0x52>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe99(%rip),%rsi
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11cb <main+0x9b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe55(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jg     1163 <main+0x33>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xeb3(%rip),%rsi
mov    $0x1,%ebx
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b6 <main+0x86>
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1180 <main+0x50>
sqrtsd %xmm2,%xmm1
jmp    1199 <main+0x69>
movapd %xmm2,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm1
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
movapd %xmm2,%xmm0
mov    $0x2,%al
call   1040 <fprintf@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [18 x i8] c"%s Version %d.%d\0A\00"
@.str.1 = [29 x i8] c"The square root of %g is %g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stdout
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14, i32 1, i32 0)
store i32 1, i32* %3
br label %27
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call double @atof(i8* %19)
store double %20, double* %6
%21 = load double, double* %6
%22 = call double @sqrt(double %21)
store double %22, double* %7
%23 = load i32, i32* @stdout
%24 = load double, double* %6
%25 = load double, double* %7
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), double %24, double %25)
store i32 0, i32* %3
br label %27
27: ; preds = %16, %10
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [18 x i8] c"%s Version %d.%d\0A\00"
@.str.1 = [29 x i8] c"The square root of %g is %g\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stdout
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %6, i32 1, i32 0)
br label %15
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call double @atof(i8* %10)
%12 = tail call double @sqrt(double %11)
%13 = load i32, i32* @stdout
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), double %11, double %12)
br label %15
15: ; preds = %8, %4
%16 = phi i32 [ 1, %4 ], [ 0, %8 ]
ret i32 %16
}