#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
char *strpbrk(char *, char *);
int main(int argc, char **argv) {
  char buf[256];
  argc--;
  argv++;
  fputs("Arguments: ", stdout);
  while (argc > 0) {
    char *start, *chunk;
    putc('"', stdout);
    start = *argv;
    while ((chunk = strpbrk(start, "\"\\\n\t")) != 0) {
      fwrite(start, chunk - start, 1, stdout);
      switch (*chunk) {
      case '"':
        fputs("\\\"", stdout);
        break;
      case '\\':
        fputs("\\\\", stdout);
        break;
      case '\n':
        fputs("\\n", stdout);
        break;
      case '\t':
        fputs("\\t", stdout);
        break;
      default:
        printf("\\%03d", *chunk);
      }
      start = chunk + 1;
    }
    fputs(start, stdout);
    fputs("\" ", stdout);
    argc--;
    argv++;
  }
  fputs("\n-----message-----\n", stdout);
  while (fgets(buf, 256, stdin))
    fputs(buf, stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
lea    0xe62(%rip),%rdi
call   1040 <fputs@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1349 <main+0x1e9>
mov    0x2e24(%rip),%rax
mov    (%rax),%esi
mov    $0x22,%edi
call   1060 <putc@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1070 <strpbrk@plt>
mov    %rax,-0x120(%rbp)
cmp    $0x0,%rax
je     1305 <main+0x1a5>
mov    -0x118(%rbp),%rdi
mov    -0x120(%rbp),%esi
mov    %edi,%eax
sub    %eax,%esi
mov    0x2dce(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1080 <fwrite@plt>
mov    -0x120(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x124(%rbp)
sub    $0x9,%eax
je     12be <main+0x15e>
jmp    1234 <main+0xd4>
mov    -0x124(%rbp),%eax
sub    $0xa,%eax
je     12a4 <main+0x144>
jmp    1248 <main+0xe8>
mov    -0x124(%rbp),%eax
sub    $0x22,%eax
je     1270 <main+0x110>
jmp    125c <main+0xfc>
mov    -0x124(%rbp),%eax
sub    $0x5c,%eax
je     128a <main+0x12a>
jmp    12d8 <main+0x178>
mov    0x2d61(%rip),%rax
mov    (%rax),%esi
lea    0xd91(%rip),%rdi
call   1040 <fputs@plt>
jmp    12ee <main+0x18e>
mov    0x2d47(%rip),%rax
mov    (%rax),%esi
lea    0xd7a(%rip),%rdi
call   1040 <fputs@plt>
jmp    12ee <main+0x18e>
mov    0x2d2d(%rip),%rax
mov    (%rax),%esi
lea    0xd63(%rip),%rdi
call   1040 <fputs@plt>
jmp    12ee <main+0x18e>
mov    0x2d13(%rip),%rax
mov    (%rax),%esi
lea    0xd4c(%rip),%rdi
call   1040 <fputs@plt>
jmp    12ee <main+0x18e>
mov    -0x120(%rbp),%rax
lea    0xd37(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x120(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
jmp    11ce <main+0x6e>
mov    -0x118(%rbp),%rdi
mov    0x2cc5(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
mov    0x2cb7(%rip),%rax
mov    (%rax),%esi
lea    0xcf9(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11a3 <main+0x43>
mov    0x2c88(%rip),%rax
mov    (%rax),%esi
lea    0xccd(%rip),%rdi
call   1040 <fputs@plt>
lea    -0x110(%rbp),%rdi
mov    0x2c7c(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     139c <main+0x23c>
lea    -0x110(%rbp),%rdi
mov    0x2c48(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
jmp    135e <main+0x1fe>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x2e5a(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1040 <fputs@plt>
cmp    $0x2,%r14d
jl     12c4 <main+0x164>
lea    0xe6e(%rip),%rbx
jmp    11cf <main+0x6f>
add    $0x8,%r15
lea    -0x1(%r14),%r13d
mov    0x0(%rbp),%esi
mov    %r12,%rdi
call   1040 <fputs@plt>
mov    0x0(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1040 <fputs@plt>
cmp    $0x2,%r14d
mov    %r13d,%r14d
jle    12c4 <main+0x164>
mov    0x0(%rbp),%esi
mov    $0x22,%edi
call   1060 <putc@plt>
mov    0x8(%r15),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <strpbrk@plt>
test   %rax,%rax
je     11a0 <main+0x40>
mov    %rax,%r13
jmp    122a <main+0xca>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
mov    %r13,%r12
add    $0x1,%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <strpbrk@plt>
mov    %rax,%r13
test   %rax,%rax
je     11a0 <main+0x40>
mov    %r13d,%esi
sub    %r12d,%esi
mov    0x0(%rbp),%ecx
mov    %r12,%rdi
mov    $0x1,%edx
call   1080 <fwrite@plt>
movsbl 0x0(%r13),%esi
cmp    $0x21,%esi
jg     1270 <main+0x110>
cmp    $0x9,%esi
je     1290 <main+0x130>
cmp    $0xa,%esi
jne    1200 <main+0xa0>
mov    0x0(%rbp),%esi
lea    0xdb9(%rip),%rdi
call   1040 <fputs@plt>
jmp    120c <main+0xac>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x5c,%esi
je     12b0 <main+0x150>
cmp    $0x22,%esi
jne    1200 <main+0xa0>
mov    0x0(%rbp),%esi
lea    0xd8d(%rip),%rdi
call   1040 <fputs@plt>
jmp    120c <main+0xac>
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%esi
lea    0xd80(%rip),%rdi
call   1040 <fputs@plt>
jmp    120c <main+0xac>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%rbp),%esi
lea    0xd5a(%rip),%rdi
call   1040 <fputs@plt>
jmp    120c <main+0xac>
mov    0x0(%rbp),%esi
lea    0xd58(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2d0e(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rdi
mov    $0x100,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1320 <main+0x1c0>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1040 <fputs@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    1300 <main+0x1a0>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Arguments: \00"
@stdout = global i32 0
@.str.1 = [5 x i8] c"\22\\\0A\09\00"
@.str.2 = [3 x i8] c"\\\22\00"
@.str.3 = [3 x i8] c"\\\\\00"
@.str.4 = [3 x i8] c"\\n\00"
@.str.5 = [3 x i8] c"\\t\00"
@.str.6 = [6 x i8] c"\\%03d\00"
@.str.7 = [3 x i8] c"\22 \00"
@.str.8 = [20 x i8] c"\0A-----message-----\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = add nsw i32 %9, -1
store i32 %10, i32* %4
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i32 1
store i8** %12, i8*** %5
%13 = load i32, i32* @stdout
%14 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %59, %2
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %69
18: ; preds = %15
%19 = load i32, i32* @stdout
%20 = call i32 @putc(i8 signext 34, i32 %19)
%21 = load i8**, i8*** %5
%22 = load i8*, i8** %21
store i8* %22, i8** %7
br label %23
23: ; preds = %56, %18
%24 = load i8*, i8** %7
%25 = call i8* @strpbrk(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %25, i8** %8
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %59
27: ; preds = %23
%28 = load i8*, i8** %7
%29 = load i8*, i8** %8
%30 = load i8*, i8** %7
%31 = ptrtoint i8* %29 to i64
%32 = ptrtoint i8* %30 to i64
%33 = sub i64 %31, %32
%34 = trunc i64 %33 to i32
%35 = load i32, i32* @stdout
%36 = call i32 @fwrite(i8* %28, i32 %34, i32 1, i32 %35)
%37 = load i8*, i8** %8
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
switch i32 %39, label %52 [
i32 34, label %40
i32 92, label %43
i32 10, label %46
i32 9, label %49
]
40: ; preds = %27
%41 = load i32, i32* @stdout
%42 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %41)
br label %56
43: ; preds = %27
%44 = load i32, i32* @stdout
%45 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %44)
br label %56
46: ; preds = %27
%47 = load i32, i32* @stdout
%48 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %47)
br label %56
49: ; preds = %27
%50 = load i32, i32* @stdout
%51 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %50)
br label %56
52: ; preds = %27
%53 = load i8*, i8** %8
%54 = load i8, i8* %53
%55 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8 signext %54)
br label %56
56: ; preds = %52, %49, %46, %43, %40
%57 = load i8*, i8** %8
%58 = getelementptr inbounds i8, i8* %57, i64 1
store i8* %58, i8** %7
br label %23
59: ; preds = %23
%60 = load i8*, i8** %7
%61 = load i32, i32* @stdout
%62 = call i32 @fputs(i8* %60, i32 %61)
%63 = load i32, i32* @stdout
%64 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %63)
%65 = load i32, i32* %4
%66 = add nsw i32 %65, -1
store i32 %66, i32* %4
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i32 1
store i8** %68, i8*** %5
br label %15
69: ; preds = %15
%70 = load i32, i32* @stdout
%71 = call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %77, %69
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%74 = load i32, i32* @stdin
%75 = call i64 @fgets(i8* %73, i32 256, i32 %74)
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %72
%78 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%79 = load i32, i32* @stdout
%80 = call i32 @fputs(i8* %78, i32 %79)
br label %72
81: ; preds = %72
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Arguments: \00"
@stdout = global i32 0
@.str.1 = [5 x i8] c"\22\\\0A\09\00"
@.str.2 = [3 x i8] c"\\\22\00"
@.str.3 = [3 x i8] c"\\\\\00"
@.str.4 = [3 x i8] c"\\n\00"
@.str.5 = [3 x i8] c"\\t\00"
@.str.6 = [6 x i8] c"\\%03d\00"
@.str.7 = [3 x i8] c"\22 \00"
@.str.8 = [20 x i8] c"\0A-----message-----\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %54
8: ; preds = %2, %47
%9 = phi i32 [ %12, %47 ], [ %0, %2 ]
%10 = phi i8** [ %11, %47 ], [ %1, %2 ]
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = add nsw i32 %9, -1
%13 = load i32, i32* @stdout
%14 = tail call i32 @putc(i8 signext 34, i32 %13)
%15 = load i8*, i8** %11
%16 = tail call i8* @strpbrk(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %47, label %18
18: ; preds = %8, %43
%19 = phi i8* [ %45, %43 ], [ %16, %8 ]
%20 = phi i8* [ %44, %43 ], [ %15, %8 ]
%21 = ptrtoint i8* %19 to i64
%22 = ptrtoint i8* %20 to i64
%23 = sub i64 %21, %22
%24 = trunc i64 %23 to i32
%25 = load i32, i32* @stdout
%26 = tail call i32 @fwrite(i8* %20, i32 %24, i32 1, i32 %25)
%27 = load i8, i8* %19
%28 = sext i8 %27 to i32
switch i32 %28, label %41 [
i32 34, label %29
i32 92, label %32
i32 10, label %35
i32 9, label %38
]
29: ; preds = %18
%30 = load i32, i32* @stdout
%31 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %43
32: ; preds = %18
%33 = load i32, i32* @stdout
%34 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %43
35: ; preds = %18
%36 = load i32, i32* @stdout
%37 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %36)
br label %43
38: ; preds = %18
%39 = load i32, i32* @stdout
%40 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %39)
br label %43
41: ; preds = %18
%42 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8 signext %27)
br label %43
43: ; preds = %41, %38, %35, %32, %29
%44 = getelementptr inbounds i8, i8* %19, i64 1
%45 = tail call i8* @strpbrk(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%46 = icmp eq i8* %45, null
br i1 %46, label %47, label %18
47: ; preds = %43, %8
%48 = phi i8* [ %15, %8 ], [ %44, %43 ]
%49 = load i32, i32* @stdout
%50 = tail call i32 @fputs(i8* %48, i32 %49)
%51 = load i32, i32* @stdout
%52 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %51)
%53 = icmp sgt i32 %9, 2
br i1 %53, label %8, label %54
54: ; preds = %47, %2
%55 = load i32, i32* @stdout
%56 = tail call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %55)
%57 = load i32, i32* @stdin
%58 = call i64 @fgets(i8* %4, i32 256, i32 %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %66, label %60
60: ; preds = %54, %60
%61 = load i32, i32* @stdout
%62 = call i32 @fputs(i8* %4, i32 %61)
%63 = load i32, i32* @stdin
%64 = call i64 @fgets(i8* %4, i32 256, i32 %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %60
66: ; preds = %60, %54
ret i32 0
}