#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 atoi(char *);
int /*<<< orphan*/ calcRaiz(long double, long double, long double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long double *);
long double strtod(char *, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int n, i;
  long double r;
  if (argc != 3) {
    printf("Uso: %s Cantidad de numeros(N) Error(R)\n", argv[0]);
    return 0;
  }
  n = atoi(argv[1]);
  r = strtod(argv[2], NULL);
  long double num[n];
  for (i = 0; i < n; i++)
    scanf("%Lf", &num[i]);
  for (i = 0; i < n; i++)
    printf("Raiz Cubica de %Lf = %.15Lf\n", num[i],
           calcRaiz(num[i], num[i] / 3, r));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1191 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <main+0x149>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <strtod@plt>
fstpt  -0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
shl    $0x4,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1213 <main+0xc3>
mov    -0x48(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
lea    0xe2d(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11de <main+0x8e>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    128b <main+0x13b>
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fld    %st(0)
fstpt  -0x54(%rbp)
flds   0xdc0(%rip)
fdivr  %st(1),%st
fldt   -0x30(%rbp)
sub    $0x30,%rsp
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <calcRaiz@plt>
fldt   -0x54(%rbp)
add    $0x30,%rsp
mov    %eax,%esi
sub    $0x10,%rsp
mov    %rsp,%rax
fstpt  (%rax)
lea    0xdbf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x10,%rsp
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    121a <main+0xca>
movl   $0x0,-0x4(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    125e <main+0x10e>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
mov    %rsp,%r15
mov    %r14d,%eax
mov    %rsp,%r12
mov    %rax,%r13
shl    $0x4,%r13
sub    %r13,%r12
mov    %r12,%rsp
test   %r14d,%r14d
fldz
jle    1255 <main+0x105>
fstp   %st(0)
mov    %r15,-0x50(%rbp)
fstpt  -0x44(%rbp)
lea    0xe78(%rip),%r14
mov    %rax,-0x38(%rbp)
mov    %rax,%r15
mov    %r12,%rbx
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x10,%rbx
add    $0xffffffffffffffff,%r15
jne    11c0 <main+0x70>
cmpl   $0x0,-0x38(%rbp)
fldt   -0x44(%rbp)
mov    -0x50(%rbp),%r15
fldz
fxch   %st(1)
jle    1255 <main+0x105>
fstp   %st(1)
lea    0xe42(%rip),%r14
xor    %ebx,%ebx
fldz
fxch   %st(1)
cs nopw 0x0(%rax,%rax,1)
nop
fstp   %st(1)
fldt   (%r12,%rbx,1)
fld    %st(0)
fstpt  -0x38(%rbp)
fld    %st(0)
fdivs  0xded(%rip)
sub    $0x30,%rsp
fxch   %st(2)
fstpt  0x20(%rsp)
fxch   %st(1)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1030 <calcRaiz@plt>
add    $0x20,%rsp
fldt   -0x38(%rbp)
fstpt  (%rsp)
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
fldt   -0x44(%rbp)
add    $0x10,%rsp
add    $0x10,%rbx
cmp    %rbx,%r13
fldz
fxch   %st(1)
jne    1200 <main+0xb0>
fstp   %st(1)
fstp   %st(0)
mov    %r15,%rsp
jmp    126f <main+0x11f>
mov    (%rbx),%rsi
lea    0xd9c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Uso: %s Cantidad de numeros(N) Error(R)\0A\00"
@.str.1 = [4 x i8] c"%Lf\00"
@.str.2 = [29 x i8] c"Raiz Cubica de %Lf = %.15Lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca x86_fp80
%9 = alloca i8*
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 0, i32* %3
br label %70
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call x86_fp80 @strtod(i8* %25, i32* null)
store x86_fp80 %26, x86_fp80* %8
%27 = load i32, i32* %6
%28 = zext i32 %27 to i64
%29 = call i8* @llvm.stacksave()
store i8* %29, i8** %9
%30 = alloca x86_fp80, i64 %28
store i64 %28, i64* %10
store i32 0, i32* %7
br label %31
31: ; preds = %40, %18
%32 = load i32, i32* %7
%33 = load i32, i32* %6
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %43
35: ; preds = %31
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds x86_fp80, x86_fp80* %30, i64 %37
%39 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), x86_fp80* %38)
br label %40
40: ; preds = %35
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %31
43: ; preds = %31
store i32 0, i32* %7
br label %44
44: ; preds = %65, %43
%45 = load i32, i32* %7
%46 = load i32, i32* %6
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %68
48: ; preds = %44
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds x86_fp80, x86_fp80* %30, i64 %50
%52 = load x86_fp80, x86_fp80* %51
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds x86_fp80, x86_fp80* %30, i64 %54
%56 = load x86_fp80, x86_fp80* %55
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds x86_fp80, x86_fp80* %30, i64 %58
%60 = load x86_fp80, x86_fp80* %59
%61 = fdiv x86_fp80 %60, 0xK4000C000000000000000
%62 = load x86_fp80, x86_fp80* %8
%63 = call i32 @calcRaiz(x86_fp80 %56, x86_fp80 %61, x86_fp80 %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), x86_fp80 %52, i32 %63)
br label %65
65: ; preds = %48
%66 = load i32, i32* %7
%67 = add nsw i32 %66, 1
store i32 %67, i32* %7
br label %44
68: ; preds = %44
store i32 0, i32* %3
%69 = load i8*, i8** %9
br label %70
70: ; preds = %68, %13
%71 = load i32, i32* %3
ret i32 %71
}

LLVM IR (-O2):
@.str = [41 x i8] c"Uso: %s Cantidad de numeros(N) Error(R)\0A\00"
@.str.1 = [4 x i8] c"%Lf\00"
@.str.2 = [29 x i8] c"Raiz Cubica de %Lf = %.15Lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %35
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call x86_fp80 @strtod(i8* nocapture %12, i32* null)
%14 = zext i32 %10 to i64
%15 = tail call i8* @llvm.stacksave()
%16 = alloca x86_fp80, i64 %14
%17 = icmp sgt i32 %10, 0
br i1 %17, label %19, label %34
18: ; preds = %19
br i1 %17, label %25, label %34
19: ; preds = %7, %19
%20 = phi i64 [ %23, %19 ], [ 0, %7 ]
%21 = getelementptr inbounds x86_fp80, x86_fp80* %16, i64 %20
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), x86_fp80* %21)
%23 = add nuw nsw i64 %20, 1
%24 = icmp eq i64 %23, %14
br i1 %24, label %18, label %19
25: ; preds = %18, %25
%26 = phi i64 [ %32, %25 ], [ 0, %18 ]
%27 = getelementptr inbounds x86_fp80, x86_fp80* %16, i64 %26
%28 = load x86_fp80, x86_fp80* %27
%29 = fdiv x86_fp80 %28, 0xK4000C000000000000000
%30 = call i32 @calcRaiz(x86_fp80 %28, x86_fp80 %29, x86_fp80 %13)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), x86_fp80 %28, i32 %30)
%32 = add nuw nsw i64 %26, 1
%33 = icmp eq i64 %32, %14
br i1 %33, label %34, label %25
34: ; preds = %25, %7, %18
br label %35
35: ; preds = %34, %4
ret i32 0
}