#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 fact(int);
int /*<<< orphan*/ printDArray(double *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void ex1() {
  int v[10];
  double w[10];
  for (int i = 0; i < 10; i++) {
    printf("Informe um numero: ");
    scanf("%d", &v[i]);
    w[i] = fact(v[i]);
  }
  printDArray(w, 10);
}


x86 assembly (clang, -O0):
<ex1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x84(%rbp)
cmpl   $0xa,-0x84(%rbp)
jge    11bd <ex1+0x7d>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
movslq -0x84(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8d(%rip),%rdi
call   1060 <scanf@plt>
movslq -0x84(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1050 <fact@plt>
movslq -0x84(%rbp),%rax
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1155 <ex1+0x15>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1040 <printDArray@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex1>:
push   %r14
push   %rbx
sub    $0x88,%rsp
lea    0xeaf(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    (%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x30(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x38(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x8(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x40(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x48(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x10(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x50(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x14(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x58(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x18(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x60(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x1c(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x68(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x20(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x70(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x24(%rsp),%edi
call   1050 <fact@plt>
movsd  %xmm0,0x78(%rsp)
lea    0x30(%rsp),%rdi
mov    $0xa,%esi
call   1040 <printDArray@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Informe um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @ex1() {
%1 = alloca [10 x i32]
%2 = alloca [10 x double]
%3 = alloca i32
store i32 0, i32* %3
br label %4
4: ; preds = %21, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call double @fact(i32 %16)
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 %19
store double %17, double* %20
br label %21
21: ; preds = %7
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %4
24: ; preds = %4
%25 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 0
%26 = call i32 @printDArray(double* %25, i32 10)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Informe um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @ex1() {
%1 = alloca [10 x i32]
%2 = alloca [10 x double]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast [10 x double]* %2 to i8*
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = load i32, i32* %6
%9 = call double @fact(i32 %8)
%10 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 0
store double %9, double* %10
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %12
%15 = call double @fact(i32 %14)
%16 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 1
store double %15, double* %16
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = load i32, i32* %18
%21 = call double @fact(i32 %20)
%22 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 2
store double %21, double* %22
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
%26 = load i32, i32* %24
%27 = call double @fact(i32 %26)
%28 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 3
store double %27, double* %28
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %30)
%32 = load i32, i32* %30
%33 = call double @fact(i32 %32)
%34 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 4
store double %33, double* %34
%35 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %36)
%38 = load i32, i32* %36
%39 = call double @fact(i32 %38)
%40 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 5
store double %39, double* %40
%41 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %42)
%44 = load i32, i32* %42
%45 = call double @fact(i32 %44)
%46 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 6
store double %45, double* %46
%47 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%48 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%49 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %48)
%50 = load i32, i32* %48
%51 = call double @fact(i32 %50)
%52 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 7
store double %51, double* %52
%53 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%54 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %54)
%56 = load i32, i32* %54
%57 = call double @fact(i32 %56)
%58 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 8
store double %57, double* %58
%59 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%61 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %60)
%62 = load i32, i32* %60
%63 = call double @fact(i32 %62)
%64 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 9
store double %63, double* %64
%65 = call i32 @printDArray(double* %10, i32 10)
ret void
}