#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*/ get_array(int *, int);
int min_index(int *, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int array[1001], size, index, i;
  scanf("%d", &size);
  get_array(array, size);
  index = min_index(array, size);
  for (i = 0; i < size; i++)
    printf("==%d,%d==\n", array[i], i);
  printf("minimum number is %d, whose position is %d.", array[index], index);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0xfb4(%rbp),%rsi
call   1040 <scanf@plt>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1050 <get_array@plt>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1060 <min_index@plt>
mov    %eax,-0xfb8(%rbp)
movl   $0x0,-0xfbc(%rbp)
mov    -0xfbc(%rbp),%eax
cmp    -0xfb4(%rbp),%eax
jge    11df <main+0x9f>
movslq -0xfbc(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%esi
mov    -0xfbc(%rbp),%edx
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0xfbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfbc(%rbp)
jmp    1199 <main+0x59>
movslq -0xfb8(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%esi
mov    -0xfb8(%rbp),%edx
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xfc0,%rsp
lea    0xeae(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <get_array@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <min_index@plt>
mov    %eax,%r14d
cmpl   $0x0,0xc(%rsp)
jle    11ac <main+0x6c>
xor    %ebx,%ebx
lea    0xe77(%rip),%rbp
nopl   0x0(%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %rbp,%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1190 <main+0x50>
movslq %r14d,%rax
mov    0x10(%rsp,%rax,4),%esi
lea    0xe54(%rip),%rdi
mov    %r14d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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