#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 /*<<< orphan*/ echo_quote(int /*<<< orphan*/ *, int /*<<< orphan*/ *, char);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ in_comment(int /*<<< orphan*/ *);
void recomment(FILE *in, FILE *out, char ch) {
  char d;
  if (ch == '/') {
    if ((d = fgetc(in)) == '*') {
      in_comment(in);
    } else if (d == '/') {
      fputc(d, out);
      recomment(in, out, d);
    } else {
      fputc(ch, out);
      fputc(d, out);
    }
  } else if (ch == '\'' || ch == '"') {
    echo_quote(in, out, ch);
  } else {
    fputc(ch, out);
  }
}


x86 assembly (clang, -O0):
<recomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x2f,%eax
jne    11f2 <recomment+0xa2>
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x12(%rbp)
movsbl %al,%eax
cmp    $0x2a,%eax
jne    1198 <recomment+0x48>
mov    -0x8(%rbp),%rdi
call   1030 <in_comment@plt>
jmp    11ed <recomment+0x9d>
movsbl -0x12(%rbp),%eax
cmp    $0x2f,%eax
jne    11ca <recomment+0x7a>
mov    -0x12(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsbl -0x12(%rbp),%edx
call   1060 <recomment@plt>
jmp    11e8 <recomment+0x98>
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
mov    -0x12(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
jmp    11ed <recomment+0x9d>
jmp    1236 <recomment+0xe6>
movsbl -0x11(%rbp),%eax
cmp    $0x27,%eax
je     120c <recomment+0xbc>
movsbl -0x11(%rbp),%eax
cmp    $0x22,%eax
jne    1222 <recomment+0xd2>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsbl -0x11(%rbp),%edx
call   1070 <echo_quote@plt>
jmp    1231 <recomment+0xe1>
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
jmp    1236 <recomment+0xe6>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recomment>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
cmp    $0x2f,%dl
jne    1170 <recomment+0x30>
mov    %r15,%rdi
call   1040 <fgetc@plt>
cmp    $0x2f,%al
jne    118d <recomment+0x4d>
mov    $0x2f,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    $0x2f,%dl
cmp    $0x2f,%dl
je     1150 <recomment+0x10>
cmp    $0x22,%dl
je     117a <recomment+0x3a>
cmp    $0x27,%dl
jne    11a0 <recomment+0x60>
movsbl %dl,%edx
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <echo_quote@plt>
mov    %eax,%ebx
cmp    $0x2a,%al
jne    11a5 <recomment+0x65>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <in_comment@plt>
movsbl %dl,%edi
jmp    11b5 <recomment+0x75>
mov    $0x2f,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
movsbl %bl,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <fputc@plt>

LLVM IR (-O0):
define void @recomment(i32* %0, i32* %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8
%7 = alloca i8
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 47
br i1 %10, label %11, label %39
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = call signext i8 @fgetc(i32* %12)
store i8 %13, i8* %7
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 42
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32*, i32** %4
%18 = call i32 @in_comment(i32* %17)
br label %38
19: ; preds = %11
%20 = load i8, i8* %7
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 47
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i8, i8* %7
%25 = load i32*, i32** %5
%26 = call i32 @fputc(i8 signext %24, i32* %25)
%27 = load i32*, i32** %4
%28 = load i32*, i32** %5
%29 = load i8, i8* %7
br label %37
30: ; preds = %19
%31 = load i8, i8* %6
%32 = load i32*, i32** %5
%33 = call i32 @fputc(i8 signext %31, i32* %32)
%34 = load i8, i8* %7
%35 = load i32*, i32** %5
%36 = call i32 @fputc(i8 signext %34, i32* %35)
br label %37
37: ; preds = %30, %23
br label %38
38: ; preds = %37, %16
br label %57
39: ; preds = %3
%40 = load i8, i8* %6
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 39
br i1 %42, label %47, label %43
43: ; preds = %39
%44 = load i8, i8* %6
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 34
br i1 %46, label %47, label %52
47: ; preds = %43, %39
%48 = load i32*, i32** %4
%49 = load i32*, i32** %5
%50 = load i8, i8* %6
%51 = call i32 @echo_quote(i32* %48, i32* %49, i8 signext %50)
br label %56
52: ; preds = %43
%53 = load i8, i8* %6
%54 = load i32*, i32** %5
%55 = call i32 @fputc(i8 signext %53, i32* %54)
br label %56
56: ; preds = %52, %47
br label %57
57: ; preds = %56, %38
ret void
}

LLVM IR (-O2):
define void @recomment(i32* %0, i32* %1, i8 signext %2) {
br label %4
4: ; preds = %10, %3
%5 = phi i8 [ %2, %3 ], [ 47, %10 ]
switch i8 %5, label %17 [
i8 47, label %6
i8 39, label %15
i8 34, label %15
]
6: ; preds = %4
%7 = tail call signext i8 @fgetc(i32* %0)
switch i8 %7, label %12 [
i8 42, label %8
i8 47, label %10
]
8: ; preds = %6
%9 = tail call i32 @in_comment(i32* %0)
br label %19
10: ; preds = %6
%11 = tail call i32 @fputc(i8 signext 47, i32* %1)
br label %4
12: ; preds = %6
%13 = tail call i32 @fputc(i8 signext 47, i32* %1)
%14 = tail call i32 @fputc(i8 signext %7, i32* %1)
br label %19
15: ; preds = %4, %4
%16 = tail call i32 @echo_quote(i32* %0, i32* %1, i8 signext %5)
br label %19
17: ; preds = %4
%18 = tail call i32 @fputc(i8 signext %5, i32* %1)
br label %19
19: ; preds = %15, %17, %8, %12
ret void
}