#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, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, vet[10], maior = 0, maior_p;
  for (i = 0; i < 10; i++) {
    printf("vet[%d]: ", i);
    scanf("%d", &vet[i]);
    if (vet[i] > maior) {
      maior = vet[i];
      maior_p = i;
    }
  }
  printf("maior: %d\nmaior_p: %d\n", maior, maior_p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11a8 <main+0x88>
mov    -0x8(%rbp),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9c(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jle    1195 <main+0x75>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    119a <main+0x7a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xecd(%rip),%r14
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec2(%rip),%r15
mov    %rsp,%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%ebx
test   %ebx,%ebx
cmovs  %ebp,%ebx
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %ebp,%ebp
cmp    %ebx,%eax
setg   %bpl
cmovg  %eax,%ebx
mov    $0x2,%r12d
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    $0x3,%r12d
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    $0x4,%r12d
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    $0x5,%r12d
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    $0x6,%r12d
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x18(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    $0x7,%r12d
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x1c(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    $0x8,%r12d
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x20(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    $0x9,%r12d
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x24(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
lea    0xd08(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"vet[%d]: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"maior: %d\0Amaior_p: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %2
br label %6
6: ; preds = %29, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %32
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = load i32, i32* %4
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %28
22: ; preds = %9
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %24
%26 = load i32, i32* %25
store i32 %26, i32* %4
%27 = load i32, i32* %2
store i32 %27, i32* %5
br label %28
28: ; preds = %22, %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %6
32: ; preds = %6
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"vet[%d]: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"maior: %d\0Amaior_p: %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
%8 = select i1 %7, i32 %6, i32 0
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = load i32, i32* %10
%13 = icmp sgt i32 %12, %8
%14 = select i1 %13, i32 %12, i32 %8
%15 = zext i1 %13 to i32
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = load i32, i32* %17
%20 = icmp sgt i32 %19, %14
%21 = select i1 %20, i32 %19, i32 %14
%22 = select i1 %20, i32 2, i32 %15
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3)
%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 = icmp sgt i32 %26, %21
%28 = select i1 %27, i32 %26, i32 %21
%29 = select i1 %27, i32 3, i32 %22
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 4)
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%33 = load i32, i32* %31
%34 = icmp sgt i32 %33, %28
%35 = select i1 %34, i32 %33, i32 %28
%36 = select i1 %34, i32 4, i32 %29
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 5)
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %38)
%40 = load i32, i32* %38
%41 = icmp sgt i32 %40, %35
%42 = select i1 %41, i32 %40, i32 %35
%43 = select i1 %41, i32 5, i32 %36
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 6)
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %45)
%47 = load i32, i32* %45
%48 = icmp sgt i32 %47, %42
%49 = select i1 %48, i32 %47, i32 %42
%50 = select i1 %48, i32 6, i32 %43
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 7)
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%53 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %52)
%54 = load i32, i32* %52
%55 = icmp sgt i32 %54, %49
%56 = select i1 %55, i32 %54, i32 %49
%57 = select i1 %55, i32 7, i32 %50
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 8)
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %59)
%61 = load i32, i32* %59
%62 = icmp sgt i32 %61, %56
%63 = select i1 %62, i32 %61, i32 %56
%64 = select i1 %62, i32 8, i32 %57
%65 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%66 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%67 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %66)
%68 = load i32, i32* %66
%69 = icmp sgt i32 %68, %63
%70 = select i1 %69, i32 %68, i32 %63
%71 = select i1 %69, i32 9, i32 %64
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %70, i32 %71)
ret i32 0
}