#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();
int /*<<< orphan*/ putchar(int);
int main() {
  int c1, c2, total = 0;
  while ((c1 = getchar()) != EOF) {
    c2 = getchar();
    if (c2 == EOF)
      c2 = 7;
    putchar((c1 >> 4) * 16 + (c2 >> 4));
    total++;
  }
  while (total % 128 > 0) {
    putchar(0x77);
    total++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1196 <main+0x76>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
jne    1172 <main+0x52>
movl   $0x7,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sar    $0x4,%edi
shl    $0x4,%edi
mov    -0xc(%rbp),%eax
sar    $0x4,%eax
add    %eax,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <main+0x16>
jmp    119b <main+0x7b>
mov    -0x10(%rbp),%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jle    11c7 <main+0xa7>
mov    $0x77,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119b <main+0x7b>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb5(%rip),%r15
cmp    (%r15),%eax
je     11a6 <main+0x86>
mov    %eax,%ebx
mov    $0x1,%r14d
jmp    1169 <main+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
add    $0x1,%r14d
cmp    (%r15),%eax
je     1184 <main+0x64>
xor    %eax,%eax
call   1040 <getchar@plt>
and    $0xfffffff0,%ebx
mov    $0x0,%edi
cmp    (%r15),%eax
je     1150 <main+0x30>
sar    $0x4,%eax
mov    %eax,%edi
jmp    1150 <main+0x30>
lea    -0x1(%r14),%eax
test   $0x7f,%al
je     11a6 <main+0x86>
mov    %r14d,%ebx
nop
mov    $0x77,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
test   $0x7f,%r14b
mov    %ebx,%r14d
jne    1190 <main+0x70>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %28, label %7
4: ; preds = %7
%5 = and i32 %18, 127
%6 = icmp eq i32 %5, 0
br i1 %6, label %28, label %22
7: ; preds = %0, %7
%8 = phi i32 [ %19, %7 ], [ %1, %0 ]
%9 = phi i32 [ %18, %7 ], [ 0, %0 ]
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
%13 = and i32 %8, -16
%14 = ashr i32 %10, 4
%15 = select i1 %12, i32 0, i32 %14
%16 = add nsw i32 %15, %13
%17 = tail call i32 @putchar(i32 %16)
%18 = add nuw nsw i32 %9, 1
%19 = tail call i32 (...) @getchar()
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %4, label %7
22: ; preds = %4, %22
%23 = phi i32 [ %25, %22 ], [ %18, %4 ]
%24 = tail call i32 @putchar(i32 119)
%25 = add i32 %23, 1
%26 = trunc i32 %25 to i7
%27 = icmp eq i7 %26, 0
br i1 %27, label %28, label %22
28: ; preds = %22, %0, %4
ret i32 0
}