#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 */
long atol(int /*<<< orphan*/);
scalar_t__ gets(char *);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ strtok(char *, char *);
main() {
  long pid, cid, count;
  char t[200];
  pid = -1;
  cid = 0;
  count = 0;
  while (gets(t)) {
    cid = atol(strtok(t, ":"));
    if (cid != pid) {
      pid = cid;
      continue;
    }
    count++;
  }
  printf("%ld\n", count);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0xf0(%rbp),%rdi
call   1040 <gets@plt>
cmp    $0x0,%rax
je     11ca <main+0x8a>
lea    -0xf0(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1060 <strtok@plt>
mov    %eax,%edi
call   1050 <atol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     11b9 <main+0x79>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    116a <main+0x2a>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    116a <main+0x2a>
mov    -0x20(%rbp),%rsi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd0,%rsp
mov    %rsp,%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     11a2 <main+0x62>
mov    $0xffffffffffffffff,%r13
xor    %ebx,%ebx
lea    0xe93(%rip),%r14
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <strtok@plt>
mov    %eax,%edi
call   1050 <atol@plt>
mov    %rax,%r12
xor    %eax,%eax
cmp    %r13,%r12
sete   %al
add    %rax,%rbx
mov    %r15,%rdi
call   1040 <gets@plt>
mov    %r12,%r13
test   %rax,%rax
jne    1170 <main+0x30>
jmp    11a4 <main+0x64>
xor    %ebx,%ebx
lea    0xe57(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = call i64 @gets(i8* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %0, %5
%6 = phi i64 [ %12, %5 ], [ 0, %0 ]
%7 = phi i64 [ %9, %5 ], [ -1, %0 ]
%8 = call i32 @strtok(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = call i64 @atol(i32 %8)
%10 = icmp eq i64 %9, %7
%11 = zext i1 %10 to i64
%12 = add nuw nsw i64 %6, %11
%13 = call i64 @gets(i8* %2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %0
%16 = phi i64 [ 0, %0 ], [ %12, %5 ]
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %16)
ret i32 0
}