#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float sqrtf(float);
int main(int argc, char *argv[]) {
  int codret = 0;
  float n;
  float raiz;
  printf("Este programa calcula la raiz cuadrada de un numero. \n");
  printf("Dame el numero: ");
  scanf("%f", &n);
  raiz = sqrtf(n);
  printf("La raiz cuadrada de %8.3f es %8.3f,\n", n, raiz);
  return codret;
}


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)
movl   $0x0,-0x14(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x18(%rbp),%xmm0
call   1040 <sqrtf@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeaa(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1180 <main+0x40>
sqrtss %xmm0,%xmm0
jmp    1185 <main+0x45>
call   1050 <sqrtf@plt>
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe77(%rip),%rdi
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Este programa calcula la raiz cuadrada de un numero. \0A\00"
@.str.1 = [17 x i8] c"Dame el numero: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [37 x i8] c"La raiz cuadrada de %8.3f es %8.3f,\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %7)
%12 = load float, float* %7
%13 = call float @sqrtf(float %12)
store float %13, float* %8
%14 = load float, float* %7
%15 = fpext float %14 to double
%16 = load float, float* %8
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), double %15, double %17)
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"Dame el numero: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [37 x i8] c"La raiz cuadrada de %8.3f es %8.3f,\0A\00"
@str = [54 x i8] c"Este programa calcula la raiz cuadrada de un numero. \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%8 = load float, float* %3
%9 = call float @sqrtf(float %8)
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = fpext float %9 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), double %11, double %12)
ret i32 0
}