#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, v[10], larger = 0, smaller = 10000, pos_larger, pos_smaller;
  for (i = 0; i < 10; i++) {
    printf("Elemento [%d] = ", i);
    scanf("%d", &v[i]);
    if (v[i] > larger) {
      larger = v[i];
      pos_larger = i;
    }
    if (v[i] < smaller) {
      smaller = v[i];
      pos_smaller = i;
    }
  }
  printf("\nMenor valor: %d sua posição: %d:\n", smaller, pos_smaller);
  printf("\nMaior valor: %d sua posição: %d:\n", larger, pos_larger);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x2710,-0x38(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11d1 <main+0xb1>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9c(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jle    119c <main+0x7c>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jge    11be <main+0x9e>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    11c3 <main+0xa3>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0x38(%rbp),%esi
mov    -0x40(%rbp),%edx
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xecb(%rip),%r15
mov    %r15,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%r12
mov    %rsp,%rsi
mov    %r12,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
mov    $0x0,%ebx
cmovns %eax,%ebx
cmp    $0x2710,%eax
mov    $0x2710,%ebp
cmovl  %eax,%ebp
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r12,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %r12d,%r12d
cmp    %ebx,%eax
setg   %r12b
cmovg  %eax,%ebx
xor    %r13d,%r13d
cmp    %ebp,%eax
setl   %r13b
cmovl  %eax,%ebp
mov    $0x2,%r14d
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
lea    0xe4b(%rip),%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
mov    $0x3,%r14d
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
lea    0xe0f(%rip),%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
mov    $0x4,%r14d
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0xdd3(%rip),%rdi
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
mov    $0x5,%r14d
mov    %r15,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
lea    0xd97(%rip),%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
mov    $0x6,%r14d
mov    %r15,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
lea    0xd5b(%rip),%rdi
call   1040 <scanf@plt>
mov    0x18(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
mov    $0x7,%r14d
mov    %r15,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
lea    0xd1f(%rip),%rdi
call   1040 <scanf@plt>
mov    0x1c(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
mov    $0x8,%r14d
mov    %r15,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
lea    0xce3(%rip),%rdi
call   1040 <scanf@plt>
mov    0x20(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
mov    $0x9,%r14d
mov    %r15,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
lea    0xca7(%rip),%rdi
call   1040 <scanf@plt>
mov    0x24(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r14d,%r12d
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmovl  %r14d,%r13d
lea    0xc88(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc9a(%rip),%rdi
mov    %ebx,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Elemento [%d] = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"\0AMenor valor: %d sua posi\C3\A7\C3\A3o: %d:\0A\00"
@.str.3 = [37 x i8] c"\0AMaior valor: %d sua posi\C3\A7\C3\A3o: %d:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 10000, i32* %5
store i32 0, i32* %2
br label %8
8: ; preds = %44, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %47
11: ; preds = %8
%12 = load i32, i32* %2
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %30
24: ; preds = %11
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
store i32 %28, i32* %4
%29 = load i32, i32* %2
store i32 %29, i32* %6
br label %30
30: ; preds = %24, %11
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %43
37: ; preds = %30
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %39
%41 = load i32, i32* %40
store i32 %41, i32* %5
%42 = load i32, i32* %2
store i32 %42, i32* %7
br label %43
43: ; preds = %37, %30
br label %44
44: ; preds = %43
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %8
47: ; preds = %8
%48 = load i32, i32* %5
%49 = load i32, i32* %7
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %48, i32 %49)
%51 = load i32, i32* %4
%52 = load i32, i32* %6
%53 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %51, i32 %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Elemento [%d] = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"\0AMenor valor: %d sua posi\C3\A7\C3\A3o: %d:\0A\00"
@.str.3 = [37 x i8] c"\0AMaior valor: %d sua posi\C3\A7\C3\A3o: %d:\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
%8 = select i1 %7, i32 %6, i32 0
%9 = icmp slt i32 %6, 10000
%10 = select i1 %9, i32 %6, i32 10000
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %12
%15 = icmp sgt i32 %14, %8
%16 = select i1 %15, i32 %14, i32 %8
%17 = zext i1 %15 to i32
%18 = icmp slt i32 %14, %10
%19 = select i1 %18, i32 %14, i32 %10
%20 = zext i1 %18 to i32
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 2)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %22
%25 = icmp sgt i32 %24, %16
%26 = select i1 %25, i32 %24, i32 %16
%27 = select i1 %25, i32 2, i32 %17
%28 = icmp slt i32 %24, %19
%29 = select i1 %28, i32 %24, i32 %19
%30 = select i1 %28, i32 2, i32 %20
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 3)
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
%34 = load i32, i32* %32
%35 = icmp sgt i32 %34, %26
%36 = select i1 %35, i32 %34, i32 %26
%37 = select i1 %35, i32 3, i32 %27
%38 = icmp slt i32 %34, %29
%39 = select i1 %38, i32 %34, i32 %29
%40 = select i1 %38, i32 3, i32 %30
%41 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 4)
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %42)
%44 = load i32, i32* %42
%45 = icmp sgt i32 %44, %36
%46 = select i1 %45, i32 %44, i32 %36
%47 = select i1 %45, i32 4, i32 %37
%48 = icmp slt i32 %44, %39
%49 = select i1 %48, i32 %44, i32 %39
%50 = select i1 %48, i32 4, i32 %40
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 5)
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%53 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %52)
%54 = load i32, i32* %52
%55 = icmp sgt i32 %54, %46
%56 = select i1 %55, i32 %54, i32 %46
%57 = select i1 %55, i32 5, i32 %47
%58 = icmp slt i32 %54, %49
%59 = select i1 %58, i32 %54, i32 %49
%60 = select i1 %58, i32 5, i32 %50
%61 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 6)
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%63 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %62)
%64 = load i32, i32* %62
%65 = icmp sgt i32 %64, %56
%66 = select i1 %65, i32 %64, i32 %56
%67 = select i1 %65, i32 6, i32 %57
%68 = icmp slt i32 %64, %59
%69 = select i1 %68, i32 %64, i32 %59
%70 = select i1 %68, i32 6, i32 %60
%71 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 7)
%72 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%73 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %72)
%74 = load i32, i32* %72
%75 = icmp sgt i32 %74, %66
%76 = select i1 %75, i32 %74, i32 %66
%77 = select i1 %75, i32 7, i32 %67
%78 = icmp slt i32 %74, %69
%79 = select i1 %78, i32 %74, i32 %69
%80 = select i1 %78, i32 7, i32 %70
%81 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 8)
%82 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%83 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %82)
%84 = load i32, i32* %82
%85 = icmp sgt i32 %84, %76
%86 = select i1 %85, i32 %84, i32 %76
%87 = select i1 %85, i32 8, i32 %77
%88 = icmp slt i32 %84, %79
%89 = select i1 %88, i32 %84, i32 %79
%90 = select i1 %88, i32 8, i32 %80
%91 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 9)
%92 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%93 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %92)
%94 = load i32, i32* %92
%95 = icmp sgt i32 %94, %86
%96 = select i1 %95, i32 %94, i32 %86
%97 = select i1 %95, i32 9, i32 %87
%98 = icmp slt i32 %94, %89
%99 = select i1 %98, i32 %94, i32 %89
%100 = select i1 %98, i32 9, i32 %90
%101 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %99, i32 %100)
%102 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %96, i32 %97)
ret i32 0
}