#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 */
int EOF;
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void Read(FILE *fp, int *Key, int *Times) {
  int NextKey;
  *Key = getc(fp);
  *Times = 0;
  if (*Key == EOF)
    return;
  do {
    *Times += 1;
    NextKey = getc(fp);
  } while (*Key == NextKey);
  if (NextKey != ' ')
    ungetc(NextKey, fp);
  return;
}


x86 assembly (clang, -O0):
<Read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
jne    1169 <Read+0x49>
jmp    11af <Read+0x8f>
jmp    116e <Read+0x4e>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
je     116e <Read+0x4e>
cmpl   $0x20,-0x1c(%rbp)
je     11aa <Read+0x8a>
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <ungetc@plt>
jmp    11af <Read+0x8f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Read>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <getc@plt>
mov    %eax,(%rbx)
movl   $0x0,(%r15)
mov    (%rbx),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
je     1167 <Read+0x47>
movl   $0x1,(%r15)
mov    %r14,%rdi
call   1040 <getc@plt>
cmp    %eax,(%rbx)
jne    1162 <Read+0x42>
addl   $0x1,(%r15)
jmp    1150 <Read+0x30>
cmp    $0x20,%eax
jne    116d <Read+0x4d>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %eax,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <ungetc@plt>

LLVM IR (-O0):
@EOF = global i32 0
define void @Read(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %4
%9 = call i32 @getc(i32* %8)
%10 = load i32*, i32** %5
store i32 %9, i32* %10
%11 = load i32*, i32** %6
store i32 0, i32* %11
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %3
br label %37
17: ; preds = %3
br label %18
18: ; preds = %24, %17
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
%21 = add nsw i32 %20, 1
store i32 %21, i32* %19
%22 = load i32*, i32** %4
%23 = call i32 @getc(i32* %22)
store i32 %23, i32* %7
br label %24
24: ; preds = %18
%25 = load i32*, i32** %5
%26 = load i32, i32* %25
%27 = load i32, i32* %7
%28 = icmp eq i32 %26, %27
br i1 %28, label %18, label %29
29: ; preds = %24
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 32
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* %7
%34 = load i32*, i32** %4
%35 = call i32 @ungetc(i32 %33, i32* %34)
br label %36
36: ; preds = %32, %29
br label %37
37: ; preds = %36, %16
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @Read(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = tail call i32 @getc(i32* %0)
store i32 %4, i32* %1
store i32 0, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %23, label %8
8: ; preds = %3
store i32 1, i32* %2
%9 = tail call i32 @getc(i32* %0)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, %9
br i1 %11, label %12, label %18
12: ; preds = %8, %12
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
%15 = tail call i32 @getc(i32* %0)
%16 = load i32, i32* %1
%17 = icmp eq i32 %16, %15
br i1 %17, label %12, label %18
18: ; preds = %12, %8
%19 = phi i32 [ %9, %8 ], [ %15, %12 ]
%20 = icmp eq i32 %19, 32
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 @ungetc(i32 %19, i32* %0)
br label %23
23: ; preds = %18, %21, %3
ret void
}