#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 *, ...);
void main() {
  int V[10] = {41, 17, 23, 83, 73, 95, 6, 2, 89, 53}, i, maior, menor, maipos,
      menpos;
  for (i = 0; i < 10; i++) {
    if (i == 0) {
      maior = V[i];
      maipos = i;
      menor = V[i];
      menpos = i;
    } else {
      if (V[i] > maior) {
        maior = V[i];
        maipos = i;
      }
      if (V[i] < menor) {
        menor = V[i];
        menpos = i;
      }
    }
  }
  printf("Vetor: ");
  for (i = 0; i < 10; i++)
    if (i != 9)
      printf("%d ", V[i]);
    else
      printf("%d\n", V[i]);
  printf("Menor: %d. Posicao: %d.\n"
         "Maior: %d. Posicao: %d.\n",
         menor, menpos, maior, maipos);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11db <main+0xbb>
cmpl   $0x0,-0x34(%rbp)
jne    117f <main+0x5f>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x40(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    11c8 <main+0xa8>
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,-0x40(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x3c(%rbp),%eax
jge    11c3 <main+0xa3>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    11c8 <main+0xa8>
jmp    11cd <main+0xad>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1144 <main+0x24>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1248 <main+0x128>
cmpl   $0x9,-0x34(%rbp)
je     121f <main+0xff>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0x11a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f0 <main+0xd0>
mov    -0x3c(%rbp),%esi
mov    -0x44(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x40(%rbp),%r8d
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rbx
mov    %rbx,%rdi
mov    $0x29,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x17,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x53,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x49,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5f,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x59,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0x35,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x2,%esi
mov    $0x7,%edx
mov    $0x5f,%ecx
mov    $0x5,%r8d
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@__const.main.V = [10 x i32] [i32 41, i32 17, i32 23, i32 83, i32 73, i32 95, i32 6, i32 2, i32 89, i32 53]
@.str = [8 x i8] c"Vetor: \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [49 x i8] c"Menor: %d. Posicao: %d.\0AMaior: %d. Posicao: %d.\0A\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [10 x i32]* %1 to i8*
store i32 0, i32* %2
br label %8
8: ; preds = %53, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %56
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %16
%18 = load i32, i32* %17
store i32 %18, i32* %3
%19 = load i32, i32* %2
store i32 %19, i32* %5
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
store i32 %23, i32* %4
%24 = load i32, i32* %2
store i32 %24, i32* %6
br label %52
25: ; preds = %11
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %3
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %38
32: ; preds = %25
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %3
%37 = load i32, i32* %2
store i32 %37, i32* %5
br label %38
38: ; preds = %32, %25
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %4
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load i32, i32* %2
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %47
%49 = load i32, i32* %48
store i32 %49, i32* %4
%50 = load i32, i32* %2
store i32 %50, i32* %6
br label %51
51: ; preds = %45, %38
br label %52
52: ; preds = %51, %14
br label %53
53: ; preds = %52
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
br label %8
56: ; preds = %8
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %58
58: ; preds = %77, %56
%59 = load i32, i32* %2
%60 = icmp slt i32 %59, 10
br i1 %60, label %61, label %80
61: ; preds = %58
%62 = load i32, i32* %2
%63 = icmp ne i32 %62, 9
br i1 %63, label %64, label %70
64: ; preds = %61
%65 = load i32, i32* %2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %68)
br label %76
70: ; preds = %61
%71 = load i32, i32* %2
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %70, %64
br label %77
77: ; preds = %76
%78 = load i32, i32* %2
%79 = add nsw i32 %78, 1
store i32 %79, i32* %2
br label %58
80: ; preds = %58
%81 = load i32, i32* %4
%82 = load i32, i32* %6
%83 = load i32, i32* %3
%84 = load i32, i32* %5
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 %81, i32 %82, i32 %83, i32 %84)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"Vetor: \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [49 x i8] c"Menor: %d. Posicao: %d.\0AMaior: %d. Posicao: %d.\0A\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 41)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 17)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 23)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 83)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 73)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 95)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 89)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 53)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 7, i32 95, i32 5)
ret void
}