#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 */
int EOF;
int getchar();
scalar_t__ isblank(int);
int /*<<< orphan*/ isgraph(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int c, counter;
  counter = 0;
  while ((c = getchar()) != EOF) {
    if (!isgraph(c) && (c != ' ' && c != '\n'))
      printf("%x", c);
    else
      printf("%c", c);
    if (counter >= 5) {
      if (isblank(c)) {
        printf("\n");
        counter = 0;
      }
    }
    if (c == '\n') {
      counter = 0;
    }
    ++counter;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e81(%rip),%rcx
cmp    (%rcx),%eax
je     1210 <main+0xd0>
mov    -0x8(%rbp),%edi
call   1060 <isgraph@plt>
cmp    $0x0,%eax
jne    11aa <main+0x6a>
cmpl   $0x20,-0x8(%rbp)
je     11aa <main+0x6a>
cmpl   $0xa,-0x8(%rbp)
je     11aa <main+0x6a>
mov    -0x8(%rbp),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <main+0x7b>
mov    -0x8(%rbp),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x5,-0xc(%rbp)
jl     11f1 <main+0xb1>
mov    -0x8(%rbp),%edi
call   1040 <isblank@plt>
cmp    $0x0,%rax
je     11ec <main+0xac>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    11f1 <main+0xb1>
cmpl   $0xa,-0x8(%rbp)
jne    1202 <main+0xc2>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e82(%rip),%r12
cmp    (%r12),%eax
jne    1177 <main+0x27>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
lea    0xe80(%rip),%r14
mov    $0x1,%r15d
xor    %ebx,%ebx
jmp    11a9 <main+0x59>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0xa,%ebp
cmove  %r15d,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     116c <main+0x1c>
mov    %ebp,%edi
call   1070 <isgraph@plt>
test   %eax,%eax
je     11e0 <main+0x90>
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x5,%ebx
jl     1190 <main+0x40>
mov    %ebp,%edi
call   1050 <isblank@plt>
test   %rax,%rax
je     1190 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
jmp    1190 <main+0x40>
nopw   0x0(%rax,%rax,1)
cmp    $0xa,%ebp
je     11b4 <main+0x64>
cmp    $0x20,%ebp
je     11b4 <main+0x64>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x5,%ebx
jl     1190 <main+0x40>
jmp    11c0 <main+0x70>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%x\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %38, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %41
8: ; preds = %4
%9 = load i32, i32* %2
%10 = call i32 @isgraph(i32 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 32
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 10
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %24
21: ; preds = %15, %12, %8
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21, %18
%25 = load i32, i32* %3
%26 = icmp sge i32 %25, 5
br i1 %26, label %27, label %34
27: ; preds = %24
%28 = load i32, i32* %2
%29 = call i64 @isblank(i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %33
33: ; preds = %31, %27
br label %34
34: ; preds = %33, %24
%35 = load i32, i32* %2
%36 = icmp eq i32 %35, 10
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 0, i32* %3
br label %38
38: ; preds = %37, %34
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %4
41: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%x\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %30, label %4
4: ; preds = %0, %22
%5 = phi i32 [ %27, %22 ], [ %1, %0 ]
%6 = phi i32 [ %26, %22 ], [ 0, %0 ]
%7 = tail call i32 @isgraph(i32 %5)
%8 = freeze i32 %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %4
switch i32 %5, label %11 [
i32 32, label %13
i32 10, label %13
]
11: ; preds = %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %15
13: ; preds = %10, %10, %4
%14 = tail call i32 @putchar(i32 %5)
br label %15
15: ; preds = %13, %11
%16 = icmp sgt i32 %6, 4
br i1 %16, label %17, label %22
17: ; preds = %15
%18 = tail call i64 @isblank(i32 %5)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @putchar(i32 10)
br label %22
22: ; preds = %17, %20, %15
%23 = phi i32 [ 0, %20 ], [ %6, %17 ], [ %6, %15 ]
%24 = icmp eq i32 %5, 10
%25 = add nsw i32 %23, 1
%26 = select i1 %24, i32 1, i32 %25
%27 = tail call i32 (...) @getchar()
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %4
30: ; preds = %22, %0
ret i32 0
}