#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 numeros[10];
  int i;
  int maior = 0, pos = 0;
  scanf("%d", &numeros[0]);
  maior = numeros[0];
  for (i = 1; i < 10; i++) {
    scanf("%d", &numeros[i]);
    if (numeros[i] > maior) {
      maior = numeros[i];
      pos = i;
    }
  }
  for (i = 0; i < 10; i++)
    printf(" %d", numeros[i]);
  printf("\nMaior valor: %d na posicao: %d", maior, pos);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
movl   $0x1,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11b4 <main+0x94>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea3(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jle    11a1 <main+0x81>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    11a6 <main+0x86>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115a <main+0x3a>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11e9 <main+0xc9>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11bb <main+0x9b>
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    0xe0a(%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   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xee8(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%ebx
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %ebp,%ebp
cmp    %ebx,%eax
setg   %bpl
cmovg  %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,0x40(%rsp)
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x44(%rsp)
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
mov    %eax,0x3c(%rsp)
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
mov    %eax,0x38(%rsp)
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x18(%rsp),%eax
mov    %eax,0x34(%rsp)
lea    0x1c(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x1c(%rsp),%r13d
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x20(%rsp),%r15d
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%esi
mov    0x24(%rsp),%r12d
lea    0xe14(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x40(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
mov    $0x2,%eax
cmovle %ebp,%eax
mov    0x44(%rsp),%ecx
cmp    %ebx,%ecx
cmovg  %ecx,%ebx
mov    $0x3,%ecx
cmovle %eax,%ecx
mov    0x3c(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
mov    $0x4,%eax
cmovle %ecx,%eax
mov    0x38(%rsp),%ecx
cmp    %ebx,%ecx
cmovg  %ecx,%ebx
mov    $0x5,%ecx
cmovle %eax,%ecx
mov    0x34(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
mov    $0x6,%eax
cmovle %ecx,%eax
cmp    %ebx,%r13d
cmovg  %r13d,%ebx
mov    $0x7,%ecx
cmovle %eax,%ecx
cmp    %ebx,%r15d
cmovg  %r15d,%ebx
mov    $0x8,%eax
cmovle %ecx,%eax
cmp    %ebx,%r12d
cmovg  %r12d,%ebx
mov    $0x9,%edx
cmovle %eax,%edx
lea    0xce7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [32 x i8] c"\0AMaior valor: %d na posicao: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %8
store i32 %9, i32* %4
store i32 1, i32* %3
br label %10
10: ; preds = %31, %0
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %34
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %30
24: ; preds = %13
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %26
%28 = load i32, i32* %27
store i32 %28, i32* %4
%29 = load i32, i32* %3
store i32 %29, i32* %5
br label %30
30: ; preds = %24, %13
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %10
34: ; preds = %10
store i32 0, i32* %3
br label %35
35: ; preds = %44, %34
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 10
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %38
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %35
47: ; preds = %35
%48 = load i32, i32* %4
%49 = load i32, i32* %5
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %48, i32 %49)
ret i32 0
}

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