#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ system(char *);
main() {
  int tamanho = 9;
  int voltas = 2;
  int volta_atual = 0;
  int atual = 0;
  int auxiliar = 0;
  int pos_copia = 0;
  int posicao = 0;
  int quantidade = 0;
  int tipo = 0;
  char palavra[tamanho + 2];
  char copia[tamanho + 2];
  for (atual = 0; atual <= tamanho; atual++) {
    palavra[atual] = ' ';
  }
  printf("Insira a string (maximo de %d caracteres): \n> ", tamanho + 1);
  gets(palavra);
  while (tipo != 1 && tipo != 2) {
    printf("Deseja mostrar somente o letreiro (1=Sim; 2=Nao)?");
    scanf("%d", &tipo);
  }
  for (atual = 0; atual <= tamanho; atual++) {
    if (palavra[atual] == '\0')
      palavra[atual] = ' ';
  }
  palavra[tamanho + 1] = '|';
  palavra[tamanho + 2] = '\0';
  system("/usr/bin/clear");
  ;
  if (tipo == 1)
    printf("%s", palavra);
  else
    printf("Original: ...%s...\nLetreiro: ...%s...\nVolta:    %d de %d",
           palavra, palavra, volta_atual + 1, voltas + 1);
  sleep(1);
  ;
  for (atual = 0; atual <= tamanho + 1; atual++) {
    copia[atual] = ' ';
  }
  palavra[tamanho + 2] = '\0';
  for (volta_atual = 0; volta_atual <= voltas; volta_atual++) {
    for (posicao = 0; posicao < tamanho + 1; posicao++) {
      auxiliar++;
      pos_copia = 0;
      for (atual = auxiliar; atual <= tamanho + 1; atual++) {
        copia[pos_copia] = palavra[atual];
        pos_copia++;
      }
      for (pos_copia = pos_copia; pos_copia <= tamanho + 1; pos_copia++) {
        copia[pos_copia] = ' ';
      }
      system("/usr/bin/clear");
      ;
      if (tipo == 1)
        printf("%s", copia);
      else
        printf("Original: ...%s...\nLetreiro: ...%s...\nVolta:    %d de %d",
               palavra, copia, volta_atual + 1, voltas + 1);
      sleep(1);
      ;
      if (auxiliar == tamanho + 1)
        auxiliar = 0;
    }
    quantidade = 0;
    for (atual = 0; atual <= tamanho + 1; atual++) {
      for (pos_copia = 0; pos_copia <= tamanho; pos_copia++) {
        copia[pos_copia] = copia[pos_copia + 1];
      }
      copia[tamanho + 1] = palavra[quantidade];
      system("/usr/bin/clear");
      ;
      if (tipo == 1)
        printf("%s", copia);
      else
        printf("Original: ...%s...\nLetreiro: ...%s...\nVolta:    %d de %d",
               palavra, copia, volta_atual + 1, voltas + 1);
      sleep(1);
      ;
      quantidade++;
    }
    for (atual = 0; atual <= tamanho + 1; atual++) {
      copia[atual] = ' ';
    }
    palavra[tamanho + 2] = '\0';
  }
  printf("\n\nPrograma encerrado...\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x9,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1216 <main+0xc6>
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f0 <main+0xa0>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x50(%rbp),%rdi
call   1050 <gets@plt>
xor    %eax,%eax
cmpl   $0x1,-0x28(%rbp)
mov    %al,-0x51(%rbp)
je     124c <main+0xfc>
cmpl   $0x2,-0x28(%rbp)
setne  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    125c <main+0x10c>
jmp    127f <main+0x12f>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe38(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
jmp    1233 <main+0xe3>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12c6 <main+0x176>
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    12b3 <main+0x163>
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    12b8 <main+0x168>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1286 <main+0x136>
mov    -0x50(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x7c,(%rax,%rcx,1)
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
lea    0xd76(%rip),%rdi
call   1030 <system@plt>
cmpl   $0x1,-0x28(%rbp)
jne    1311 <main+0x1c1>
mov    -0x50(%rbp),%rsi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1334 <main+0x1e4>
mov    -0x50(%rbp),%rdx
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
lea    0xd49(%rip),%rdi
mov    %rdx,%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1370 <main+0x220>
mov    -0x48(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1345 <main+0x1f5>
mov    -0x50(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     15ec <main+0x49c>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    14b7 <main+0x367>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1400 <main+0x2b0>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13c2 <main+0x272>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1431 <main+0x2e1>
mov    -0x48(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1406 <main+0x2b6>
lea    0xc29(%rip),%rdi
call   1030 <system@plt>
cmpl   $0x1,-0x28(%rbp)
jne    145e <main+0x30e>
mov    -0x48(%rbp),%rsi
lea    0xc1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1482 <main+0x332>
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rsi
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
lea    0xbf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    14a4 <main+0x354>
movl   $0x0,-0x18(%rbp)
jmp    14a9 <main+0x359>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    139b <main+0x24b>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     159b <main+0x44b>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     150e <main+0x3be>
mov    -0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14dd <main+0x38d>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
lea    0xb31(%rip),%rdi
call   1030 <system@plt>
cmpl   $0x1,-0x28(%rbp)
jne    1556 <main+0x406>
mov    -0x48(%rbp),%rsi
lea    0xb26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    157a <main+0x42a>
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rsi
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
lea    0xb00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    14c5 <main+0x375>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     15cd <main+0x47d>
mov    -0x48(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    15a2 <main+0x452>
mov    -0x50(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1388 <main+0x238>
lea    0xab9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%r15
movl   $0x0,0xc(%rsp)
movabs $0x2020202020202020,%rax
20 20 20
mov    %rax,(%rsp)
movw   $0x2020,0x8(%rsp)
lea    0xe4b(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rdi
call   1080 <gets@plt>
lea    0xe5f(%rip),%r14
lea    0xed2(%rip),%rbp
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xfffffffd,%eax
cmp    $0xfffffffe,%eax
jb     11e0 <main+0x60>
cmpb   $0x0,(%rsp)
je     14c6 <main+0x346>
cmpb   $0x0,0x1(%rsp)
je     14d5 <main+0x355>
cmpb   $0x0,0x2(%rsp)
je     14e5 <main+0x365>
cmpb   $0x0,0x3(%rsp)
je     14f5 <main+0x375>
cmpb   $0x0,0x4(%rsp)
je     1505 <main+0x385>
cmpb   $0x0,0x5(%rsp)
je     1515 <main+0x395>
cmpb   $0x0,0x6(%rsp)
je     1525 <main+0x3a5>
cmpb   $0x0,0x7(%rsp)
je     1535 <main+0x3b5>
cmpb   $0x0,0x8(%rsp)
je     1545 <main+0x3c5>
cmpb   $0x0,0x9(%rsp)
je     1555 <main+0x3d5>
movw   $0x7c,0xa(%rsp)
lea    0xde5(%rip),%rdi
call   1040 <system@plt>
cmpl   $0x1,0xc(%rsp)
mov    %r15,0x20(%rsp)
jne    12a0 <main+0x120>
lea    0xddc(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12bf <main+0x13f>
lea    0xdcc(%rip),%rdi
mov    %rsp,%rdx
mov    %rdx,%rsi
mov    $0x1,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1(%rsp),%rbp
mov    $0x1,%edi
call   10a0 <sleep@plt>
movabs $0x2020202020202020,%rax
20 20 20
mov    %rax,0x10(%rsp)
movl   $0x20202020,0x17(%rsp)
20
movb   $0x0,0xb(%rsp)
lea    0x10(%rsp),%r14
xor    %ebx,%ebx
xor    %r13d,%r13d
jmp    132c <main+0x1ac>
cs nopw 0x0(%rax,%rax,1)
movabs $0x2020202020202020,%rax
20 20 20
mov    %rax,0x10(%rsp)
movl   $0x20202020,0x17(%rsp)
20
movb   $0x0,0xb(%rsp)
mov    %r12d,%ebx
cmp    $0x3,%r12d
mov    %r15,%rbp
je     14a4 <main+0x324>
add    $0x1,%ebx
mov    $0xa,%r12d
jmp    137d <main+0x1fd>
nopw   0x0(%rax,%rax,1)
lea    0xd2c(%rip),%rdi
mov    %rsp,%rsi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
cmp    $0xa,%r13d
mov    $0x0,%eax
cmove  %eax,%r13d
add    $0xffffffff,%r12d
je     1420 <main+0x2a0>
cmp    $0x9,%r13d
jg     13b0 <main+0x230>
movslq %r13d,%rsi
add    %rbp,%rsi
mov    $0x9,%r15d
sub    %r13d,%r15d
add    $0x1,%r15
mov    %r14,%rdi
mov    %r15,%rdx
call   1070 <memcpy@plt>
cmp    $0xa,%r15d
jbe    13b3 <main+0x233>
jmp    13e2 <main+0x262>
nopl   0x0(%rax)
xor    %r15d,%r15d
mov    %r15d,%eax
cmp    $0xb,%r13d
mov    $0xa,%ecx
cmovge %r13d,%ecx
lea    (%rsp,%rax,1),%rdi
add    $0x10,%rdi
neg    %ecx
lea    (%rcx,%r13,1),%edx
add    $0xa,%edx
add    $0x1,%rdx
mov    $0x20,%esi
call   1060 <memset@plt>
add    $0x1,%r13d
lea    0xc74(%rip),%rdi
call   1040 <system@plt>
cmpl   $0x1,0xc(%rsp)
jne    1340 <main+0x1c0>
lea    0xc6c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    135c <main+0x1dc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%r12d
mov    %rbp,%r15
xor    %ebp,%ebp
lea    0x11(%rsp),%rbx
jmp    1465 <main+0x2e5>
nop
lea    0xc3c(%rip),%rdi
mov    %rsp,%rsi
mov    %r14,%rdx
mov    %r12d,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
add    $0x1,%rbp
cmp    $0xb,%rbp
je     1300 <main+0x180>
mov    (%rbx),%rax
movzwl 0x8(%rbx),%ecx
mov    %cx,0x18(%rsp)
mov    %rax,0x10(%rsp)
movzbl (%rsp,%rbp,1),%eax
mov    %al,0x1a(%rsp)
lea    0xbdc(%rip),%rdi
call   1040 <system@plt>
cmpl   $0x1,0xc(%rsp)
jne    1430 <main+0x2b0>
lea    0xbd8(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    144d <main+0x2cd>
lea    0xc01(%rip),%rdi
call   1030 <puts@plt>
mov    0x20(%rsp),%rsp
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movb   $0x20,(%rsp)
cmpb   $0x0,0x1(%rsp)
jne    1216 <main+0x96>
movb   $0x20,0x1(%rsp)
cmpb   $0x0,0x2(%rsp)
jne    1221 <main+0xa1>
movb   $0x20,0x2(%rsp)
cmpb   $0x0,0x3(%rsp)
jne    122c <main+0xac>
movb   $0x20,0x3(%rsp)
cmpb   $0x0,0x4(%rsp)
jne    1237 <main+0xb7>
movb   $0x20,0x4(%rsp)
cmpb   $0x0,0x5(%rsp)
jne    1242 <main+0xc2>
movb   $0x20,0x5(%rsp)
cmpb   $0x0,0x6(%rsp)
jne    124d <main+0xcd>
movb   $0x20,0x6(%rsp)
cmpb   $0x0,0x7(%rsp)
jne    1258 <main+0xd8>
movb   $0x20,0x7(%rsp)
cmpb   $0x0,0x8(%rsp)
jne    1263 <main+0xe3>
movb   $0x20,0x8(%rsp)
cmpb   $0x0,0x9(%rsp)
jne    126e <main+0xee>
movb   $0x20,0x9(%rsp)
jmp    126e <main+0xee>

LLVM IR (-O0):
@.str = [47 x i8] c"Insira a string (maximo de %d caracteres): \0A> \00"
@.str.1 = [50 x i8] c"Deseja mostrar somente o letreiro (1=Sim; 2=Nao)?\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [15 x i8] c"/usr/bin/clear\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [57 x i8] c"Original: ...%s...\0ALetreiro: ...%s...\0AVolta: %d de %d\00"
@.str.6 = [26 x i8] c"\0A\0APrograma encerrado...\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
store i32 0, i32* %1
store i32 9, i32* %2
store i32 2, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 2
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %11
%18 = alloca i8, i64 %16
store i64 %16, i64* %12
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 2
%21 = zext i32 %20 to i64
%22 = alloca i8, i64 %21
store i64 %21, i64* %13
store i32 0, i32* %5
br label %23
23: ; preds = %31, %0
%24 = load i32, i32* %5
%25 = load i32, i32* %2
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %18, i64 %29
store i8 32, i8* %30
br label %31
31: ; preds = %27
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %23
34: ; preds = %23
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = call i32 @gets(i8* %18)
br label %39
39: ; preds = %47, %34
%40 = load i32, i32* %10
%41 = icmp ne i32 %40, 1
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* %10
%44 = icmp ne i32 %43, 2
br label %45
45: ; preds = %42, %39
%46 = phi i1 [ false, %39 ], [ %44, %42 ]
br i1 %46, label %47, label %50
47: ; preds = %45
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%49 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
br label %39
50: ; preds = %45
store i32 0, i32* %5
br label %51
51: ; preds = %67, %50
%52 = load i32, i32* %5
%53 = load i32, i32* %2
%54 = icmp sle i32 %52, %53
br i1 %54, label %55, label %70
55: ; preds = %51
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %18, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %55
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %18, i64 %64
store i8 32, i8* %65
br label %66
66: ; preds = %62, %55
br label %67
67: ; preds = %66
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 1
store i32 %69, i32* %5
br label %51
70: ; preds = %51
%71 = load i32, i32* %2
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %18, i64 %73
store i8 124, i8* %74
%75 = load i32, i32* %2
%76 = add nsw i32 %75, 2
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %18, i64 %77
store i8 0, i8* %78
%79 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%80 = load i32, i32* %10
%81 = icmp eq i32 %80, 1
br i1 %81, label %82, label %84
82: ; preds = %70
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %18)
br label %90
84: ; preds = %70
%85 = load i32, i32* %4
%86 = add nsw i32 %85, 1
%87 = load i32, i32* %3
%88 = add nsw i32 %87, 1
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %18, i8* %18, i32 %86, i32 %88)
br label %90
90: ; preds = %84, %82
%91 = call i32 @sleep(i32 1)
store i32 0, i32* %5
br label %92
92: ; preds = %101, %90
%93 = load i32, i32* %5
%94 = load i32, i32* %2
%95 = add nsw i32 %94, 1
%96 = icmp sle i32 %93, %95
br i1 %96, label %97, label %104
97: ; preds = %92
%98 = load i32, i32* %5
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %22, i64 %99
store i8 32, i8* %100
br label %101
101: ; preds = %97
%102 = load i32, i32* %5
%103 = add nsw i32 %102, 1
store i32 %103, i32* %5
br label %92
104: ; preds = %92
%105 = load i32, i32* %2
%106 = add nsw i32 %105, 2
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %18, i64 %107
store i8 0, i8* %108
store i32 0, i32* %4
br label %109
109: ; preds = %246, %104
%110 = load i32, i32* %4
%111 = load i32, i32* %3
%112 = icmp sle i32 %110, %111
br i1 %112, label %113, label %249
113: ; preds = %109
store i32 0, i32* %8
br label %114
114: ; preds = %175, %113
%115 = load i32, i32* %8
%116 = load i32, i32* %2
%117 = add nsw i32 %116, 1
%118 = icmp slt i32 %115, %117
br i1 %118, label %119, label %178
119: ; preds = %114
%120 = load i32, i32* %6
%121 = add nsw i32 %120, 1
store i32 %121, i32* %6
store i32 0, i32* %7
%122 = load i32, i32* %6
store i32 %122, i32* %5
br label %123
123: ; preds = %138, %119
%124 = load i32, i32* %5
%125 = load i32, i32* %2
%126 = add nsw i32 %125, 1
%127 = icmp sle i32 %124, %126
br i1 %127, label %128, label %141
128: ; preds = %123
%129 = load i32, i32* %5
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %18, i64 %130
%132 = load i8, i8* %131
%133 = load i32, i32* %7
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8, i8* %22, i64 %134
store i8 %132, i8* %135
%136 = load i32, i32* %7
%137 = add nsw i32 %136, 1
store i32 %137, i32* %7
br label %138
138: ; preds = %128
%139 = load i32, i32* %5
%140 = add nsw i32 %139, 1
store i32 %140, i32* %5
br label %123
141: ; preds = %123
%142 = load i32, i32* %7
store i32 %142, i32* %7
br label %143
143: ; preds = %152, %141
%144 = load i32, i32* %7
%145 = load i32, i32* %2
%146 = add nsw i32 %145, 1
%147 = icmp sle i32 %144, %146
br i1 %147, label %148, label %155
148: ; preds = %143
%149 = load i32, i32* %7
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i8, i8* %22, i64 %150
store i8 32, i8* %151
br label %152
152: ; preds = %148
%153 = load i32, i32* %7
%154 = add nsw i32 %153, 1
store i32 %154, i32* %7
br label %143
155: ; preds = %143
%156 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%157 = load i32, i32* %10
%158 = icmp eq i32 %157, 1
br i1 %158, label %159, label %161
159: ; preds = %155
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %22)
br label %167
161: ; preds = %155
%162 = load i32, i32* %4
%163 = add nsw i32 %162, 1
%164 = load i32, i32* %3
%165 = add nsw i32 %164, 1
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %18, i8* %22, i32 %163, i32 %165)
br label %167
167: ; preds = %161, %159
%168 = call i32 @sleep(i32 1)
%169 = load i32, i32* %6
%170 = load i32, i32* %2
%171 = add nsw i32 %170, 1
%172 = icmp eq i32 %169, %171
br i1 %172, label %173, label %174
173: ; preds = %167
store i32 0, i32* %6
br label %174
174: ; preds = %173, %167
br label %175
175: ; preds = %174
%176 = load i32, i32* %8
%177 = add nsw i32 %176, 1
store i32 %177, i32* %8
br label %114
178: ; preds = %114
store i32 0, i32* %9
store i32 0, i32* %5
br label %179
179: ; preds = %225, %178
%180 = load i32, i32* %5
%181 = load i32, i32* %2
%182 = add nsw i32 %181, 1
%183 = icmp sle i32 %180, %182
br i1 %183, label %184, label %228
184: ; preds = %179
store i32 0, i32* %7
br label %185
185: ; preds = %198, %184
%186 = load i32, i32* %7
%187 = load i32, i32* %2
%188 = icmp sle i32 %186, %187
br i1 %188, label %189, label %201
189: ; preds = %185
%190 = load i32, i32* %7
%191 = add nsw i32 %190, 1
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds i8, i8* %22, i64 %192
%194 = load i8, i8* %193
%195 = load i32, i32* %7
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i8, i8* %22, i64 %196
store i8 %194, i8* %197
br label %198
198: ; preds = %189
%199 = load i32, i32* %7
%200 = add nsw i32 %199, 1
store i32 %200, i32* %7
br label %185
201: ; preds = %185
%202 = load i32, i32* %9
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i8, i8* %18, i64 %203
%205 = load i8, i8* %204
%206 = load i32, i32* %2
%207 = add nsw i32 %206, 1
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds i8, i8* %22, i64 %208
store i8 %205, i8* %209
%210 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%211 = load i32, i32* %10
%212 = icmp eq i32 %211, 1
br i1 %212, label %213, label %215
213: ; preds = %201
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %22)
br label %221
215: ; preds = %201
%216 = load i32, i32* %4
%217 = add nsw i32 %216, 1
%218 = load i32, i32* %3
%219 = add nsw i32 %218, 1
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %18, i8* %22, i32 %217, i32 %219)
br label %221
221: ; preds = %215, %213
%222 = call i32 @sleep(i32 1)
%223 = load i32, i32* %9
%224 = add nsw i32 %223, 1
store i32 %224, i32* %9
br label %225
225: ; preds = %221
%226 = load i32, i32* %5
%227 = add nsw i32 %226, 1
store i32 %227, i32* %5
br label %179
228: ; preds = %179
store i32 0, i32* %5
br label %229
229: ; preds = %238, %228
%230 = load i32, i32* %5
%231 = load i32, i32* %2
%232 = add nsw i32 %231, 1
%233 = icmp sle i32 %230, %232
br i1 %233, label %234, label %241
234: ; preds = %229
%235 = load i32, i32* %5
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds i8, i8* %22, i64 %236
store i8 32, i8* %237
br label %238
238: ; preds = %234
%239 = load i32, i32* %5
%240 = add nsw i32 %239, 1
store i32 %240, i32* %5
br label %229
241: ; preds = %229
%242 = load i32, i32* %2
%243 = add nsw i32 %242, 2
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds i8, i8* %18, i64 %244
store i8 0, i8* %245
br label %246
246: ; preds = %241
%247 = load i32, i32* %4
%248 = add nsw i32 %247, 1
store i32 %248, i32* %4
br label %109
249: ; preds = %109
%250 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%251 = load i8*, i8** %11
%252 = load i32, i32* %1
ret i32 %252
}

LLVM IR (-O2):
@.str = [47 x i8] c"Insira a string (maximo de %d caracteres): \0A> \00"
@.str.1 = [50 x i8] c"Deseja mostrar somente o letreiro (1=Sim; 2=Nao)?\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [15 x i8] c"/usr/bin/clear\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [57 x i8] c"Original: ...%s...\0ALetreiro: ...%s...\0AVolta: %d de %d\00"
@str = [25 x i8] c"\0A\0APrograma encerrado...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i8* @llvm.stacksave()
%4 = alloca [11 x i8]
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%6 = alloca [11 x i8]
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 10)
%11 = call i32 @gets(i8* %9)
br label %15
12: ; preds = %15
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %21, label %22
15: ; preds = %0, %15
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = add i32 %18, -3
%20 = icmp ult i32 %19, -2
br i1 %20, label %15, label %12
21: ; preds = %12
store i8 32, i8* %9
br label %22
22: ; preds = %12, %21
%23 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
store i8 32, i8* %23
br label %27
27: ; preds = %26, %22
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 2
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27
store i8 32, i8* %28
br label %32
32: ; preds = %31, %27
%33 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 3
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %32
store i8 32, i8* %33
br label %37
37: ; preds = %36, %32
%38 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 4
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %37
store i8 32, i8* %38
br label %42
42: ; preds = %41, %37
%43 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 5
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %42
store i8 32, i8* %43
br label %47
47: ; preds = %46, %42
%48 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 6
%49 = load i8, i8* %48
%50 = icmp eq i8 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %47
store i8 32, i8* %48
br label %52
52: ; preds = %51, %47
%53 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 7
%54 = load i8, i8* %53
%55 = icmp eq i8 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %52
store i8 32, i8* %53
br label %57
57: ; preds = %56, %52
%58 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 8
%59 = load i8, i8* %58
%60 = icmp eq i8 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %57
store i8 32, i8* %58
br label %62
62: ; preds = %61, %57
%63 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 9
%64 = load i8, i8* %63
%65 = icmp eq i8 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %62
store i8 32, i8* %63
br label %67
67: ; preds = %66, %62
%68 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 10
store i8 124, i8* %68
%69 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 11
store i8 0, i8* %69
%70 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%71 = load i32, i32* %1
%72 = icmp eq i32 %71, 1
br i1 %72, label %73, label %75
73: ; preds = %67
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
br label %77
75: ; preds = %67
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %9, i8* %9, i32 1, i32 3)
br label %77
77: ; preds = %75, %73
%78 = call i32 @sleep(i32 1)
store i8 0, i8* %69
%79 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 10
%80 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 1
br label %81
81: ; preds = %77, %136
%82 = phi i32 [ 0, %77 ], [ %84, %136 ]
%83 = phi i32 [ 0, %77 ], [ %118, %136 ]
%84 = add nuw nsw i32 %82, 1
br label %85
85: ; preds = %81, %115
%86 = phi i32 [ %83, %81 ], [ %118, %115 ]
%87 = phi i32 [ 0, %81 ], [ %119, %115 ]
%88 = add nsw i32 %86, 1
%89 = icmp slt i32 %86, 10
br i1 %89, label %90, label %98
90: ; preds = %85
%91 = sext i32 %86 to i64
%92 = getelementptr i8, i8* %23, i64 %91
%93 = sub i32 9, %86
%94 = zext i32 %93 to i64
%95 = add nuw nsw i64 %94, 1
%96 = trunc i64 %95 to i32
%97 = icmp ult i32 %96, 11
br i1 %97, label %98, label %107
98: ; preds = %85, %90
%99 = phi i64 [ %95, %90 ], [ 0, %85 ]
%100 = and i64 %99, 4294967295
%101 = getelementptr [11 x i8], [11 x i8]* %6, i64 0, i64 %100
%102 = add i32 %86, 10
%103 = call i32 @llvm.smax.i32(i32 %86, i32 10)
%104 = sub i32 %102, %103
%105 = zext i32 %104 to i64
%106 = add nuw nsw i64 %105, 1
br label %107
107: ; preds = %98, %90
%108 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%109 = load i32, i32* %1
%110 = icmp eq i32 %109, 1
br i1 %110, label %111, label %113
111: ; preds = %107
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %115
113: ; preds = %107
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %9, i8* %8, i32 %84, i32 3)
br label %115
115: ; preds = %113, %111
%116 = call i32 @sleep(i32 1)
%117 = icmp eq i32 %88, 10
%118 = select i1 %117, i32 0, i32 %88
%119 = add nuw nsw i32 %87, 1
%120 = icmp eq i32 %119, 10
br i1 %120, label %121, label %85
121: ; preds = %115, %132
%122 = phi i64 [ %134, %132 ], [ 0, %115 ]
%123 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 %122
%124 = load i8, i8* %123
store i8 %124, i8* %79
%125 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%126 = load i32, i32* %1
%127 = icmp eq i32 %126, 1
br i1 %127, label %128, label %130
128: ; preds = %121
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %132
130: ; preds = %121
%131 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %9, i8* %8, i32 %84, i32 3)
br label %132
132: ; preds = %130, %128
%133 = call i32 @sleep(i32 1)
%134 = add nuw nsw i64 %122, 1
%135 = icmp eq i64 %134, 11
br i1 %135, label %136, label %121
136: ; preds = %132
store i8 0, i8* %69
%137 = icmp eq i32 %84, 3
br i1 %137, label %138, label %81
138: ; preds = %136
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret i32 0
}