#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*/ printf(char *, double, ...);
int main(int argc, char *argv[]) {
  double num1;
  printf("%d \n%s , \n%s, \n", argc, argv[0], argv[1]);
  num1 = (atof(argv[1]));
  printf("the square of %6.3f is: %6.3f\n", num1, (num1 * num1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xeb6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
lea    0xe97(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cvtsi2sd %edi,%xmm0
mov    (%rsi),%rsi
mov    0x8(%rbx),%rdx
lea    0xeca(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x8(%rbx),%rdi
call   1030 <atof@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
lea    0xebb(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%d \0A%s , \0A%s, \0A\00"
@.str.1 = [31 x i8] c"the square of %6.3f is: %6.3f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = sitofp i32 %6 to double
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %7, i8* %10, i8* %13)
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call double @atof(i8* %17)
store double %18, double* %5
%19 = load double, double* %5
%20 = load double, double* %5
%21 = load double, double* %5
%22 = fmul double %20, %21
%23 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %19, double %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"%d \0A%s , \0A%s, \0A\00"
@.str.1 = [31 x i8] c"the square of %6.3f is: %6.3f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = sitofp i32 %0 to double
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %3, i8* %4, i8* %6)
%8 = load i8*, i8** %5
%9 = tail call double @atof(i8* %8)
%10 = fmul double %9, %9
%11 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %9, double %10)
ret i32 0
}