#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*/ desvpad(int, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  float *ponteiro;
  int tamanho;
  printf("\nBem vindo ao programa DesvPad66_v3! Este programa calcula o desvio "
         "padrão de uma\namostra de dados.\n");
  printf("Qual eh o tamanho de sua amostra? (max: 32.767) ");
  scanf("%i", &tamanho);
  while (tamanho <= 0) {
    printf("Sua entrada eh invalida. Digite um valor estritamente maior que "
           "zero.\n");
    scanf("%i", &tamanho);
  }
  float amostra[tamanho];
  for (int i = 0; i < tamanho; i++) {
    printf("Digite o valor do dado numero %i: ", i + 1);
    scanf("%f", &amostra[i]);
  }
  ponteiro = &amostra[0];
  desvpad(tamanho, ponteiro);
  printf("Obrigado por usar o programa!\n\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf35(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jg     119c <main+0x6c>
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0b(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
jmp    116d <main+0x3d>
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1215 <main+0xe5>
mov    -0x2c(%rbp),%esi
add    $0x1,%esi
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ca <main+0x9a>
mov    -0x38(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <desvpad@plt>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%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    $0x18,%rsp
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jg     11bc <main+0x7c>
lea    0xf53(%rip),%r14
lea    0xe9f(%rip),%r15
lea    -0x2c(%rbp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jle    11a0 <main+0x60>
mov    %rsp,%rbx
mov    %eax,%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x2c(%rbp),%edi
test   %edi,%edi
jle    122e <main+0xee>
mov    %rbx,-0x38(%rbp)
lea    0xe4c(%rip),%r15
lea    0xe68(%rip),%r12
mov    %r14,%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movslq -0x2c(%rbp),%rdi
add    $0x4,%r13
cmp    %rdi,%rbx
jl     1200 <main+0xc0>
mov    -0x38(%rbp),%rbx
mov    %r14,%rsi
call   1050 <desvpad@plt>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [102 x i8] c"\0ABem vindo ao programa DesvPad66_v3! Este programa calcula o desvio padr\C3\A3o de uma\0Aamostra de dados.\0A\00"
@.str.1 = [49 x i8] c"Qual eh o tamanho de sua amostra? (max: 32.767) \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [71 x i8] c"Sua entrada eh invalida. Digite um valor estritamente maior que zero.\0A\00"
@.str.4 = [35 x i8] c"Digite o valor do dado numero %i: \00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [32 x i8] c"Obrigado por usar o programa!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %10
10: ; preds = %13, %0
%11 = load i32, i32* %3
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %10
16: ; preds = %10
%17 = load i32, i32* %3
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %4
%20 = alloca float, i64 %18
store i64 %18, i64* %5
store i32 0, i32* %6
br label %21
21: ; preds = %33, %16
%22 = load i32, i32* %6
%23 = load i32, i32* %3
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %36
25: ; preds = %21
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds float, float* %20, i64 %30
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %31)
br label %33
33: ; preds = %25
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %21
36: ; preds = %21
%37 = getelementptr inbounds float, float* %20, i64 0
store float* %37, float** %2
%38 = load i32, i32* %3
%39 = load float*, float** %2
%40 = call i32 @desvpad(i32 %38, float* %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %1
%42 = load i8*, i8** %4
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str.1 = [49 x i8] c"Qual eh o tamanho de sua amostra? (max: 32.767) \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.4 = [35 x i8] c"Digite o valor do dado numero %i: \00"
@.str.5 = [3 x i8] c"%f\00"
@str = [101 x i8] c"\0ABem vindo ao programa DesvPad66_v3! Este programa calcula o desvio padr\C3\A3o de uma\0Aamostra de dados.\00"
@str.7 = [31 x i8] c"Obrigado por usar o programa!\0A\00"
@str.8 = [70 x i8] c"Sua entrada eh invalida. Digite um valor estritamente maior que zero.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %0, %8
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.8, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 1
br i1 %12, label %8, label %13
13: ; preds = %8, %0
%14 = phi i32 [ %6, %0 ], [ %11, %8 ]
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
%17 = alloca float, i64 %15
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %24, %13
%21 = phi i32 [ %18, %13 ], [ %31, %24 ]
%22 = call i32 @desvpad(i32 %21, float* %17)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.7, i64 0, i64 0))
ret i32 0
24: ; preds = %13, %24
%25 = phi i64 [ %26, %24 ], [ 0, %13 ]
%26 = add nuw nsw i64 %25, 1
%27 = trunc i64 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds float, float* %17, i64 %25
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %29)
%31 = load i32, i32* %1
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %26, %32
br i1 %33, label %24, label %20
}