#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Digite o primeiro número: ");
  scanf("%d", &n);
  int d, i, menor;
  menor = n;
  for (i = 0; i < n - 1; i++) {
    printf("Digite o %dº número: ", i + 2);
    scanf("%d", &d);
    if (d < menor)
      menor = d;
  }
  printf("O menor número é %d\n", menor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11b4 <main+0x94>
mov    -0x10(%rbp),%esi
add    $0x2,%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a1 <main+0x81>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11a6 <main+0x86>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115a <main+0x3a>
mov    -0x14(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
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),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%ebp
cmp    $0x2,%ebp
jl     119f <main+0x7f>
lea    0xec4(%rip),%r14
lea    0xeba(%rip),%r15
lea    0xc(%rsp),%r12
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    0x2(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %ebp,%eax
cmovl  %eax,%ebp
add    $0x1,%ebx
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebx
jl     1170 <main+0x50>
lea    0xe91(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
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 = [28 x i8] c"Digite o primeiro n\C3\BAmero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Digite o %d\C2\BA n\C3\BAmero: \00"
@.str.3 = [23 x i8] c"O menor n\C3\BAmero \C3\A9 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
store i32 %8, i32* %5
store i32 0, i32* %4
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 1
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %28
14: ; preds = %9
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %14
%23 = load i32, i32* %3
store i32 %23, i32* %5
br label %24
24: ; preds = %22, %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %9
28: ; preds = %9
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %29)
ret i32 0
}

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