#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int c;
  int n = 0;
  int l = 0;
  while ((c = getchar()) != EOF) {
    n = n + 1;
    if (c == '\n') {
      l = l + 1;
    }
  }
  printf("Numero de caracteres : %d\n", n);
  printf("Numero de lineas : %d\n", l);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     1177 <main+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    1172 <main+0x52>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb4(%rip),%r14
mov    $0x0,%ebp
cmp    (%r14),%eax
je     1169 <main+0x49>
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
jne    1150 <main+0x30>
lea    0xe90(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [27 x i8] c"Numero de caracteres : %d\0A\00"
@.str.1 = [23 x i8] c"Numero de lineas : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %17, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %17
17: ; preds = %14, %9
br label %5
18: ; preds = %5
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [27 x i8] c"Numero de caracteres : %d\0A\00"
@.str.1 = [23 x i8] c"Numero de lineas : %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %15, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %12, %4 ], [ %1, %0 ]
%6 = phi i32 [ %11, %4 ], [ 0, %0 ]
%7 = phi i32 [ %8, %4 ], [ 0, %0 ]
%8 = add nuw nsw i32 %7, 1
%9 = icmp eq i32 %5, 10
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %6, %10
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %4
15: ; preds = %4, %0
%16 = phi i32 [ 0, %0 ], [ %8, %4 ]
%17 = phi i32 [ 0, %0 ], [ %11, %4 ]
%18 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %16)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}