#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, double);
double sqrt(double);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    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    115c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <main+0x73>
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    0x2e5c(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe69(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     118e <main+0x5e>
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1158 <main+0x28>
sqrtsd %xmm2,%xmm1
jmp    116f <main+0x3f>
movapd %xmm2,%xmm0
movsd  %xmm2,(%rsp)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm2
movapd %xmm0,%xmm1
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
movapd %xmm2,%xmm0
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [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 %11
10: ; preds = %2
store i32 1, i32* %3
br label %22
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call double @atof(i8* %14)
store double %15, double* %6
%16 = load double, double* %6
%17 = call double @sqrt(double %16)
store double %17, double* %7
%18 = load i32, i32* @stdout
%19 = load double, double* %6
%20 = load double, double* %7
%21 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %19, double %20)
store i32 0, i32* %3
br label %22
22: ; preds = %11, %10
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [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 %11, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call double @atof(i8* %6)
%8 = tail call double @sqrt(double %7)
%9 = load i32, i32* @stdout
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %7, double %8)
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %12
}