#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 */
#define EOF 128
int /*<<< orphan*/ *fopen(char *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  FILE *fp;
  char c, p = '\n';
  int m = 10, dots = 0;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while ((c = getc(fp)) != EOF || p != '\n') {
    switch (c) {
    case '\n':
    case EOF:
      if (dots < m)
        m = dots;
      printf("%d\n", m);
      p = '\n';
      m = 10;
      dots = 0;
      break;
    case '.':
      if (p != 'Y')
        dots++;
      break;
    case ',':
      if (dots < m)
        m = dots;
      dots = 0;
    default:
      p = c;
    }
  }
  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)
movb   $0xa,-0x1a(%rbp)
movl   $0xa,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1183 <main+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12ad <main+0x17d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe75(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <getc@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0x80,%ecx
mov    %al,-0x25(%rbp)
jne    11d3 <main+0xa3>
movsbl -0x1a(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11e3 <main+0xb3>
jmp    12a6 <main+0x176>
movsbl -0x19(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0xa,%eax
je     122d <main+0xfd>
jmp    11f8 <main+0xc8>
mov    -0x2c(%rbp),%eax
sub    $0x2c,%eax
je     1282 <main+0x152>
jmp    1209 <main+0xd9>
mov    -0x2c(%rbp),%eax
sub    $0x2e,%eax
je     1267 <main+0x137>
jmp    121a <main+0xea>
mov    -0x2c(%rbp),%eax
sub    $0x80,%eax
jne    129b <main+0x16b>
jmp    122d <main+0xfd>
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    123f <main+0x10f>
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0xa,-0x1a(%rbp)
movl   $0xa,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
jmp    12a1 <main+0x171>
movsbl -0x1a(%rbp),%eax
cmp    $0x59,%eax
je     127d <main+0x14d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12a1 <main+0x171>
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1294 <main+0x164>
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x19(%rbp),%al
mov    %al,-0x1a(%rbp)
jmp    11a6 <main+0x76>
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   %r12
push   %rbx
cmp    $0x2,%edi
jne    11c8 <main+0x98>
mov    0x8(%rsi),%rdi
lea    0xec6(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%r12
mov    $0xa,%r15d
mov    $0xa,%al
lea    0xeb1(%rip),%r14
jmp    1177 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r15d,%ebp
cmovl  %ebp,%r15d
xor    %ebp,%ebp
xor    %ebx,%ebx
cmp    $0x59,%al
setne  %bl
mov    %r12,%rdi
call   1050 <getc@plt>
movsbl %al,%eax
cmp    $0x2e,%eax
jne    11a0 <main+0x70>
add    %ebx,%ebp
jmp    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x2c,%eax
je     1170 <main+0x40>
cmp    $0xa,%eax
jne    1179 <main+0x49>
cmp    %r15d,%ebp
cmovl  %ebp,%r15d
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xa,%r15d
mov    $0xa,%al
jmp    1177 <main+0x47>
mov    (%rsi),%rsi
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
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 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 10, i8* %8
store i32 10, i32* %9
store i32 0, i32* %10
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %65
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i32 1
store i8** %20, i8*** %5
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
br label %23
23: ; preds = %63, %18
%24 = load i32*, i32** %6
%25 = call signext i8 @getc(i32* %24)
store i8 %25, i8* %7
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 128
br i1 %27, label %32, label %28
28: ; preds = %23
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 10
br label %32
32: ; preds = %28, %23
%33 = phi i1 [ true, %23 ], [ %31, %28 ]
br i1 %33, label %34, label %64
34: ; preds = %32
%35 = load i8, i8* %7
%36 = sext i8 %35 to i32
switch i32 %36, label %61 [
i32 10, label %37
i32 128, label %37
i32 46, label %46
i32 44, label %54
]
37: ; preds = %34, %34
%38 = load i32, i32* %10
%39 = load i32, i32* %9
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = load i32, i32* %10
store i32 %42, i32* %9
br label %43
43: ; preds = %41, %37
%44 = load i32, i32* %9
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %44)
store i8 10, i8* %8
store i32 10, i32* %9
store i32 0, i32* %10
br label %63
46: ; preds = %34
%47 = load i8, i8* %8
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 89
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %10
br label %53
53: ; preds = %50, %46
br label %63
54: ; preds = %34
%55 = load i32, i32* %10
%56 = load i32, i32* %9
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = load i32, i32* %10
store i32 %59, i32* %9
br label %60
60: ; preds = %58, %54
store i32 0, i32* %10
br label %61
61: ; preds = %34, %60
%62 = load i8, i8* %7
store i8 %62, i8* %8
br label %63
63: ; preds = %61, %53, %43
br label %23
64: ; preds = %32
store i32 0, i32* %3
br label %65
65: ; preds = %64, %13
%66 = load i32, i32* %3
ret i32 %66
}

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