#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int inside_comment(void) {
  int c;
  c = getchar();
  if (c != '*') {
    putchar('/');
    putchar(c);
  }
  if (c == '*') {
    while (c = getchar()) {
      if (c == '*' && (c = getchar()) == '/')
        return 0;
      else if (c == EOF) {
        printf("\nError: unterminated comment\n");
        exit(EXIT_FAILURE);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<inside_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2a,-0x8(%rbp)
je     116e <inside_comment+0x2e>
mov    $0x2f,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0x2a,-0x8(%rbp)
jne    11f4 <inside_comment+0xb4>
jmp    117d <inside_comment+0x3d>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     11ef <inside_comment+0xaf>
cmpl   $0x2a,-0x8(%rbp)
jne    11b9 <inside_comment+0x79>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x2f,%eax
jne    11b9 <inside_comment+0x79>
movl   $0x0,-0x4(%rbp)
jmp    11fb <inside_comment+0xbb>
mov    -0x8(%rbp),%eax
mov    0x2e25(%rip),%rcx
cmp    (%rcx),%eax
jne    11e5 <inside_comment+0xa5>
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    11ea <inside_comment+0xaa>
jmp    117d <inside_comment+0x3d>
jmp    11f4 <inside_comment+0xb4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inside_comment>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x2a,%eax
jne    1182 <inside_comment+0x42>
mov    0x2e94(%rip),%rbx
jmp    1170 <inside_comment+0x30>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x2f,%eax
je     1195 <inside_comment+0x55>
cmp    (%rbx),%eax
je     1199 <inside_comment+0x59>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x2a,%eax
je     1160 <inside_comment+0x20>
test   %eax,%eax
jne    116c <inside_comment+0x2c>
jmp    1195 <inside_comment+0x55>
mov    %eax,%ebx
mov    $0x2f,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe60(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [30 x i8] c"\0AError: unterminated comment\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @inside_comment() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getchar()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 42
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @putchar(i32 47)
%8 = load i32, i32* %2
%9 = call i32 @putchar(i32 %8)
br label %10
10: ; preds = %6, %0
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 42
br i1 %12, label %13, label %35
13: ; preds = %10
br label %14
14: ; preds = %33, %13
%15 = call i32 (...) @getchar()
store i32 %15, i32* %2
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %34
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 42
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = call i32 (...) @getchar()
store i32 %21, i32* %2
%22 = icmp eq i32 %21, 47
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 0, i32* %1
br label %36
24: ; preds = %20, %17
%25 = load i32, i32* %2
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %24
br label %33
33: ; preds = %32
br label %14
34: ; preds = %14
br label %35
35: ; preds = %34, %10
store i32 0, i32* %1
br label %36
36: ; preds = %35, %23
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@EOF = global i32 0
@EXIT_FAILURE = global i32 0
@str = [29 x i8] c"\0AError: unterminated comment\00"
define i32 @inside_comment() {
%1 = tail call i32 (...) @getchar()
%2 = icmp eq i32 %1, 42
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @putchar(i32 47)
%5 = tail call i32 @putchar(i32 %1)
br label %19
6: ; preds = %0, %11
%7 = tail call i32 (...) @getchar()
switch i32 %7, label %11 [
i32 0, label %19
i32 42, label %8
]
8: ; preds = %6
%9 = tail call i32 (...) @getchar()
%10 = icmp eq i32 %9, 47
br i1 %10, label %19, label %11
11: ; preds = %6, %8
%12 = phi i32 [ %9, %8 ], [ %7, %6 ]
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %6
15: ; preds = %11
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %6, %8, %3
ret i32 0
}