#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*/ feof(int /*<<< orphan*/);
char *getline_unlim();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int main() {
  char *line1 = getline_unlim();
  char *line2;
  int count = 1;
  int flag_begin = 1;
  while (!feof(stdin)) {
    line2 = getline_unlim();
    while ((strcmp(line1, line2) == 0) && !feof(stdin)) {
      count++;
      line1 = line2;
      line2 = getline_unlim();
    }
    if (flag_begin == 0) {
      printf("\n");
    } else
      flag_begin = 0;
    printf("%7d %s", count, line1);
    line1 = line2;
    count = 1;
  }
  printf("\n%4d %s\n", count, line1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <getline_unlim@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    118b <main+0x4b>
jmp    124c <main+0x10c>
mov    $0x0,%al
call   1060 <getline_unlim@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
jne    11ce <main+0x8e>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11de <main+0x9e>
jmp    11ff <main+0xbf>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <getline_unlim@plt>
mov    %rax,-0x18(%rbp)
jmp    1196 <main+0x56>
cmpl   $0x0,-0x20(%rbp)
jne    121c <main+0xdc>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1223 <main+0xe3>
movl   $0x0,-0x20(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
jmp    1168 <main+0x28>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <getline_unlim@plt>
mov    %rax,%r15
mov    0x2e7c(%rip),%rbp
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %eax,%eax
je     119f <main+0x4f>
lea    0xe88(%rip),%rdi
mov    $0x1,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
jmp    11d3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe49(%rip),%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
mov    $0x1,%r14b
test   %eax,%eax
jne    1178 <main+0x28>
xor    %eax,%eax
call   1070 <getline_unlim@plt>
mov    %rax,%r13
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <strcmp@plt>
mov    $0x1,%r12d
test   %rax,%rax
jne    11ff <main+0xaf>
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %eax,%eax
je     1217 <main+0xc7>
mov    %r15,%rbx
mov    %r13,%r15
test   $0x1,%r14b
je     11b0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x60>
mov    $0x2,%ecx
mov    %r13,%r15
nop
mov    %r15,%rbx
mov    %ecx,%r12d
xor    %eax,%eax
call   1070 <getline_unlim@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1205 <main+0xb5>
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
lea    0x1(%r12),%ecx
test   %eax,%eax
je     1220 <main+0xd0>
jmp    1205 <main+0xb5>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [7 x i8] c"%7d %s\00"
@.str.2 = [9 x i8] c"\0A%4d %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i8* (...) @getline_unlim()
store i8* %6, i8** %2
store i32 1, i32* %4
store i32 1, i32* %5
br label %7
7: ; preds = %37, %0
%8 = load i32, i32* @stdin
%9 = call i32 @feof(i32 %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %42
12: ; preds = %7
%13 = call i8* (...) @getline_unlim()
store i8* %13, i8** %3
br label %14
14: ; preds = %26, %12
%15 = load i8*, i8** %2
%16 = load i8*, i8** %3
%17 = call i64 @strcmp(i8* %15, i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i32, i32* @stdin
%21 = call i32 @feof(i32 %20)
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
br label %24
24: ; preds = %19, %14
%25 = phi i1 [ false, %14 ], [ %23, %19 ]
br i1 %25, label %26, label %31
26: ; preds = %24
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
%29 = load i8*, i8** %3
store i8* %29, i8** %2
%30 = call i8* (...) @getline_unlim()
store i8* %30, i8** %3
br label %14
31: ; preds = %24
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %37
36: ; preds = %31
store i32 0, i32* %5
br label %37
37: ; preds = %36, %34
%38 = load i32, i32* %4
%39 = load i8*, i8** %2
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %38, i8* %39)
%41 = load i8*, i8** %3
store i8* %41, i8** %2
store i32 1, i32* %4
br label %7
42: ; preds = %7
%43 = load i32, i32* %4
%44 = load i8*, i8** %2
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %43, i8* %44)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [7 x i8] c"%7d %s\00"
@.str.2 = [9 x i8] c"\0A%4d %s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @getline_unlim()
%2 = load i32, i32* @stdin
%3 = tail call i32 @feof(i32 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %37
5: ; preds = %0, %32
%6 = phi i1 [ true, %32 ], [ false, %0 ]
%7 = phi i8* [ %28, %32 ], [ %1, %0 ]
%8 = tail call i8* (...) @getline_unlim()
%9 = tail call i64 @strcmp(i8* %7, i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %5
%12 = load i32, i32* @stdin
%13 = tail call i32 @feof(i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %26
15: ; preds = %19
%16 = load i32, i32* @stdin
%17 = tail call i32 @feof(i32 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %11, %15
%20 = phi i8* [ %23, %15 ], [ %8, %11 ]
%21 = phi i32 [ %22, %15 ], [ 1, %11 ]
%22 = add nuw nsw i32 %21, 1
%23 = tail call i8* (...) @getline_unlim()
%24 = tail call i64 @strcmp(i8* %20, i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %15, label %26
26: ; preds = %19, %15, %11, %5
%27 = phi i8* [ %7, %5 ], [ %7, %11 ], [ %20, %15 ], [ %20, %19 ]
%28 = phi i8* [ %8, %5 ], [ %8, %11 ], [ %23, %15 ], [ %23, %19 ]
%29 = phi i32 [ 1, %5 ], [ 1, %11 ], [ %22, %15 ], [ %22, %19 ]
br i1 %6, label %30, label %32
30: ; preds = %26
%31 = tail call i32 @putchar(i32 10)
br label %32
32: ; preds = %26, %30
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %29, i8* %27)
%34 = load i32, i32* @stdin
%35 = tail call i32 @feof(i32 %34)
%36 = icmp eq i32 %35, 0
br i1 %36, label %5, label %37
37: ; preds = %32, %0
%38 = phi i8* [ %1, %0 ], [ %28, %32 ]
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1, i8* %38)
ret i32 0
}