#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*/ Quick(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
main() {
  int nPos = 0, nAux = 0;
  int nInd = 0, nAtual = 0;
  int nTroca = 0, nChave = 0;
  while ((nPos <= 0) || (nPos > 100)) {
    printf("\nQuantos numeros tera o vetor? ");
    scanf("%d", &nPos);
  }
  int nVetor[nPos], nOrig[nPos], nOpc = -1;
  for (nAux = 0; nAux <= nPos - 1; nAux++) {
    printf("\nInsira o numero %d: ", nAux + 1);
    scanf("%d", &nVetor[nAux]);
    nOrig[nAux] = nVetor[nAux];
  }
  system("/usr/bin/clear");
  while ((nOpc <= 0) || (nOpc >= 3)) {
    printf("\n > Menu:");
    printf("\n  1. Troca    | Bubble Sort");
    printf("\n  2. Referência  | QuickSort");
    printf("\n > Resposta: ");
    scanf("%d", &nOpc);
  }
  printf("\nOrdenando:\n");
  int i, j, t, m;
  if (nOpc == 1) {
    nTroca = nPos - 1;
    for (nInd = 0; nInd < nPos; nInd++) {
      for (nAux = 0; nAux <= nPos - 1; nAux++) {
        printf("[%d]", nVetor[nAux]);
      }
      for (nAtual = 0; nAtual < nTroca; nAtual++) {
        if (nVetor[nAtual] > nVetor[nAtual + 1]) {
          nAux = nVetor[nAtual];
          nVetor[nAtual] = nVetor[nAtual + 1];
          nVetor[nAtual + 1] = nAux;
        }
      }
      nTroca--;
      printf("\n");
    }
  } else {
    if (nOpc == 2) {
      Quick(nVetor, 0, nPos);
    }
  }
  printf("\nOriginal: ");
  for (nAux = 0; nAux <= nPos - 1; nAux++) {
    printf("[%d]", nOrig[nAux]);
  }
  printf("\nOrdenada: ");
  for (nAux = 0; nAux <= nPos - 1; nAux++) {
    printf("[%d]", nVetor[nAux]);
  }
  getchar();
  printf("\n\nPressione -Enter- para finalizar!\n\n");
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x4d(%rbp)
jle    11a2 <main+0x52>
cmpl   $0x64,-0x8(%rbp)
setg   %al
mov    %al,-0x4d(%rbp)
mov    -0x4d(%rbp),%al
test   $0x1,%al
jne    11b2 <main+0x62>
jmp    11d5 <main+0x85>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe59(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
jmp    1189 <main+0x39>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     128e <main+0x13e>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x60(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdbb(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
movslq -0xc(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    122a <main+0xda>
lea    0xda4(%rip),%rdi
call   1040 <system@plt>
mov    $0x1,%al
cmpl   $0x0,-0x3c(%rbp)
mov    %al,-0x61(%rbp)
jle    12b3 <main+0x163>
cmpl   $0x3,-0x3c(%rbp)
setge  %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    12c3 <main+0x173>
jmp    1310 <main+0x1c0>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd1e(%rip),%rdi
lea    -0x3c(%rbp),%rsi
call   1070 <scanf@plt>
jmp    129a <main+0x14a>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x1,-0x3c(%rbp)
jne    1420 <main+0x2d0>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    141b <main+0x2cb>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1383 <main+0x233>
mov    -0x60(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    134b <main+0x1fb>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13f6 <main+0x2a6>
mov    -0x60(%rbp),%rcx
movslq -0x14(%rbp),%rax
mov    (%rcx,%rax,4),%eax
mov    -0x14(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    13e3 <main+0x293>
mov    -0x60(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    %ecx,-0xc(%rbp)
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    13e8 <main+0x298>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    138a <main+0x23a>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1338 <main+0x1e8>
jmp    143d <main+0x2ed>
cmpl   $0x2,-0x3c(%rbp)
jne    1438 <main+0x2e8>
mov    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%edx
xor    %esi,%esi
call   1030 <Quick@plt>
jmp    143d <main+0x2ed>
lea    0xc6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     148a <main+0x33a>
mov    -0x58(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1452 <main+0x302>
lea    0xc2a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     14d7 <main+0x387>
mov    -0x60(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xbe8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    149f <main+0x34f>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x0,-0x2c(%rbp)
lea    0xe71(%rip),%r14
lea    0xe8a(%rip),%r15
lea    -0x2c(%rbp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    -0x2c(%rbp),%eax
lea    -0x65(%rax),%ecx
cmp    $0xffffff9c,%ecx
jb     11a0 <main+0x30>
mov    %rsp,-0x50(%rbp)
mov    %rsp,%r15
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    -0x2c(%rbp),%eax
mov    %rsp,%rdx
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
movl   $0xffffffff,-0x30(%rbp)
test   %eax,%eax
jle    1247 <main+0xd7>
lea    0xe19(%rip),%r12
mov    %r15,%r13
mov    -0x40(%rbp),%r14
xor    %ebx,%ebx
add    $0x1,%rbx
lea    0xe08(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1090 <scanf@plt>
mov    0x0(%r13),%eax
mov    %eax,(%r14)
movslq -0x2c(%rbp),%rax
add    $0x4,%r14
add    $0x4,%r13
cmp    %rax,%rbx
jl     1210 <main+0xa0>
lea    0xdeb(%rip),%rdi
call   1060 <system@plt>
lea    0xe15(%rip),%r12
lea    0xe2d(%rip),%r13
lea    0xdb8(%rip),%r14
lea    -0x30(%rbp),%rbx
nopl   0x0(%rax)
lea    0xdd1(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdcd(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    -0x30(%rbp),%eax
add    $0xfffffffd,%eax
cmp    $0xfffffffe,%eax
jb     1270 <main+0x100>
lea    0xdfd(%rip),%rdi
call   1040 <puts@plt>
mov    -0x30(%rbp),%eax
cmp    $0x2,%eax
je     13e3 <main+0x273>
cmp    $0x1,%eax
jne    13f0 <main+0x280>
mov    -0x2c(%rbp),%eax
mov    %rax,-0x48(%rbp)
test   %eax,%eax
jle    13f0 <main+0x280>
mov    -0x48(%rbp),%rcx
lea    -0x1(%rcx),%ebx
lea    0xda9(%rip),%r14
mov    %ecx,%eax
mov    %ecx,%r13d
xor    %r12d,%r12d
jmp    1321 <main+0x1b1>
xchg   %ax,%ax
add    $0xffffffff,%r13d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%ebx
cmp    %eax,%r12d
jge    13f0 <main+0x280>
mov    %r13d,-0x34(%rbp)
test   %eax,%eax
jle    134b <main+0x1db>
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    (%r15,%r13,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rax
cmp    %rax,%r13
jl     1330 <main+0x1c0>
mov    -0x34(%rbp),%r13d
cmp    $0x2,%r13d
jl     1300 <main+0x190>
mov    %r12d,%r8d
not    %r8d
add    -0x48(%rbp),%r8d
mov    (%r15),%ecx
cmp    $0x1,%r8d
jne    1390 <main+0x220>
xor    %esi,%esi
test   $0x1,%r8b
je     1300 <main+0x190>
mov    0x4(%r15,%rsi,4),%eax
cmp    %eax,%ecx
jle    1300 <main+0x190>
mov    %eax,(%r15,%rsi,4)
mov    %ecx,0x4(%r15,%rsi,4)
jmp    1300 <main+0x190>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edx
and    $0xfffffffe,%edx
xor    %edi,%edi
jmp    13b2 <main+0x242>
nopl   0x0(%rax)
mov    %eax,0x4(%r15,%rdi,4)
mov    %ecx,0x8(%r15,%rdi,4)
mov    %rsi,%rdi
cmp    %rsi,%rdx
je     136a <main+0x1fa>
mov    0x4(%r15,%rdi,4),%esi
cmp    %esi,%ecx
jle    13d0 <main+0x260>
mov    %esi,(%r15,%rdi,4)
mov    %ecx,0x4(%r15,%rdi,4)
jmp    13d2 <main+0x262>
cs nopw 0x0(%rax,%rax,1)
mov    %esi,%ecx
lea    0x2(%rdi),%rsi
mov    0x8(%r15,%rdi,4),%eax
cmp    %eax,%ecx
jg     13a0 <main+0x230>
mov    %eax,%ecx
jmp    13aa <main+0x23a>
mov    -0x2c(%rbp),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <Quick@plt>
lea    0xcab(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
mov    -0x40(%rbp),%r12
jle    143b <main+0x2cb>
lea    0xc8e(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jl     1420 <main+0x2b0>
lea    0xc6c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    147b <main+0x30b>
lea    0xc47(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jl     1460 <main+0x2f0>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xc3d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    -0x50(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"\0AQuantos numeros tera o vetor? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\0AInsira o numero %d: \00"
@.str.3 = [15 x i8] c"/usr/bin/clear\00"
@.str.4 = [10 x i8] c"\0A > Menu:\00"
@.str.5 = [29 x i8] c"\0A 1. Troca | Bubble Sort\00"
@.str.6 = [31 x i8] c"\0A 2. Refer\C3\AAncia | QuickSort\00"
@.str.7 = [15 x i8] c"\0A > Resposta: \00"
@.str.8 = [13 x i8] c"\0AOrdenando:\0A\00"
@.str.9 = [5 x i8] c"[%d]\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [12 x i8] c"\0AOriginal: \00"
@.str.12 = [12 x i8] c"\0AOrdenada: \00"
@.str.13 = [38 x i8] c"\0A\0APressione -Enter- para finalizar!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %16
16: ; preds = %24, %0
%17 = load i32, i32* %2
%18 = icmp sle i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 100
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ true, %16 ], [ %21, %19 ]
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %16
27: ; preds = %22
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %8
%31 = alloca i32, i64 %29
store i64 %29, i64* %9
%32 = load i32, i32* %2
%33 = zext i32 %32 to i64
%34 = alloca i32, i64 %33
store i64 %33, i64* %10
store i32 -1, i32* %11
store i32 0, i32* %3
br label %35
35: ; preds = %55, %27
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = sub nsw i32 %37, 1
%39 = icmp sle i32 %36, %38
br i1 %39, label %40, label %58
40: ; preds = %35
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %31, i64 %45
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %46)
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %31, i64 %49
%51 = load i32, i32* %50
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %34, i64 %53
store i32 %51, i32* %54
br label %55
55: ; preds = %40
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %35
58: ; preds = %35
%59 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %68, %58
%61 = load i32, i32* %11
%62 = icmp sle i32 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i32, i32* %11
%65 = icmp sge i32 %64, 3
br label %66
66: ; preds = %63, %60
%67 = phi i1 [ true, %60 ], [ %65, %63 ]
br i1 %67, label %68, label %74
68: ; preds = %66
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%73 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
br label %60
74: ; preds = %66
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%76 = load i32, i32* %11
%77 = icmp eq i32 %76, 1
br i1 %77, label %78, label %146
78: ; preds = %74
%79 = load i32, i32* %2
%80 = sub nsw i32 %79, 1
store i32 %80, i32* %6
store i32 0, i32* %4
br label %81
81: ; preds = %142, %78
%82 = load i32, i32* %4
%83 = load i32, i32* %2
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %145
85: ; preds = %81
store i32 0, i32* %3
br label %86
86: ; preds = %97, %85
%87 = load i32, i32* %3
%88 = load i32, i32* %2
%89 = sub nsw i32 %88, 1
%90 = icmp sle i32 %87, %89
br i1 %90, label %91, label %100
91: ; preds = %86
%92 = load i32, i32* %3
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %31, i64 %93
%95 = load i32, i32* %94
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %95)
br label %97
97: ; preds = %91
%98 = load i32, i32* %3
%99 = add nsw i32 %98, 1
store i32 %99, i32* %3
br label %86
100: ; preds = %86
store i32 0, i32* %5
br label %101
101: ; preds = %135, %100
%102 = load i32, i32* %5
%103 = load i32, i32* %6
%104 = icmp slt i32 %102, %103
br i1 %104, label %105, label %138
105: ; preds = %101
%106 = load i32, i32* %5
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i32, i32* %31, i64 %107
%109 = load i32, i32* %108
%110 = load i32, i32* %5
%111 = add nsw i32 %110, 1
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %31, i64 %112
%114 = load i32, i32* %113
%115 = icmp sgt i32 %109, %114
br i1 %115, label %116, label %134
116: ; preds = %105
%117 = load i32, i32* %5
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32, i32* %31, i64 %118
%120 = load i32, i32* %119
store i32 %120, i32* %3
%121 = load i32, i32* %5
%122 = add nsw i32 %121, 1
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i32, i32* %31, i64 %123
%125 = load i32, i32* %124
%126 = load i32, i32* %5
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i32, i32* %31, i64 %127
store i32 %125, i32* %128
%129 = load i32, i32* %3
%130 = load i32, i32* %5
%131 = add nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i32, i32* %31, i64 %132
store i32 %129, i32* %133
br label %134
134: ; preds = %116, %105
br label %135
135: ; preds = %134
%136 = load i32, i32* %5
%137 = add nsw i32 %136, 1
store i32 %137, i32* %5
br label %101
138: ; preds = %101
%139 = load i32, i32* %6
%140 = add nsw i32 %139, -1
store i32 %140, i32* %6
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %142
142: ; preds = %138
%143 = load i32, i32* %4
%144 = add nsw i32 %143, 1
store i32 %144, i32* %4
br label %81
145: ; preds = %81
br label %153
146: ; preds = %74
%147 = load i32, i32* %11
%148 = icmp eq i32 %147, 2
br i1 %148, label %149, label %152
149: ; preds = %146
%150 = load i32, i32* %2
%151 = call i32 @Quick(i32* %31, i32 0, i32 %150)
br label %152
152: ; preds = %149, %146
br label %153
153: ; preds = %152, %145
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %3
br label %155
155: ; preds = %166, %153
%156 = load i32, i32* %3
%157 = load i32, i32* %2
%158 = sub nsw i32 %157, 1
%159 = icmp sle i32 %156, %158
br i1 %159, label %160, label %169
160: ; preds = %155
%161 = load i32, i32* %3
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i32, i32* %34, i64 %162
%164 = load i32, i32* %163
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %164)
br label %166
166: ; preds = %160
%167 = load i32, i32* %3
%168 = add nsw i32 %167, 1
store i32 %168, i32* %3
br label %155
169: ; preds = %155
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %3
br label %171
171: ; preds = %182, %169
%172 = load i32, i32* %3
%173 = load i32, i32* %2
%174 = sub nsw i32 %173, 1
%175 = icmp sle i32 %172, %174
br i1 %175, label %176, label %185
176: ; preds = %171
%177 = load i32, i32* %3
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i32, i32* %31, i64 %178
%180 = load i32, i32* %179
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %180)
br label %182
182: ; preds = %176
%183 = load i32, i32* %3
%184 = add nsw i32 %183, 1
store i32 %184, i32* %3
br label %171
185: ; preds = %171
%186 = call i32 (...) @getchar()
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
%188 = call i32 (...) @getchar()
%189 = load i8*, i8** %8
%190 = load i32, i32* %1
ret i32 %190
}

LLVM IR (-O2):
@.str = [32 x i8] c"\0AQuantos numeros tera o vetor? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\0AInsira o numero %d: \00"
@.str.3 = [15 x i8] c"/usr/bin/clear\00"
@.str.4 = [10 x i8] c"\0A > Menu:\00"
@.str.5 = [29 x i8] c"\0A 1. Troca | Bubble Sort\00"
@.str.6 = [31 x i8] c"\0A 2. Refer\C3\AAncia | QuickSort\00"
@.str.7 = [15 x i8] c"\0A > Resposta: \00"
@.str.9 = [5 x i8] c"[%d]\00"
@.str.11 = [12 x i8] c"\0AOriginal: \00"
@.str.12 = [12 x i8] c"\0AOrdenada: \00"
@str = [12 x i8] c"\0AOrdenando:\00"
@str.14 = [37 x i8] c"\0A\0APressione -Enter- para finalizar!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %4
4: ; preds = %0, %4
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 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* %1)
%7 = load i32, i32* %1
%8 = add i32 %7, -101
%9 = icmp ult i32 %8, -100
br i1 %9, label %4, label %10
10: ; preds = %4
%11 = zext i32 %7 to i64
%12 = call i8* @llvm.stacksave()
%13 = alloca i32, i64 %11
%14 = load i32, i32* %1
%15 = zext i32 %14 to i64
%16 = alloca i32, i64 %15
%17 = bitcast i32* %2 to i8*
store i32 -1, i32* %2
%18 = icmp sgt i32 %14, 0
br i1 %18, label %19, label %31
19: ; preds = %10, %19
%20 = phi i64 [ %21, %19 ], [ 0, %10 ]
%21 = add nuw nsw i64 %20, 1
%22 = trunc i64 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds i32, i32* %13, i64 %20
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
%26 = load i32, i32* %24
%27 = getelementptr inbounds i32, i32* %16, i64 %20
store i32 %26, i32* %27
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %21, %29
br i1 %30, label %19, label %31
31: ; preds = %19, %10
%32 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %33
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%39 = load i32, i32* %2
%40 = add i32 %39, -3
%41 = icmp ult i32 %40, -2
br i1 %41, label %33, label %42
42: ; preds = %33
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%44 = load i32, i32* %2
switch i32 %44, label %115 [
i32 1, label %45
i32 2, label %112
]
45: ; preds = %42
%46 = load i32, i32* %1
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %115
48: ; preds = %45, %107
%49 = phi i32 [ %110, %107 ], [ %46, %45 ]
%50 = phi i32 [ %55, %107 ], [ %46, %45 ]
%51 = phi i32 [ %109, %107 ], [ 0, %45 ]
%52 = xor i32 %51, -1
%53 = add i32 %46, %52
%54 = zext i32 %53 to i64
%55 = add nsw i32 %50, -1
%56 = icmp sgt i32 %49, 0
br i1 %56, label %65, label %57
57: ; preds = %65, %48
%58 = icmp sgt i32 %50, 1
br i1 %58, label %59, label %107
59: ; preds = %57
%60 = load i32, i32* %13
%61 = and i64 %54, 1
%62 = icmp eq i32 %53, 1
br i1 %62, label %96, label %63
63: ; preds = %59
%64 = and i64 %54, 4294967294
br label %74
65: ; preds = %48, %65
%66 = phi i64 [ %70, %65 ], [ 0, %48 ]
%67 = getelementptr inbounds i32, i32* %13, i64 %66
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %68)
%70 = add nuw nsw i64 %66, 1
%71 = load i32, i32* %1
%72 = sext i32 %71 to i64
%73 = icmp slt i64 %70, %72
br i1 %73, label %65, label %57
74: ; preds = %92, %63
%75 = phi i32 [ %60, %63 ], [ %93, %92 ]
%76 = phi i64 [ 0, %63 ], [ %86, %92 ]
%77 = phi i64 [ 0, %63 ], [ %94, %92 ]
%78 = or i64 %76, 1
%79 = getelementptr inbounds i32, i32* %13, i64 %78
%80 = load i32, i32* %79
%81 = icmp sgt i32 %75, %80
br i1 %81, label %82, label %84
82: ; preds = %74
%83 = getelementptr inbounds i32, i32* %13, i64 %76
store i32 %80, i32* %83
store i32 %75, i32* %79
br label %84
84: ; preds = %74, %82
%85 = phi i32 [ %80, %74 ], [ %75, %82 ]
%86 = add nuw nsw i64 %76, 2
%87 = getelementptr inbounds i32, i32* %13, i64 %86
%88 = load i32, i32* %87
%89 = icmp sgt i32 %85, %88
br i1 %89, label %90, label %92
90: ; preds = %84
%91 = getelementptr inbounds i32, i32* %13, i64 %78
store i32 %88, i32* %91
store i32 %85, i32* %87
br label %92
92: ; preds = %90, %84
%93 = phi i32 [ %88, %84 ], [ %85, %90 ]
%94 = add i64 %77, 2
%95 = icmp eq i64 %94, %64
br i1 %95, label %96, label %74
96: ; preds = %92, %59
%97 = phi i32 [ %60, %59 ], [ %93, %92 ]
%98 = phi i64 [ 0, %59 ], [ %86, %92 ]
%99 = icmp eq i64 %61, 0
br i1 %99, label %107, label %100
100: ; preds = %96
%101 = add nuw nsw i64 %98, 1
%102 = getelementptr inbounds i32, i32* %13, i64 %101
%103 = load i32, i32* %102
%104 = icmp sgt i32 %97, %103
br i1 %104, label %105, label %107
105: ; preds = %100
%106 = getelementptr inbounds i32, i32* %13, i64 %98
store i32 %103, i32* %106
store i32 %97, i32* %102
br label %107
107: ; preds = %96, %105, %100, %57
%108 = call i32 @putchar(i32 10)
%109 = add nuw nsw i32 %51, 1
%110 = load i32, i32* %1
%111 = icmp slt i32 %109, %110
br i1 %111, label %48, label %115
112: ; preds = %42
%113 = load i32, i32* %1
%114 = call i32 @Quick(i32* %13, i32 0, i32 %113)
br label %115
115: ; preds = %107, %45, %42, %112
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%117 = load i32, i32* %1
%118 = icmp sgt i32 %117, 0
br i1 %118, label %119, label %128
119: ; preds = %115, %119
%120 = phi i64 [ %124, %119 ], [ 0, %115 ]
%121 = getelementptr inbounds i32, i32* %16, i64 %120
%122 = load i32, i32* %121
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %122)
%124 = add nuw nsw i64 %120, 1
%125 = load i32, i32* %1
%126 = sext i32 %125 to i64
%127 = icmp slt i64 %124, %126
br i1 %127, label %119, label %128
128: ; preds = %119, %115
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%130 = load i32, i32* %1
%131 = icmp sgt i32 %130, 0
br i1 %131, label %132, label %141
132: ; preds = %128, %132
%133 = phi i64 [ %137, %132 ], [ 0, %128 ]
%134 = getelementptr inbounds i32, i32* %13, i64 %133
%135 = load i32, i32* %134
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %135)
%137 = add nuw nsw i64 %133, 1
%138 = load i32, i32* %1
%139 = sext i32 %138 to i64
%140 = icmp slt i64 %137, %139
br i1 %140, label %132, label %141
141: ; preds = %132, %128
%142 = call i32 (...) @getchar()
%143 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.14, i64 0, i64 0))
%144 = call i32 (...) @getchar()
ret i32 0
}