#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int lowestNumPosition, lowestNumValue;
  int n;
  scanf("%d", &n);
  int i;
  int num;
  scanf("%d", &num);
  lowestNumPosition = 0;
  lowestNumValue = num;
  for (i = 1; i < n; i++) {
    scanf("%d", &num);
    if (num < lowestNumValue) {
      lowestNumValue = num;
      lowestNumPosition = i;
    }
  }
  printf("Menor valor: %d\nPosicao: %d\n", lowestNumValue, lowestNumPosition);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11aa <main+0x8a>
lea    0xe8a(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1197 <main+0x77>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    119c <main+0x7c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <main+0x43>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%ebx
xor    %r12d,%r12d
cmpl   $0x2,0xc(%rsp)
jl     1191 <main+0x71>
xor    %r12d,%r12d
mov    $0x1,%ebp
lea    0xe96(%rip),%r14
lea    0x8(%rsp),%r15
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %ebx,%eax
cmovl  %ebp,%r12d
cmovl  %eax,%ebx
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1170 <main+0x50>
lea    0xe6b(%rip),%rdi
mov    %ebx,%esi
mov    %r12d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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