#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 INT_MAX;
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int vetor[10] = {10, 2, 30, 4, 50, 6, 70, 8, 9, 1}, i, min = INT_MAX, posicao;
  for (i = 0; i <= 9; i++) {
    if (vetor[i] < min) {
      min = vetor[i];
      posicao = i;
    }
  }
  printf("O menor valor e: %d\nSua posicao e:   %d\n", min, posicao);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x9,-0x34(%rbp)
jg     1196 <main+0x76>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jge    1183 <main+0x63>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    1188 <main+0x68>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1157 <main+0x37>
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
cmp    $0x3,%eax
setge  %cl
cmp    $0x2,%eax
mov    $0x1,%esi
cmovl  %eax,%esi
mov    $0x9,%edx
cmovl  %ecx,%edx
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.vetor = [10 x i32] [i32 10, i32 2, i32 30, i32 4, i32 50, i32 6, i32 70, i32 8, i32 9, i32 1]
@INT_MAX = global i32 0
@.str = [41 x i8] c"O menor valor e: %d\0ASua posicao e: %d\0A\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
%6 = bitcast [10 x i32]* %2 to i8*
%7 = load i32, i32* @INT_MAX
store i32 %7, i32* %4
store i32 0, i32* %3
br label %8
8: ; preds = %25, %0
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 9
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %11
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
store i32 %22, i32* %4
%23 = load i32, i32* %3
store i32 %23, i32* %5
br label %24
24: ; preds = %18, %11
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %8
28: ; preds = %8
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30)
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@INT_MAX = global i32 0
@.str = [41 x i8] c"O menor valor e: %d\0ASua posicao e: %d\0A\00"
define i32 @main() {
%1 = load i32, i32* @INT_MAX
%2 = icmp sgt i32 %1, 2
%3 = zext i1 %2 to i32
%4 = icmp sgt i32 %1, 1
%5 = select i1 %4, i32 1, i32 %1
%6 = select i1 %4, i32 9, i32 %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}