#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 */
float FLT_MIN;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int qntd, n;
  printf("Digite a quantidade de elementos: ");
  scanf("%d", &qntd);
  printf("Ate onde considerar: ");
  scanf("%d", &n);
  float vet[qntd], maior = FLT_MIN;
  for (int i = 0; i < qntd; i++) {
    printf("Digite um numero: ");
    scanf("%f", &vet[i]);
    if (i < n && vet[i] > maior)
      maior = vet[i];
  }
  printf("Maior = %.2f \n", maior);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x31(%rbp)
call   1030 <printf@plt>
mov    -0x31(%rbp),%al
lea    0xed9(%rip),%rdi
mov    %rdi,-0x40(%rbp)
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x31(%rbp),%al
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x31(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    0x2e44(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1233 <main+0x113>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1220 <main+0x100>
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    1220 <main+0x100>
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    1225 <main+0x105>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b4 <main+0x94>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%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    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rbx
lea    -0x30(%rbp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    -0x34(%rbp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x30(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    0x2e55(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    1206 <main+0xe6>
lea    0xe93(%rip),%r14
lea    0xe9f(%rip),%r12
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    11d1 <main+0xb1>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
movslq -0x30(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r15
jge    1206 <main+0xe6>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    (%rbx,%r13,1),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
movslq -0x34(%rbp),%rax
cmp    %rax,%r15
jge    11c0 <main+0xa0>
movss  0x0(%r13,%r15,4),%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    11c0 <main+0xa0>
movss  %xmm0,-0x2c(%rbp)
jmp    11c0 <main+0xa0>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%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 = [35 x i8] c"Digite a quantidade de elementos: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Ate onde considerar: \00"
@FLT_MIN = global float 0.000000e+00
@.str.3 = [19 x i8] c"Digite um numero: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [15 x i8] c"Maior = %.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca float
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %2
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %4
%15 = alloca float, i64 %13
store i64 %13, i64* %5
%16 = load float, float* @FLT_MIN
store float %16, float* %6
store i32 0, i32* %7
br label %17
17: ; preds = %43, %0
%18 = load i32, i32* %7
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %46
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float, float* %15, i64 %24
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %25)
%27 = load i32, i32* %7
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %42
30: ; preds = %21
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds float, float* %15, i64 %32
%34 = load float, float* %33
%35 = load float, float* %6
%36 = fcmp ogt float %34, %35
br i1 %36, label %37, label %42
37: ; preds = %30
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %15, i64 %39
%41 = load float, float* %40
store float %41, float* %6
br label %42
42: ; preds = %37, %30, %21
br label %43
43: ; preds = %42
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
store i32 %45, i32* %7
br label %17
46: ; preds = %17
%47 = load float, float* %6
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %48)
%50 = load i8*, i8** %4
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [35 x i8] c"Digite a quantidade de elementos: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Ate onde considerar: \00"
@FLT_MIN = global float 0.000000e+00
@.str.3 = [19 x i8] c"Digite um numero: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [15 x i8] c"Maior = %.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
%12 = alloca float, i64 %10
%13 = load float, float* @FLT_MIN
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %33, %0
%17 = phi float [ %13, %0 ], [ %34, %33 ]
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %18)
ret i32 0
20: ; preds = %0, %33
%21 = phi i64 [ %35, %33 ], [ 0, %0 ]
%22 = phi float [ %34, %33 ], [ %13, %0 ]
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%24 = getelementptr inbounds float, float* %12, i64 %21
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %24)
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %21, %27
br i1 %28, label %29, label %33
29: ; preds = %20
%30 = load float, float* %24
%31 = fcmp ogt float %30, %22
br i1 %31, label %32, label %33
32: ; preds = %29
br label %33
33: ; preds = %20, %29, %32
%34 = phi float [ %30, %32 ], [ %22, %29 ], [ %22, %20 ]
%35 = add nuw nsw i64 %21, 1
%36 = load i32, i32* %1
%37 = sext i32 %36 to i64
%38 = icmp slt i64 %35, %37
br i1 %38, label %20, label %16
}