#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 */
char getchar();
int /*<<< orphan*/ manipulador(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char buffer[4096];
  int contador = 0;
  while ((buffer[contador++] = getchar()) != '\n') {
  };
  contador = 1;
  manipulador(buffer);
  contador = 2;
  printf("El valor es : %d\n", contador);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1014(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x1014(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1014(%rbp)
movslq %ecx,%rcx
mov    %al,-0x1010(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     117f <main+0x4f>
jmp    114c <main+0x1c>
movl   $0x1,-0x1014(%rbp)
lea    -0x1010(%rbp),%rdi
call   1050 <manipulador@plt>
movl   $0x2,-0x1014(%rbp)
mov    -0x1014(%rbp),%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1000,%rsp
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1140 <main+0x10>
mov    %rsp,%rdi
call   1050 <manipulador@plt>
lea    0xea0(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"El valor es : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %12, %0
%5 = call signext i8 (...) @getchar()
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %8
store i8 %5, i8* %9
%10 = sext i8 %5 to i32
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %13
12: ; preds = %4
br label %4
13: ; preds = %4
store i32 1, i32* %3
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%15 = call i32 @manipulador(i8* %14)
store i32 2, i32* %3
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"El valor es : %d\0A\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %6, %3 ], [ 0, %0 ]
%5 = tail call signext i8 (...) @getchar()
%6 = add nuw i64 %4, 1
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %4
store i8 %5, i8* %7
%8 = icmp eq i8 %5, 10
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = call i32 @manipulador(i8* %2)
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 2)
ret i32 0
}