#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  FILE *fp;
  int a, b = -1, c = 1;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "%d", &a) != EOF) {
    if (a == b) {
      c++;
    } else {
      if (b >= 0) {
        printf("%d %d ", c, b);
        c = 1;
      }
      b = a;
    }
    if (getc(fp) != ' ') {
      printf("%d %d\n", c, b);
      b = -1;
      c = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     118f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    125e <main+0x11e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe69(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe57(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <fscanf@plt>
mov    0x2e1b(%rip),%rcx
cmp    (%rcx),%rax
je     1257 <main+0x117>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    11f0 <main+0xb0>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    121b <main+0xdb>
cmpl   $0x0,-0x20(%rbp)
jl     1215 <main+0xd5>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
movsbl %al,%eax
cmp    $0x20,%eax
je     1252 <main+0x112>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
jmp    11b2 <main+0x72>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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
cmp    $0x2,%edi
jne    123f <main+0xff>
mov    0x8(%rsi),%rdi
lea    0xeb3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xea6(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    %rax,%rcx
mov    0x2e63(%rip),%r12
xor    %eax,%eax
cmp    (%r12),%rcx
je     1259 <main+0x119>
mov    $0xffffffff,%r13d
mov    $0x1,%ebp
lea    0xe71(%rip),%r14
lea    0x4(%rsp),%r15
jmp    11c8 <main+0x88>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <fscanf@plt>
cmp    (%r12),%rax
je     1257 <main+0x117>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
jne    11e0 <main+0xa0>
add    $0x1,%ebp
jmp    1210 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
test   %r13d,%r13d
js     1204 <main+0xc4>
lea    0xe2b(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    0x4(%rsp),%r13d
jmp    1210 <main+0xd0>
mov    %eax,%r13d
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    $0x20,%al
je     11b0 <main+0x70>
lea    0xdfb(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    $0xffffffff,%r13d
jmp    11b0 <main+0x70>
mov    (%rsi),%rsi
lea    0xdb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
jmp    1259 <main+0x119>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.3 = [7 x i8] c"%d %d \00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %8
store i32 1, i32* %9
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %54
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i32 1
store i8** %19, i8*** %5
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %6
br label %22
22: ; preds = %52, %17
%23 = load i32*, i32** %6
%24 = call i64 @fscanf(i32* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%25 = load i64, i64* @EOF
%26 = icmp ne i64 %24, %25
br i1 %26, label %27, label %53
27: ; preds = %22
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %43
34: ; preds = %27
%35 = load i32, i32* %8
%36 = icmp sge i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load i32, i32* %9
%39 = load i32, i32* %8
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %38, i32 %39)
store i32 1, i32* %9
br label %41
41: ; preds = %37, %34
%42 = load i32, i32* %7
store i32 %42, i32* %8
br label %43
43: ; preds = %41, %31
%44 = load i32*, i32** %6
%45 = call signext i8 @getc(i32* %44)
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 32
br i1 %47, label %48, label %52
48: ; preds = %43
%49 = load i32, i32* %9
%50 = load i32, i32* %8
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %49, i32 %50)
store i32 -1, i32* %8
store i32 1, i32* %9
br label %52
52: ; preds = %48, %43
br label %22
53: ; preds = %22
store i32 0, i32* %3
br label %54
54: ; preds = %53, %12
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.3 = [7 x i8] c"%d %d \00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %41
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %41, label %16
16: ; preds = %9, %35
%17 = phi i32 [ %37, %35 ], [ 1, %9 ]
%18 = phi i32 [ %36, %35 ], [ -1, %9 ]
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, %18
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = add nsw i32 %17, 1
br label %28
23: ; preds = %16
%24 = icmp sgt i32 %18, -1
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %18)
%27 = load i32, i32* %3
br label %28
28: ; preds = %23, %25, %21
%29 = phi i32 [ %18, %21 ], [ %27, %25 ], [ %19, %23 ]
%30 = phi i32 [ %22, %21 ], [ 1, %25 ], [ %17, %23 ]
%31 = call signext i8 @getc(i32* %12)
%32 = icmp eq i8 %31, 32
br i1 %32, label %35, label %33
33: ; preds = %28
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %30, i32 %29)
br label %35
35: ; preds = %33, %28
%36 = phi i32 [ -1, %33 ], [ %29, %28 ]
%37 = phi i32 [ 1, %33 ], [ %30, %28 ]
%38 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%39 = load i64, i64* @EOF
%40 = icmp eq i64 %38, %39
br i1 %40, label %41, label %16
41: ; preds = %35, %9, %6
%42 = phi i32 [ 1, %6 ], [ 0, %9 ], [ 0, %35 ]
ret i32 %42
}