#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 */
unsigned char *fgets(unsigned char *, int, int /*<<< orphan*/);
scalar_t__ isdigit(unsigned char);
scalar_t__ isprint(unsigned char);
scalar_t__ isspace(unsigned char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(unsigned char);
int /*<<< orphan*/ stdin;
int strlen(unsigned char *);
int main(void) {
  unsigned char buf[32768], *p;
  int n;
  while ((p = fgets(buf, 32768, stdin)) != 0) {
    if (*p == '#') {
      p[strlen(p) - 1] = '\0';
      printf("/* %-75s */\n", buf + 2);
    } else if (isspace(*p))
      printf("\n");
    else {
      for (n = 0, p = buf + 2; isdigit(*p); n = n * 10 + *p - '0', p++)
        ;
      if (n == 0)
        printf("#ifndef MSGS_H\n#define MSGS_H\n\n#define YES\t\"");
      else
        printf("#define G%05d\t\"", n);
      while (*p++ != '\n') {
        if (*p > 127)
          printf("\\%03o", *p);
        else if (isprint(*p))
          putchar(*p);
      }
      printf("\"\n");
    }
  }
  printf("\n#endif\n\n/* END OF FILE */\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8030,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8010(%rbp),%rdi
mov    0x2e58(%rip),%rax
mov    (%rax),%edx
mov    $0x8000,%esi
call   1080 <fgets@plt>
mov    %rax,-0x8018(%rbp)
cmp    $0x0,%rax
je     1378 <main+0x208>
mov    -0x8018(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x23,%eax
jne    120b <main+0x9b>
mov    -0x8018(%rbp),%rax
mov    %rax,-0x8028(%rbp)
mov    -0x8018(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x8028(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
lea    -0x8010(%rbp),%rsi
add    $0x2,%rsi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1373 <main+0x203>
mov    -0x8018(%rbp),%rax
movzbl (%rax),%edi
call   1070 <isspace@plt>
cmp    $0x0,%rax
je     1237 <main+0xc7>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    136e <main+0x1fe>
movl   $0x0,-0x801c(%rbp)
lea    -0x8010(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8018(%rbp)
mov    -0x8018(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     12a4 <main+0x134>
jmp    1271 <main+0x101>
imul   $0xa,-0x801c(%rbp),%eax
mov    -0x8018(%rbp),%rcx
movzbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x801c(%rbp)
mov    -0x8018(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8018(%rbp)
jmp    1253 <main+0xe3>
cmpl   $0x0,-0x801c(%rbp)
jne    12c4 <main+0x154>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12d8 <main+0x168>
mov    -0x801c(%rbp),%esi
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12dd <main+0x16d>
mov    -0x8018(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8018(%rbp)
movzbl (%rax),%eax
cmp    $0xa,%eax
je     1360 <main+0x1f0>
mov    -0x8018(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x7f,%eax
jle    132e <main+0x1be>
mov    -0x8018(%rbp),%rax
movzbl (%rax),%esi
lea    0xd28(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    135b <main+0x1eb>
mov    -0x8018(%rbp),%rax
movzbl (%rax),%edi
call   1090 <isprint@plt>
cmp    $0x0,%rax
je     1356 <main+0x1e6>
mov    -0x8018(%rbp),%rax
movzbl (%rax),%edi
call   1030 <putchar@plt>
jmp    135b <main+0x1eb>
jmp    12dd <main+0x16d>
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1373 <main+0x203>
jmp    1182 <main+0x12>
lea    0xcd4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8008,%rsp
mov    0x2e50(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rsp,%rdi
mov    $0x8000,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1304 <main+0x184>
mov    %rax,%r12
lea    0x2(%rsp),%r14
lea    0xe40(%rip),%r13
mov    %rsp,%rbx
lea    0xe80(%rip),%r15
jmp    1209 <main+0x89>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r12,1)
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0x8000,%esi
call   1090 <fgets@plt>
mov    %rax,%r12
test   %rax,%rax
je     1304 <main+0x184>
mov    (%r12),%al
cmp    $0x23,%al
je     11d0 <main+0x50>
movzbl %al,%edi
call   1080 <isspace@plt>
test   %rax,%rax
je     122a <main+0xaa>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11ed <main+0x6d>
movzbl 0x2(%rsp),%edi
call   1040 <isdigit@plt>
mov    %r14,%rbp
test   %rax,%rax
je     1291 <main+0x111>
xor    %ebx,%ebx
mov    %r14,%r12
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rbx,%rbx,4),%eax
movzbl 0x0(%rbp),%ecx
lea    (%rcx,%rax,2),%ebx
add    $0xffffffd0,%ebx
movzbl 0x1(%rbp),%edi
add    $0x1,%rbp
call   1040 <isdigit@plt>
test   %rax,%rax
jne    1250 <main+0xd0>
test   %ebx,%ebx
je     128e <main+0x10e>
lea    0xdc0(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%r14
cmpb   $0xa,0x0(%rbp)
je     12a5 <main+0x125>
jmp    12c0 <main+0x140>
mov    %r12,%r14
lea    0xd75(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpb   $0xa,0x0(%rbp)
jne    12c0 <main+0x140>
lea    0xd8c(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d30(%rip),%rbp
mov    %rsp,%rbx
jmp    11ed <main+0x6d>
add    $0x1,%rbp
jmp    12e4 <main+0x164>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpb   $0xa,0x0(%rbp)
lea    0x1(%rbp),%rbp
je     12a5 <main+0x125>
movzbl 0x0(%rbp),%esi
test   %sil,%sil
js     12d0 <main+0x150>
mov    %esi,%edi
call   10a0 <isprint@plt>
test   %rax,%rax
je     12da <main+0x15a>
movzbl 0x0(%rbp),%edi
call   1030 <putchar@plt>
jmp    12da <main+0x15a>
lea    0xd45(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x8008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [13 x i8] c"/* %-75s */\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [45 x i8] c"#ifndef MSGS_H\0A#define MSGS_H\0A\0A#define YES\09\22\00"
@.str.3 = [16 x i8] c"#define G%05d\09\22\00"
@.str.4 = [6 x i8] c"\\%03o\00"
@.str.5 = [3 x i8] c"\22\0A\00"
@.str.6 = [28 x i8] c"\0A#endif\0A\0A/* END OF FILE */\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32768 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %90, %0
%6 = getelementptr inbounds [32768 x i8], [32768 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i8* @fgets(i8* %6, i32 32768, i32 %7)
store i8* %8, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %91
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 35
br i1 %14, label %15, label %25
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8*, i8** %3
%18 = call i32 @strlen(i8* %17)
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %16, i64 %20
store i8 0, i8* %21
%22 = getelementptr inbounds [32768 x i8], [32768 x i8]* %2, i64 0, i64 0
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %90
25: ; preds = %10
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = call i64 @isspace(i8 zeroext %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %89
32: ; preds = %25
store i32 0, i32* %4
%33 = getelementptr inbounds [32768 x i8], [32768 x i8]* %2, i64 0, i64 0
%34 = getelementptr inbounds i8, i8* %33, i64 2
store i8* %34, i8** %3
br label %35
35: ; preds = %41, %32
%36 = load i8*, i8** %3
%37 = load i8, i8* %36
%38 = call i64 @isdigit(i8 zeroext %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %51
40: ; preds = %35
br label %41
41: ; preds = %40
%42 = load i32, i32* %4
%43 = mul nsw i32 %42, 10
%44 = load i8*, i8** %3
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = add nsw i32 %43, %46
%48 = sub nsw i32 %47, 48
store i32 %48, i32* %4
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %3
br label %35
51: ; preds = %35
%52 = load i32, i32* %4
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
br label %59
56: ; preds = %51
%57 = load i32, i32* %4
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %56, %54
br label %60
60: ; preds = %86, %59
%61 = load i8*, i8** %3
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %3
%63 = load i8, i8* %61
%64 = zext i8 %63 to i32
%65 = icmp ne i32 %64, 10
br i1 %65, label %66, label %87
66: ; preds = %60
%67 = load i8*, i8** %3
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = icmp sgt i32 %69, 127
br i1 %70, label %71, label %76
71: ; preds = %66
%72 = load i8*, i8** %3
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %74)
br label %86
76: ; preds = %66
%77 = load i8*, i8** %3
%78 = load i8, i8* %77
%79 = call i64 @isprint(i8 zeroext %78)
%80 = icmp ne i64 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %76
%82 = load i8*, i8** %3
%83 = load i8, i8* %82
%84 = call i32 @putchar(i8 zeroext %83)
br label %85
85: ; preds = %81, %76
br label %86
86: ; preds = %85, %71
br label %60
87: ; preds = %60
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %89
89: ; preds = %87, %30
br label %90
90: ; preds = %89, %15
br label %5
91: ; preds = %5
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [13 x i8] c"/* %-75s */\0A\00"
@.str.2 = [45 x i8] c"#ifndef MSGS_H\0A#define MSGS_H\0A\0A#define YES\09\22\00"
@.str.3 = [16 x i8] c"#define G%05d\09\22\00"
@.str.4 = [6 x i8] c"\\%03o\00"
@str = [27 x i8] c"\0A#endif\0A\0A/* END OF FILE */\00"
@str.7 = [2 x i8] c"\22\00"
define i32 @main() {
%1 = alloca [32768 x i8]
%2 = getelementptr inbounds [32768 x i8], [32768 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i8* @fgets(i8* %2, i32 32768, i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %73, label %6
6: ; preds = %0
%7 = getelementptr inbounds [32768 x i8], [32768 x i8]* %1, i64 0, i64 2
br label %8
8: ; preds = %6, %69
%9 = phi i8* [ %4, %6 ], [ %71, %69 ]
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 35
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = call i32 @strlen(i8* %9)
%14 = add nsw i32 %13, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %9, i64 %15
store i8 0, i8* %16
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %69
18: ; preds = %8
%19 = call i64 @isspace(i8 zeroext %10)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br label %69
23: ; preds = %18
%24 = load i8, i8* %7
%25 = call i64 @isdigit(i8 zeroext %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %41, label %27
27: ; preds = %23, %27
%28 = phi i32 [ %34, %27 ], [ 0, %23 ]
%29 = phi i8* [ %35, %27 ], [ %7, %23 ]
%30 = mul nsw i32 %28, 10
%31 = load i8, i8* %29
%32 = zext i8 %31 to i32
%33 = add i32 %30, -48
%34 = add i32 %33, %32
%35 = getelementptr inbounds i8, i8* %29, i64 1
%36 = load i8, i8* %35
%37 = call i64 @isdigit(i8 zeroext %36)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %27
39: ; preds = %27
%40 = icmp eq i32 %34, 0
br i1 %40, label %41, label %44
41: ; preds = %23, %39
%42 = phi i8* [ %35, %39 ], [ %7, %23 ]
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
br label %46
44: ; preds = %39
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %46
46: ; preds = %44, %41
%47 = phi i8* [ %35, %44 ], [ %42, %41 ]
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 10
br i1 %49, label %67, label %50
50: ; preds = %46, %64
%51 = phi i8* [ %52, %64 ], [ %47, %46 ]
%52 = getelementptr inbounds i8, i8* %51, i64 1
%53 = load i8, i8* %52
%54 = icmp slt i8 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = zext i8 %53 to i32
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %56)
br label %64
58: ; preds = %50
%59 = call i64 @isprint(i8 zeroext %53)
%60 = icmp eq i64 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = load i8, i8* %52
%63 = call i32 @putchar(i8 zeroext %62)
br label %64
64: ; preds = %58, %61, %55
%65 = load i8, i8* %52
%66 = icmp eq i8 %65, 10
br i1 %66, label %67, label %50
67: ; preds = %64, %46
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
br label %69
69: ; preds = %21, %67, %12
%70 = load i32, i32* @stdin
%71 = call i8* @fgets(i8* %2, i32 32768, i32 %70)
%72 = icmp eq i8* %71, null
br i1 %72, label %73, label %8
73: ; preds = %69, %0
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret i32 0
}