#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 /*<<< orphan*/ escape(int);
int getchar();
int getopt(int, char **, char *);
int /*<<< orphan*/ unescape(int);
int main(int argc, char **argv) {
  bool should_escape = true;
  int arg = 0;
  while ((arg = getopt(argc, argv, "u")) != -1) {
    switch (arg) {
    case 'u':
      should_escape = false;
      break;
    case '?':
    default:
      break;
    }
  }
  int c = 0;
  if (should_escape) {
    while ((c = getchar()) != EOF)
      escape(c);
  } else {
    while ((c = getchar()) != EOF)
      unescape(c);
  }
  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)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     11c3 <main+0x83>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x3f,%eax
je     11b4 <main+0x74>
jmp    1197 <main+0x57>
mov    -0x20(%rbp),%eax
sub    $0x75,%eax
jne    11b9 <main+0x79>
jmp    11a8 <main+0x68>
movl   $0x0,-0x14(%rbp)
jmp    11be <main+0x7e>
jmp    11b9 <main+0x79>
jmp    11be <main+0x7e>
jmp    1164 <main+0x24>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1204 <main+0xc4>
jmp    11d9 <main+0x99>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2dfe(%rip),%rcx
cmp    (%rcx),%eax
je     11ff <main+0xbf>
mov    -0x1c(%rbp),%edi
call   1060 <escape@plt>
jmp    11d9 <main+0x99>
jmp    1234 <main+0xf4>
jmp    1209 <main+0xc9>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2dce(%rip),%rcx
cmp    (%rcx),%eax
je     122f <main+0xef>
mov    -0x1c(%rbp),%edi
call   1040 <unescape@plt>
jmp    1209 <main+0xc9>
jmp    1234 <main+0xf4>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r15d,%r15d
lea    0xeaa(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0x75,%eax
je     1179 <main+0x39>
cmp    $0xffffffff,%eax
jne    1160 <main+0x20>
jmp    117e <main+0x3e>
mov    $0x1,%r15b
jmp    1160 <main+0x20>
xor    %eax,%eax
call   1030 <getchar@plt>
mov    0x2e5c(%rip),%rbx
mov    (%rbx),%ecx
test   $0x1,%r15b
je     11b4 <main+0x74>
cmp    %ecx,%eax
je     11d2 <main+0x92>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1040 <unescape@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%rbx),%eax
jne    11a0 <main+0x60>
jmp    11d2 <main+0x92>
cmp    %ecx,%eax
je     11d2 <main+0x92>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1060 <escape@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%rbx),%eax
jne    11c0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"u\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %7
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i32, i32* %7
switch i32 %15, label %18 [
i32 117, label %16
i32 63, label %17
]
16: ; preds = %14
store i32 0, i32* %6
br label %19
17: ; preds = %14
br label %18
18: ; preds = %14, %17
br label %19
19: ; preds = %18, %16
br label %9
20: ; preds = %9
store i32 0, i32* %8
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %20
br label %24
24: ; preds = %28, %23
%25 = call i32 (...) @getchar()
store i32 %25, i32* %8
%26 = load i32, i32* @EOF
%27 = icmp ne i32 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %8
%30 = call i32 @escape(i32 %29)
br label %24
31: ; preds = %24
br label %41
32: ; preds = %20
br label %33
33: ; preds = %37, %32
%34 = call i32 (...) @getchar()
store i32 %34, i32* %8
%35 = load i32, i32* @EOF
%36 = icmp ne i32 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* %8
%39 = call i32 @unescape(i32 %38)
br label %33
40: ; preds = %33
br label %41
41: ; preds = %40, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"u\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = phi i1 [ false, %2 ], [ true, %5 ]
br label %5
5: ; preds = %3, %5
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %5 [
i32 -1, label %7
i32 117, label %3
]
7: ; preds = %5
%8 = tail call i32 (...) @getchar()
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %4, label %12, label %11
11: ; preds = %7
br i1 %10, label %25, label %13
12: ; preds = %7
br i1 %10, label %25, label %19
13: ; preds = %11, %13
%14 = phi i32 [ %16, %13 ], [ %8, %11 ]
%15 = tail call i32 @escape(i32 %14)
%16 = tail call i32 (...) @getchar()
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %25, label %13
19: ; preds = %12, %19
%20 = phi i32 [ %22, %19 ], [ %8, %12 ]
%21 = tail call i32 @unescape(i32 %20)
%22 = tail call i32 (...) @getchar()
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %19
25: ; preds = %13, %19, %11, %12
ret i32 0
}