#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;
char getc(int /*<<< orphan*/ *);
int count_domain(FILE *IN) {
  int N, col, comment;
  char c;
  N = 0;
  comment = 0;
  col = 0;
  while ((c = getc(IN)) != (char)EOF) {
    if ((col == 0) && (c == '#' || c == '%')) {
      comment = 1;
    }
    if (col != 0 && !comment && c == '{')
      N++;
    col++;
    if (c == '\n') {
      col = 0;
      comment = 0;
    }
  }
  return N;
}


x86 assembly (clang, -O0):
<count_domain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
mov    0x2ea1(%rip),%rcx
mov    (%rcx),%rcx
movsbl %cl,%ecx
cmp    %ecx,%eax
je     11d3 <count_domain+0xc3>
cmpl   $0x0,-0x10(%rbp)
jne    1180 <count_domain+0x70>
movsbl -0x15(%rbp),%eax
cmp    $0x23,%eax
je     1179 <count_domain+0x69>
movsbl -0x15(%rbp),%eax
cmp    $0x25,%eax
jne    1180 <count_domain+0x70>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11aa <count_domain+0x9a>
cmpl   $0x0,-0x14(%rbp)
jne    11aa <count_domain+0x9a>
movsbl -0x15(%rbp),%eax
cmp    $0x7b,%eax
jne    11aa <count_domain+0x9a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0xa,%eax
jne    11ce <count_domain+0xbe>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    1131 <count_domain+0x21>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_domain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <getc@plt>
movsbl %al,%ecx
mov    0x2ebb(%rip),%r14
movsbl (%r14),%edx
xor    %r13d,%r13d
cmp    %ecx,%edx
jne    114a <count_domain+0x3a>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    119e <count_domain+0x8e>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%ebp
test   %ebx,%ebx
setne  %cl
test   %ebp,%ebp
sete   %dl
and    %cl,%dl
cmp    $0x7b,%al
sete   %cl
and    %dl,%cl
movzbl %cl,%ecx
add    %ecx,%r13d
add    $0x1,%ebx
cmp    $0xa,%al
cmove  %r12d,%ebx
cmove  %r12d,%ebp
mov    %r15,%rdi
call   1030 <getc@plt>
movsbl %al,%ecx
movsbl (%r14),%edx
cmp    %ecx,%edx
je     1138 <count_domain+0x28>
test   %ebx,%ebx
jne    1165 <count_domain+0x55>
cmp    $0x25,%al
je     1160 <count_domain+0x50>
cmp    $0x23,%al
je     1160 <count_domain+0x50>
jmp    1165 <count_domain+0x55>

LLVM IR (-O0):
@EOF = global i64 0
define i32 @count_domain(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %5
store i32 0, i32* %4
br label %7
7: ; preds = %47, %1
%8 = load i32*, i32** %2
%9 = call signext i8 @getc(i32* %8)
store i8 %9, i8* %6
%10 = sext i8 %9 to i32
%11 = load i64, i64* @EOF
%12 = trunc i64 %11 to i8
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %10, %13
br i1 %14, label %15, label %48
15: ; preds = %7
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 35
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 37
br i1 %25, label %26, label %27
26: ; preds = %22, %18
store i32 1, i32* %5
br label %27
27: ; preds = %26, %22, %15
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = load i32, i32* %5
%32 = icmp ne i32 %31, 0
br i1 %32, label %40, label %33
33: ; preds = %30
%34 = load i8, i8* %6
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 123
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %40
40: ; preds = %37, %33, %30, %27
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
%43 = load i8, i8* %6
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 10
br i1 %45, label %46, label %47
46: ; preds = %40
store i32 0, i32* %4
store i32 0, i32* %5
br label %47
47: ; preds = %46, %40
br label %7
48: ; preds = %7
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@EOF = global i64 0
define i32 @count_domain(i32* nocapture %0) {
%2 = tail call signext i8 @getc(i32* %0)
%3 = sext i8 %2 to i32
%4 = load i64, i64* @EOF
%5 = trunc i64 %4 to i32
%6 = shl i32 %5, 24
%7 = ashr exact i32 %6, 24
%8 = icmp eq i32 %7, %3
br i1 %8, label %37, label %9
9: ; preds = %1, %17
%10 = phi i8 [ %30, %17 ], [ %2, %1 ]
%11 = phi i32 [ %25, %17 ], [ 0, %1 ]
%12 = phi i32 [ %29, %17 ], [ 0, %1 ]
%13 = phi i32 [ %28, %17 ], [ 0, %1 ]
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %9
switch i8 %10, label %17 [
i8 37, label %16
i8 35, label %16
]
16: ; preds = %15, %15
br label %17
17: ; preds = %15, %16, %9
%18 = phi i32 [ 1, %16 ], [ %12, %15 ], [ %12, %9 ]
%19 = icmp eq i32 %18, 0
%20 = xor i1 %14, true
%21 = select i1 %20, i1 %19, i1 false
%22 = icmp eq i8 %10, 123
%23 = and i1 %22, %21
%24 = zext i1 %23 to i32
%25 = add nuw nsw i32 %11, %24
%26 = add nsw i32 %13, 1
%27 = icmp eq i8 %10, 10
%28 = select i1 %27, i32 0, i32 %26
%29 = select i1 %27, i32 0, i32 %18
%30 = tail call signext i8 @getc(i32* %0)
%31 = sext i8 %30 to i32
%32 = load i64, i64* @EOF
%33 = trunc i64 %32 to i32
%34 = shl i32 %33, 24
%35 = ashr exact i32 %34, 24
%36 = icmp eq i32 %35, %31
br i1 %36, label %37, label %9
37: ; preds = %17, %1
%38 = phi i32 [ 0, %1 ], [ %25, %17 ]
ret i32 %38
}