#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 *);
void main() {
  int nAtual, nAntigo, i = 0, j = 0;
  printf("Informe a quantidade de numeros a serem avaliadas: ");
  scanf("%d", &i);
  while (j < (i - 1)) {
    if (j == 0) {
      printf("Informe o numero 1: ");
      scanf("%d", &nAntigo);
    }
    printf("Digite o numero %d: ", j + 2);
    scanf("%d", &nAtual);
    if (nAtual > nAntigo) {
      printf("Em ordem.\n");
    } else {
      printf("Nao ordenado.\n");
    }
    nAntigo = nAtual;
    j++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f2 <main+0xd2>
cmpl   $0x0,-0x10(%rbp)
jne    118d <main+0x6d>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%esi
add    $0x2,%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11d0 <main+0xb0>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <main+0xbe>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <main+0x34>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x2,0x10(%rsp)
jl     1242 <main+0x112>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    0x14(%rsp),%eax
lea    0xeae(%rip),%r12
lea    0xe99(%rip),%r13
mov    %r13,%rdi
cmovg  %r12,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x14(%rsp)
cmpl   $0x3,0x10(%rsp)
jl     1242 <main+0x112>
mov    $0x1,%ebp
lea    0xe5d(%rip),%r14
lea    0xe3e(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
lea    0x2(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    0x14(%rsp),%eax
mov    %r13,%rdi
cmovg  %r12,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x14(%rsp)
add    $0x1,%ebp
mov    0x10(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebp
jl     1200 <main+0xd0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Informe a quantidade de numeros a serem avaliadas: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"Informe o numero 1: \00"
@.str.3 = [21 x i8] c"Digite o numero %d: \00"
@.str.4 = [11 x i8] c"Em ordem.\0A\00"
@.str.5 = [15 x i8] c"Nao ordenado.\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %7
7: ; preds = %30, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %34
12: ; preds = %7
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %30
28: ; preds = %18
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
%31 = load i32, i32* %1
store i32 %31, i32* %2
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %7
34: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"Informe a quantidade de numeros a serem avaliadas: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"Informe o numero 1: \00"
@.str.3 = [21 x i8] c"Digite o numero %d: \00"
@str = [14 x i8] c"Nao ordenado.\00"
@str.6 = [10 x i8] c"Em ordem.\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %39
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 2)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = icmp sgt i32 %16, %17
%19 = select i1 %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0)
%20 = call i32 @puts(i8* dereferenceable(1) %19)
%21 = load i32, i32* %1
store i32 %21, i32* %2
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 2
br i1 %23, label %24, label %39
24: ; preds = %11, %24
%25 = phi i32 [ %35, %24 ], [ 1, %11 ]
%26 = add nuw nsw i32 %25, 2
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = icmp sgt i32 %29, %30
%32 = select i1 %31, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0)
%33 = call i32 @puts(i8* dereferenceable(1) %32)
%34 = load i32, i32* %1
store i32 %34, i32* %2
%35 = add nuw nsw i32 %25, 1
%36 = load i32, i32* %3
%37 = add nsw i32 %36, -1
%38 = icmp slt i32 %35, %37
br i1 %38, label %24, label %39
39: ; preds = %24, %11, %0
ret void
}