#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 mysqrt(double);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stdout, "%s Version %d.%d\n", argv[0], 1, 0);
    fprintf(stdout, "Usage: %s number\n", argv[0]);
    return 1;
  }
  double inputValue = atof(argv[1]);
  double outputValue = mysqrt(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    11a0 <main+0x70>
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>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe85(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e9 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <mysqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe49(%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   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     117e <main+0x4e>
mov    0x2e99(%rip),%r14
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xeac(%rip),%rsi
mov    $0x1,%ebp
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xe9d(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b4 <main+0x84>
mov    0x8(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
call   1050 <mysqrt@plt>
movaps %xmm0,%xmm1
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1040 <fprintf@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [18 x i8] c"%s Version %d.%d\0A\00"
@.str.1 = [18 x i8] c"Usage: %s number\0A\00"
@.str.2 = [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 %21
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)
%16 = load i32, i32* @stdout
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %32
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call double @atof(i8* %24)
store double %25, double* %6
%26 = load double, double* %6
%27 = call double @mysqrt(double %26)
store double %27, double* %7
%28 = load i32, i32* @stdout
%29 = load double, double* %6
%30 = load double, double* %7
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %29, double %30)
store i32 0, i32* %3
br label %32
32: ; preds = %21, %10
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [18 x i8] c"%s Version %d.%d\0A\00"
@.str.1 = [18 x i8] c"Usage: %s number\0A\00"
@.str.2 = [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 %11
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)
%8 = load i32, i32* @stdout
%9 = load i8*, i8** %1
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %18
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call double @atof(i8* %13)
%15 = tail call double @mysqrt(double %14)
%16 = load i32, i32* @stdout
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %14, double %15)
br label %18
18: ; preds = %11, %4
%19 = phi i32 [ 1, %4 ], [ 0, %11 ]
ret i32 %19
}