#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*/ PrintSubTitles(char *);
int /*<<< orphan*/ copia();
int /*<<< orphan*/ copia_apuntador();
int /*<<< orphan*/ copia_indice();
int obtenlinea();
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int longitud;
  extern int max;
  extern char linea_max[1000];
  max = 0;
  while ((longitud = obtenlinea()) > 0) {
    max = longitud;
    if (max > 1) {
      PrintSubTitles("Función copia inicial, indices y apuntadores ");
      copia();
      printf("%s", linea_max);
      copia_indice();
      printf("%s", linea_max);
      copia_apuntador();
      printf("%s\n", linea_max);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e62(%rip),%rax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <obtenlinea@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    120a <main+0xaa>
mov    -0x8(%rbp),%ecx
mov    0x2e3f(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e36(%rip),%rax
cmpl   $0x1,(%rax)
jle    1205 <main+0xa5>
lea    0xe4e(%rip),%rdi
call   1040 <PrintSubTitles@plt>
mov    $0x0,%al
call   1050 <copia@plt>
lea    0xe6a(%rip),%rdi
mov    0x2e14(%rip),%rsi
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <copia_indice@plt>
lea    0xe50(%rip),%rdi
mov    0x2dfa(%rip),%rsi
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <copia_apuntador@plt>
lea    0xe39(%rip),%rdi
mov    0x2de0(%rip),%rsi
call   1060 <printf@plt>
jmp    117c <main+0x1c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2e68(%rip),%r13
movl   $0x0,0x0(%r13)
xor    %eax,%eax
call   1030 <obtenlinea@plt>
test   %eax,%eax
jle    1204 <main+0xa4>
lea    0xe72(%rip),%r14
lea    0xe9a(%rip),%r15
mov    0x2e44(%rip),%rbx
lea    0xe8f(%rip),%r12
jmp    11bb <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <obtenlinea@plt>
test   %eax,%eax
jle    1204 <main+0xa4>
mov    %eax,0x0(%r13)
cmp    $0x1,%eax
je     11b0 <main+0x50>
mov    %r14,%rdi
call   1040 <PrintSubTitles@plt>
xor    %eax,%eax
call   1050 <copia@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <copia_indice@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <copia_apuntador@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
jmp    11b0 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@max = external global i32
@.str = [47 x i8] c"Funci\C3\B3n copia inicial, indices y apuntadores \00"
@.str.1 = [3 x i8] c"%s\00"
@linea_max = external global [1000 x i8]
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* @max
br label %3
3: ; preds = %18, %0
%4 = call i32 (...) @obtenlinea()
store i32 %4, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = load i32, i32* %2
store i32 %7, i32* @max
%8 = load i32, i32* @max
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = call i32 @PrintSubTitles(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (...) @copia()
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
%14 = call i32 (...) @copia_indice()
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
%16 = call i32 (...) @copia_apuntador()
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
br label %18
18: ; preds = %10, %6
br label %3
19: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@max = external global i32
@.str = [47 x i8] c"Funci\C3\B3n copia inicial, indices y apuntadores \00"
@.str.1 = [3 x i8] c"%s\00"
@linea_max = external global [1000 x i8]
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
store i32 0, i32* @max
%1 = tail call i32 (...) @obtenlinea()
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %17
3: ; preds = %0, %14
%4 = phi i32 [ %15, %14 ], [ %1, %0 ]
store i32 %4, i32* @max
%5 = icmp eq i32 %4, 1
br i1 %5, label %14, label %6
6: ; preds = %3
%7 = tail call i32 @PrintSubTitles(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (...) @copia()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
%10 = tail call i32 (...) @copia_indice()
%11 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
%12 = tail call i32 (...) @copia_apuntador()
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
br label %14
14: ; preds = %6, %3
%15 = tail call i32 (...) @obtenlinea()
%16 = icmp sgt i32 %15, 0
br i1 %16, label %3, label %17
17: ; preds = %14, %0
ret i32 0
}