#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 */
typedef int /*<<< orphan*/ v;

/* Variables and functions */
int EXIT_SUCCESS;
scalar_t__ ordenado(int, int *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int v[] = {1, 2, 3, 4, 5};
  int n = sizeof(v) / sizeof(v[0]);
  printf(ordenado(n, v) ? "Ordenado.\n" : "Não ordenado.\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x5,-0x34(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1030 <ordenado@plt>
mov    %rax,%rcx
lea    0xead(%rip),%rdi
lea    0xe9b(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
call   1040 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x5,%edi
call   1030 <ordenado@plt>
test   %rax,%rax
lea    0xecf(%rip),%rax
lea    0xebd(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.v = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [11 x i8] c"Ordenado.\0A\00"
@.str.1 = [16 x i8] c"N\C3\A3o ordenado.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [5 x i32]* %6 to i8*
store i32 5, i32* %7
%9 = load i32, i32* %7
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%11 = call i64 @ordenado(i32 %9, i32* %10)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
%15 = call i32 @printf(i8* %14)
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}

LLVM IR (-O2):
@__const.main.v = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [11 x i8] c"Ordenado.\0A\00"
@.str.1 = [16 x i8] c"N\C3\A3o ordenado.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%6 = call i64 @ordenado(i32 5, i32* %5)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
%9 = call i32 @printf(i8* dereferenceable(1) %8)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}