#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ blankline(char *, char **);
int getc(int /*<<< orphan*/ *);
void decomment_asm(const char *fname, FILE *in) {
  register int c, c1;
  char outbuf[4 * 1024];
  char *op = outbuf;
  enum { NORMAL, ASM_COMMENT, STRINGLITERAL, CHARLITERAL } state = NORMAL;
  while ((c = getc(in)) != EOF) {
    switch (state) {
    case NORMAL:
      switch (c) {
      case '\'':
        state = CHARLITERAL;
        *op++ = c;
        break;
      case '"':
        state = STRINGLITERAL;
        *op++ = c;
        break;
      case ';':
        state = ASM_COMMENT;
        break;
      default:
        *op++ = c;
        break;
      }
      break;
    case ASM_COMMENT:
      if (c == '\n') {
        state = NORMAL;
      }
      break;
    case STRINGLITERAL:
      *op++ = c;
      switch (c) {
      case '"':
        state = NORMAL;
        break;
      case '\\':
        c1 = getc(in);
        *op++ = c1;
        break;
      }
      break;
    case CHARLITERAL:
      *op++ = c;
      switch (c) {
      case '\'':
        state = NORMAL;
        break;
      case '\\':
        getc(in);
        break;
      }
      break;
    }
    if (op > outbuf && op[-1] == '\n') {
      blankline(outbuf, &op);
    }
  }
}


x86 assembly (clang, -O0):
<decomment_asm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1028(%rbp)
movl   $0x0,-0x102c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
je     1398 <decomment_asm+0x278>
mov    -0x102c(%rbp),%eax
mov    %rax,-0x1038(%rbp)
sub    $0x3,%rax
ja     1355 <decomment_asm+0x235>
mov    -0x1038(%rbp),%rax
lea    0xe75(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%eax
mov    %eax,-0x103c(%rbp)
sub    $0x22,%eax
je     11fe <decomment_asm+0xde>
jmp    11ab <decomment_asm+0x8b>
mov    -0x103c(%rbp),%eax
sub    $0x27,%eax
je     11d3 <decomment_asm+0xb3>
jmp    11bf <decomment_asm+0x9f>
mov    -0x103c(%rbp),%eax
sub    $0x3b,%eax
je     1229 <decomment_asm+0x109>
jmp    1238 <decomment_asm+0x118>
movl   $0x3,-0x102c(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x1028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1028(%rbp)
mov    %cl,(%rax)
jmp    1254 <decomment_asm+0x134>
movl   $0x2,-0x102c(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x1028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1028(%rbp)
mov    %cl,(%rax)
jmp    1254 <decomment_asm+0x134>
movl   $0x1,-0x102c(%rbp)
jmp    1254 <decomment_asm+0x134>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x1028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1028(%rbp)
mov    %cl,(%rax)
jmp    1355 <decomment_asm+0x235>
cmpl   $0xa,-0x14(%rbp)
jne    126d <decomment_asm+0x14d>
movl   $0x0,-0x102c(%rbp)
jmp    1355 <decomment_asm+0x235>
mov    -0x14(%rbp),%cl
mov    -0x1028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1028(%rbp)
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1040(%rbp)
sub    $0x22,%eax
je     12b7 <decomment_asm+0x197>
jmp    12a3 <decomment_asm+0x183>
mov    -0x1040(%rbp),%eax
sub    $0x5c,%eax
je     12c6 <decomment_asm+0x1a6>
jmp    12ee <decomment_asm+0x1ce>
movl   $0x0,-0x102c(%rbp)
jmp    12ee <decomment_asm+0x1ce>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %al,%cl
mov    -0x1028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1028(%rbp)
mov    %cl,(%rax)
jmp    1355 <decomment_asm+0x235>
mov    -0x14(%rbp),%cl
mov    -0x1028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1028(%rbp)
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1044(%rbp)
sub    $0x27,%eax
je     1338 <decomment_asm+0x218>
jmp    1324 <decomment_asm+0x204>
mov    -0x1044(%rbp),%eax
sub    $0x5c,%eax
je     1347 <decomment_asm+0x227>
jmp    1350 <decomment_asm+0x230>
movl   $0x0,-0x102c(%rbp)
jmp    1350 <decomment_asm+0x230>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
jmp    1355 <decomment_asm+0x235>
mov    -0x1028(%rbp),%rax
lea    -0x1020(%rbp),%rcx
cmp    %rcx,%rax
jbe    1393 <decomment_asm+0x273>
mov    -0x1028(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0xa,%eax
jne    1393 <decomment_asm+0x273>
lea    -0x1020(%rbp),%rdi
lea    -0x1028(%rbp),%rsi
call   1030 <blankline@plt>
jmp    114b <decomment_asm+0x2b>
add    $0x1050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decomment_asm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1018,%rsp
mov    %rsi,%rbx
lea    0x10(%rsp),%r14
mov    %r14,0x8(%rsp)
mov    %rsi,%rdi
call   1040 <getc@plt>
mov    0x2e9b(%rip),%r12
cmp    (%r12),%eax
jne    1165 <decomment_asm+0x45>
add    $0x1018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
lea    0x8(%rsp),%r15
lea    0xe8d(%rip),%r13
jmp    118e <decomment_asm+0x6e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    (%r12),%eax
je     1153 <decomment_asm+0x33>
cmp    $0x3,%ebp
ja     12a0 <decomment_asm+0x180>
mov    %ebp,%ecx
movslq 0x0(%r13,%rcx,4),%rcx
add    %r13,%rcx
jmp    *%rcx
cmp    $0x22,%eax
je     1265 <decomment_asm+0x145>
cmp    $0x3b,%eax
je     127d <decomment_asm+0x15d>
cmp    $0x27,%eax
jne    1284 <decomment_asm+0x164>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsp)
movb   $0x27,(%rax)
mov    $0x3,%ebp
jmp    12a0 <decomment_asm+0x180>
nopl   0x0(%rax)
xor    %ebp,%ebp
cmp    $0xa,%eax
setne  %bpl
jmp    12a0 <decomment_asm+0x180>
xchg   %ax,%ax
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,0x8(%rsp)
mov    %al,(%rcx)
mov    $0x2,%ebp
cmp    $0x5c,%eax
je     1241 <decomment_asm+0x121>
cmp    $0x22,%eax
je     1294 <decomment_asm+0x174>
jmp    12a0 <decomment_asm+0x180>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,0x8(%rsp)
mov    %al,(%rcx)
mov    $0x3,%ebp
cmp    $0x5c,%eax
je     125b <decomment_asm+0x13b>
cmp    $0x27,%eax
je     1294 <decomment_asm+0x174>
jmp    12a0 <decomment_asm+0x180>
mov    %rbx,%rdi
call   1040 <getc@plt>
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,0x8(%rsp)
mov    %al,(%rcx)
jmp    12a0 <decomment_asm+0x180>
mov    %rbx,%rdi
call   1040 <getc@plt>
jmp    12a0 <decomment_asm+0x180>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsp)
movb   $0x22,(%rax)
mov    $0x2,%ebp
jmp    12a0 <decomment_asm+0x180>
mov    $0x1,%ebp
jmp    12a0 <decomment_asm+0x180>
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,0x8(%rsp)
mov    %al,(%rcx)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
cmp    %r14,%rax
jbe    1180 <decomment_asm+0x60>
cmpb   $0xa,-0x1(%rax)
jne    1180 <decomment_asm+0x60>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <blankline@plt>
jmp    1180 <decomment_asm+0x60>

LLVM IR (-O0):
@EOF = global i32 0
define void @decomment_asm(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4096 x i8]
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
store i8* %10, i8** %8
store i32 0, i32* %9
br label %11
11: ; preds = %81, %2
%12 = load i32*, i32** %4
%13 = call i32 @getc(i32* %12)
store i32 %13, i32* %5
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %82
16: ; preds = %11
%17 = load i32, i32* %9
switch i32 %17, label %68 [
i32 0, label %18
i32 1, label %37
i32 2, label %42
i32 3, label %57
]
18: ; preds = %16
%19 = load i32, i32* %5
switch i32 %19, label %31 [
i32 39, label %20
i32 34, label %25
i32 59, label %30
]
20: ; preds = %18
store i32 3, i32* %9
%21 = load i32, i32* %5
%22 = trunc i32 %21 to i8
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %8
store i8 %22, i8* %23
br label %36
25: ; preds = %18
store i32 2, i32* %9
%26 = load i32, i32* %5
%27 = trunc i32 %26 to i8
%28 = load i8*, i8** %8
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %8
store i8 %27, i8* %28
br label %36
30: ; preds = %18
store i32 1, i32* %9
br label %36
31: ; preds = %18
%32 = load i32, i32* %5
%33 = trunc i32 %32 to i8
%34 = load i8*, i8** %8
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %8
store i8 %33, i8* %34
br label %36
36: ; preds = %31, %30, %25, %20
br label %68
37: ; preds = %16
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 10
br i1 %39, label %40, label %41
40: ; preds = %37
store i32 0, i32* %9
br label %41
41: ; preds = %40, %37
br label %68
42: ; preds = %16
%43 = load i32, i32* %5
%44 = trunc i32 %43 to i8
%45 = load i8*, i8** %8
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %8
store i8 %44, i8* %45
%47 = load i32, i32* %5
switch i32 %47, label %56 [
i32 34, label %48
i32 92, label %49
]
48: ; preds = %42
store i32 0, i32* %9
br label %56
49: ; preds = %42
%50 = load i32*, i32** %4
%51 = call i32 @getc(i32* %50)
store i32 %51, i32* %6
%52 = load i32, i32* %6
%53 = trunc i32 %52 to i8
%54 = load i8*, i8** %8
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %8
store i8 %53, i8* %54
br label %56
56: ; preds = %42, %49, %48
br label %68
57: ; preds = %16
%58 = load i32, i32* %5
%59 = trunc i32 %58 to i8
%60 = load i8*, i8** %8
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %8
store i8 %59, i8* %60
%62 = load i32, i32* %5
switch i32 %62, label %67 [
i32 39, label %63
i32 92, label %64
]
63: ; preds = %57
store i32 0, i32* %9
br label %67
64: ; preds = %57
%65 = load i32*, i32** %4
%66 = call i32 @getc(i32* %65)
br label %67
67: ; preds = %57, %64, %63
br label %68
68: ; preds = %16, %67, %56, %41, %36
%69 = load i8*, i8** %8
%70 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%71 = icmp ugt i8* %69, %70
br i1 %71, label %72, label %81
72: ; preds = %68
%73 = load i8*, i8** %8
%74 = getelementptr inbounds i8, i8* %73, i64 -1
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 10
br i1 %77, label %78, label %81
78: ; preds = %72
%79 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%80 = call i32 @blankline(i8* %79, i8** %8)
br label %81
81: ; preds = %78, %72, %68
br label %11
82: ; preds = %11
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @decomment_asm(i8* nocapture readnone %0, i32* nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca i8*
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = bitcast i8** %4 to i8*
store i8* %5, i8** %4
%7 = call i32 @getc(i32* %1)
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %58, label %10
10: ; preds = %2, %54
%11 = phi i32 [ %55, %54 ], [ %7, %2 ]
%12 = phi i32 [ %45, %54 ], [ 0, %2 ]
switch i32 %12, label %44 [
i32 0, label %13
i32 1, label %24
i32 2, label %27
i32 3, label %37
]
13: ; preds = %10
switch i32 %11, label %20 [
i32 39, label %14
i32 34, label %17
i32 59, label %44
]
14: ; preds = %13
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %4
store i8 39, i8* %15
br label %44
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8* %19, i8** %4
store i8 34, i8* %18
br label %44
20: ; preds = %13
%21 = trunc i32 %11 to i8
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %23, i8** %4
store i8 %21, i8* %22
br label %44
24: ; preds = %10
%25 = icmp ne i32 %11, 10
%26 = zext i1 %25 to i32
br label %44
27: ; preds = %10
%28 = trunc i32 %11 to i8
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i64 1
store i8* %30, i8** %4
store i8 %28, i8* %29
switch i32 %11, label %44 [
i32 34, label %31
i32 92, label %32
]
31: ; preds = %27
br label %44
32: ; preds = %27
%33 = call i32 @getc(i32* %1)
%34 = trunc i32 %33 to i8
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 1
store i8* %36, i8** %4
store i8 %34, i8* %35
br label %44
37: ; preds = %10
%38 = trunc i32 %11 to i8
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 1
store i8* %40, i8** %4
store i8 %38, i8* %39
switch i32 %11, label %44 [
i32 39, label %41
i32 92, label %42
]
41: ; preds = %37
br label %44
42: ; preds = %37
%43 = call i32 @getc(i32* %1)
br label %44
44: ; preds = %24, %13, %41, %42, %37, %31, %32, %27, %14, %17, %20, %10
%45 = phi i32 [ %12, %10 ], [ 3, %37 ], [ 3, %42 ], [ 0, %41 ], [ 2, %27 ], [ 2, %32 ], [ 0, %31 ], [ 0, %20 ], [ 2, %17 ], [ 3, %14 ], [ 1, %13 ], [ %26, %24 ]
%46 = load i8*, i8** %4
%47 = icmp ugt i8* %46, %5
br i1 %47, label %48, label %54
48: ; preds = %44
%49 = getelementptr inbounds i8, i8* %46, i64 -1
%50 = load i8, i8* %49
%51 = icmp eq i8 %50, 10
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = call i32 @blankline(i8* %5, i8** %4)
br label %54
54: ; preds = %52, %48, %44
%55 = call i32 @getc(i32* %1)
%56 = load i32, i32* @EOF
%57 = icmp eq i32 %55, %56
br i1 %57, label %58, label %10
58: ; preds = %54, %2
ret void
}