#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*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  int c;
  printf("#ifndef CurrrentGit_h\n#define CurrrentGit_h\n#define "
         "GIT_COMMIT_HASH \"");
  while (EOF != (c = getchar())) {
    if (c > 0x20 && c < 0x7F) {
      putchar(c);
    } else if (c == '\n' || c == '\r') {
      printf("\"\n#define GIT_COMMIT_SHORT_HASH \"[");
      while (EOF != (c = getchar())) {
        if (c > 0x20 && c < 0x7F) {
          putchar(c);
        }
      }
    }
  }
  printf("]\"\n#endif\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)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
mov    %ecx,-0x14(%rbp)
cmp    %ecx,%eax
je     1209 <main+0xd9>
cmpl   $0x20,-0x14(%rbp)
jle    1196 <main+0x66>
cmpl   $0x7f,-0x14(%rbp)
jge    1196 <main+0x66>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    1204 <main+0xd4>
cmpl   $0xa,-0x14(%rbp)
je     11aa <main+0x7a>
cmpl   $0xd,-0x14(%rbp)
jne    11ff <main+0xcf>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
mov    %ecx,-0x14(%rbp)
cmp    %ecx,%eax
je     11fa <main+0xca>
cmpl   $0x20,-0x14(%rbp)
jle    11f5 <main+0xc5>
cmpl   $0x7f,-0x14(%rbp)
jge    11f5 <main+0xc5>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    11b6 <main+0x86>
jmp    11ff <main+0xcf>
jmp    1204 <main+0xd4>
jmp    1152 <main+0x22>
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xeb5(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e91(%rip),%rbx
mov    (%rbx),%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    %eax,%ebp
jne    1177 <main+0x37>
lea    0xefe(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xec8(%rip),%r14
jmp    1194 <main+0x54>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    (%rbx),%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    %eax,%ebp
je     1164 <main+0x24>
lea    -0x21(%rax),%ecx
cmp    $0x5d,%ecx
jbe    1180 <main+0x40>
cmp    $0xd,%eax
je     11a6 <main+0x66>
cmp    $0xa,%eax
jne    1187 <main+0x47>
mov    %r14,%rdi
call   1050 <printf@plt>
xchg   %ax,%ax
mov    (%rbx),%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    %eax,%ebp
je     1187 <main+0x47>
lea    -0x21(%rax),%ecx
cmp    $0x5d,%ecx
ja     11b0 <main+0x70>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x70>

LLVM IR (-O0):
@.str = [70 x i8] c"#ifndef CurrrentGit_h\0A#define CurrrentGit_h\0A#define GIT_COMMIT_HASH \22\00"
@EOF = global i32 0
@.str.1 = [35 x i8] c"\22\0A#define GIT_COMMIT_SHORT_HASH \22[\00"
@.str.2 = [11 x i8] c"]\22\0A#endif\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %45, %2
%9 = load i32, i32* @EOF
%10 = call i32 (...) @getchar()
store i32 %10, i32* %6
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %46
12: ; preds = %8
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, 32
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 127
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %6
%20 = call i32 @putchar(i32 %19)
br label %45
21: ; preds = %15, %12
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 10
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 13
br i1 %26, label %27, label %44
27: ; preds = %24, %21
%28 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %42, %27
%30 = load i32, i32* @EOF
%31 = call i32 (...) @getchar()
store i32 %31, i32* %6
%32 = icmp ne i32 %30, %31
br i1 %32, label %33, label %43
33: ; preds = %29
%34 = load i32, i32* %6
%35 = icmp sgt i32 %34, 32
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load i32, i32* %6
%38 = icmp slt i32 %37, 127
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %6
%41 = call i32 @putchar(i32 %40)
br label %42
42: ; preds = %39, %36, %33
br label %29
43: ; preds = %29
br label %44
44: ; preds = %43, %24
br label %45
45: ; preds = %44, %18
br label %8
46: ; preds = %8
%47 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [70 x i8] c"#ifndef CurrrentGit_h\0A#define CurrrentGit_h\0A#define GIT_COMMIT_HASH \22\00"
@EOF = global i32 0
@.str.1 = [35 x i8] c"\22\0A#define GIT_COMMIT_SHORT_HASH \22[\00"
@str = [10 x i8] c"]\22\0A#endif\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EOF
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %4, %5
br i1 %6, label %33, label %7
7: ; preds = %2, %29
%8 = phi i32 [ %31, %29 ], [ %5, %2 ]
%9 = add i32 %8, -33
%10 = icmp ult i32 %9, 94
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @putchar(i32 %8)
br label %29
13: ; preds = %7
switch i32 %8, label %29 [
i32 13, label %14
i32 10, label %14
]
14: ; preds = %13, %13
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @EOF
%17 = tail call i32 (...) @getchar()
%18 = icmp eq i32 %16, %17
br i1 %18, label %29, label %19
19: ; preds = %14, %25
%20 = phi i32 [ %27, %25 ], [ %17, %14 ]
%21 = add i32 %20, -33
%22 = icmp ult i32 %21, 94
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = tail call i32 @putchar(i32 %20)
br label %25
25: ; preds = %23, %19
%26 = load i32, i32* @EOF
%27 = tail call i32 (...) @getchar()
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %19
29: ; preds = %25, %14, %13, %11
%30 = load i32, i32* @EOF
%31 = tail call i32 (...) @getchar()
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %7
33: ; preds = %29, %2
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret i32 0
}