#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int x[n];
  int menor = INT_MAX;
  int posicao = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
    if (x[i] < menor) {
      menor = x[i];
      posicao = i;
    }
  }
  printf("Menor valor: %d Posicao: %d", menor, posicao);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e2 <main+0xc2>
mov    -0x30(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe77(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x1c(%rbp),%eax
jge    11cf <main+0xaf>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    11d4 <main+0xb4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1180 <main+0x60>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%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    0xee1(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x2e84(%rip),%rax
mov    (%rax),%r14d
cmpl   $0x0,-0x2c(%rbp)
jle    11ab <main+0x8b>
xor    %r13d,%r13d
lea    0xea2(%rip),%r12
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    (%rbx),%eax
cmp    %r14d,%eax
cmovl  %eax,%r14d
cmovl  %r13d,%r15d
add    $0x1,%r13
movslq -0x2c(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r13
jl     1180 <main+0x60>
jmp    11ae <main+0x8e>
xor    %r15d,%r15d
lea    0xe4b(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
call   1030 <printf@plt>
mov    -0x38(%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 = [3 x i8] c"%d\00"
@INT_MAX = global i32 0
@.str.1 = [28 x i8] c"Menor valor: %d Posicao: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %3
%12 = alloca i32, i64 %10
store i64 %10, i64* %4
%13 = load i32, i32* @INT_MAX
store i32 %13, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %14
14: ; preds = %36, %0
%15 = load i32, i32* %7
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %39
18: ; preds = %14
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %12, i64 %20
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %12, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %35
29: ; preds = %18
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %12, i64 %31
%33 = load i32, i32* %32
store i32 %33, i32* %5
%34 = load i32, i32* %7
store i32 %34, i32* %6
br label %35
35: ; preds = %29, %18
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %14
39: ; preds = %14
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %40, i32 %41)
%43 = load i8*, i8** %3
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@INT_MAX = global i32 0
@.str.1 = [28 x i8] c"Menor valor: %d Posicao: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
%7 = alloca i32, i64 %5
%8 = load i32, i32* @INT_MAX
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %15, %0
%12 = phi i32 [ %8, %0 ], [ %23, %15 ]
%13 = phi i32 [ 0, %0 ], [ %25, %15 ]
%14 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
ret i32 0
15: ; preds = %0, %15
%16 = phi i64 [ %26, %15 ], [ 0, %0 ]
%17 = phi i32 [ %25, %15 ], [ 0, %0 ]
%18 = phi i32 [ %23, %15 ], [ %8, %0 ]
%19 = getelementptr inbounds i32, i32* %7, i64 %16
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = load i32, i32* %19
%22 = icmp slt i32 %21, %18
%23 = select i1 %22, i32 %21, i32 %18
%24 = trunc i64 %16 to i32
%25 = select i1 %22, i32 %24, i32 %17
%26 = add nuw nsw i64 %16, 1
%27 = load i32, i32* %1
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %26, %28
br i1 %29, label %15, label %11
}