#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;
char egg_nibble2char(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getchar();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int c, colcount;
  char outc;
  if (argc > 1) {
    fprintf(stderr, "usage: %s < in > out\n", argv[0]);
    return 2;
  }
  colcount = 0;
  while ((c = getchar()) != EOF) {
    if (0 == colcount) {
      putchar('"');
    }
    c ^= 122;
    outc = egg_nibble2char((c & 0xF0) >> 4);
    putchar(outc);
    ++colcount;
    outc = egg_nibble2char(c & 0x0F);
    putchar(outc);
    ++colcount;
    if (colcount > 72) {
      colcount = 0;
      putchar('"');
      putchar('\n');
    }
  }
  if (colcount > 0) {
    putchar('"');
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1188 <main+0x48>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    125b <main+0x11b>
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e48(%rip),%rcx
cmp    (%rcx),%eax
je     1236 <main+0xf6>
xor    %eax,%eax
cmp    -0x18(%rbp),%eax
jne    11bd <main+0x7d>
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
xor    $0x7a,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
and    $0xf0,%edi
sar    $0x4,%edi
call   1040 <egg_nibble2char@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
and    $0xf,%edi
call   1040 <egg_nibble2char@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x48,-0x18(%rbp)
jle    1231 <main+0xf1>
movl   $0x0,-0x18(%rbp)
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    118f <main+0x4f>
cmpl   $0x0,-0x18(%rbp)
jle    1254 <main+0x114>
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    116f <main+0x2f>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xea1(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x2,%r14d
jmp    1213 <main+0xd3>
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e68(%rip),%r15
cmp    (%r15),%eax
je     1213 <main+0xd3>
mov    %eax,%ebx
xor    %ebp,%ebp
jmp    11d0 <main+0x90>
nop
xor    $0x7a,%ebx
mov    %ebx,%edi
shr    $0x4,%edi
and    $0xf,%edi
call   1040 <egg_nibble2char@plt>
movsbl %al,%edi
call   1030 <putchar@plt>
and    $0xf,%ebx
mov    %ebx,%edi
call   1040 <egg_nibble2char@plt>
movsbl %al,%edi
call   1030 <putchar@plt>
cmp    $0x47,%ebp
jge    11e0 <main+0xa0>
add    $0x2,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     11f8 <main+0xb8>
test   %ebp,%ebp
jne    1190 <main+0x50>
mov    $0x22,%edi
call   1030 <putchar@plt>
jmp    1190 <main+0x50>
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    11c2 <main+0x82>
xor    %r14d,%r14d
test   %ebp,%ebp
jle    1213 <main+0xd3>
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"usage: %s < in > out\0A\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 2, i32* %3
br label %58
17: ; preds = %2
store i32 0, i32* %7
br label %18
18: ; preds = %50, %17
%19 = call i32 (...) @getchar()
store i32 %19, i32* %6
%20 = load i32, i32* @EOF
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %51
22: ; preds = %18
%23 = load i32, i32* %7
%24 = icmp eq i32 0, %23
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @putchar(i8 signext 34)
br label %27
27: ; preds = %25, %22
%28 = load i32, i32* %6
%29 = xor i32 %28, 122
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = and i32 %30, 240
%32 = ashr i32 %31, 4
%33 = call signext i8 @egg_nibble2char(i32 %32)
store i8 %33, i8* %8
%34 = load i8, i8* %8
%35 = call i32 @putchar(i8 signext %34)
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
%38 = load i32, i32* %6
%39 = and i32 %38, 15
%40 = call signext i8 @egg_nibble2char(i32 %39)
store i8 %40, i8* %8
%41 = load i8, i8* %8
%42 = call i32 @putchar(i8 signext %41)
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
%45 = load i32, i32* %7
%46 = icmp sgt i32 %45, 72
br i1 %46, label %47, label %50
47: ; preds = %27
store i32 0, i32* %7
%48 = call i32 @putchar(i8 signext 34)
%49 = call i32 @putchar(i8 signext 10)
br label %50
50: ; preds = %47, %27
br label %18
51: ; preds = %18
%52 = load i32, i32* %7
%53 = icmp sgt i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = call i32 @putchar(i8 signext 34)
%56 = call i32 @putchar(i8 signext 10)
br label %57
57: ; preds = %54, %51
store i32 0, i32* %3
br label %58
58: ; preds = %57, %11
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"usage: %s < in > out\0A\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %42, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %42
12: ; preds = %4, %32
%13 = phi i32 [ %34, %32 ], [ %5, %4 ]
%14 = phi i32 [ %33, %32 ], [ 0, %4 ]
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = tail call i32 @putchar(i8 signext 34)
br label %18
18: ; preds = %16, %12
%19 = xor i32 %13, 122
%20 = lshr i32 %19, 4
%21 = and i32 %20, 15
%22 = tail call signext i8 @egg_nibble2char(i32 %21)
%23 = tail call i32 @putchar(i8 signext %22)
%24 = and i32 %19, 15
%25 = tail call signext i8 @egg_nibble2char(i32 %24)
%26 = tail call i32 @putchar(i8 signext %25)
%27 = add nsw i32 %14, 2
%28 = icmp sgt i32 %14, 70
br i1 %28, label %29, label %32
29: ; preds = %18
%30 = tail call i32 @putchar(i8 signext 34)
%31 = tail call i32 @putchar(i8 signext 10)
br label %32
32: ; preds = %29, %18
%33 = phi i32 [ 0, %29 ], [ %27, %18 ]
%34 = tail call i32 (...) @getchar()
%35 = load i32, i32* @EOF
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %12
37: ; preds = %32
%38 = icmp sgt i32 %33, 0
br i1 %38, label %39, label %42
39: ; preds = %37
%40 = tail call i32 @putchar(i8 signext 34)
%41 = tail call i32 @putchar(i8 signext 10)
br label %42
42: ; preds = %4, %37, %39, %8
%43 = phi i32 [ 2, %8 ], [ 0, %39 ], [ 0, %37 ], [ 0, %4 ]
ret i32 %43
}