#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 */
struct data_node {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ maybe_doc_comment(int /*<<< orphan*/ *, struct data_node *);
int /*<<< orphan*/ oneline_comment(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void maybe_comment(FILE *f, struct data_node *doc) {
  int c = getc(f);
  switch (c) {
  case '/':
    oneline_comment(f);
    break;
  case '*':
    maybe_doc_comment(f, doc);
    break;
  default:
    ungetc(c, f);
    break;
  }
}


x86 assembly (clang, -O0):
<maybe_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x2a,%eax
je     118f <maybe_comment+0x4f>
jmp    1170 <maybe_comment+0x30>
mov    -0x18(%rbp),%eax
sub    $0x2f,%eax
jne    11a1 <maybe_comment+0x61>
jmp    1181 <maybe_comment+0x41>
mov    -0x8(%rbp),%rdi
call   1030 <oneline_comment@plt>
jmp    11ad <maybe_comment+0x6d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <maybe_doc_comment@plt>
jmp    11ad <maybe_comment+0x6d>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <ungetc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maybe_comment>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1060 <getc@plt>
cmp    $0x2a,%eax
je     1168 <maybe_comment+0x28>
cmp    $0x2f,%eax
jne    117a <maybe_comment+0x3a>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <oneline_comment@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <maybe_doc_comment@plt>
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ungetc@plt>

LLVM IR (-O0):
%struct.data_node = type { i32 }
define void @maybe_comment(i32* %0, %struct.data_node* %1) {
%3 = alloca i32*
%4 = alloca %struct.data_node*
%5 = alloca i32
store i32* %0, i32** %3
store %struct.data_node* %1, %struct.data_node** %4
%6 = load i32*, i32** %3
%7 = call i32 @getc(i32* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
switch i32 %8, label %16 [
i32 47, label %9
i32 42, label %12
]
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = call i32 @oneline_comment(i32* %10)
br label %20
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = load %struct.data_node*, %struct.data_node** %4
%15 = call i32 @maybe_doc_comment(i32* %13, %struct.data_node* %14)
br label %20
16: ; preds = %2
%17 = load i32, i32* %5
%18 = load i32*, i32** %3
%19 = call i32 @ungetc(i32 %17, i32* %18)
br label %20
20: ; preds = %16, %12, %9
ret void
}

LLVM IR (-O2):
%struct.data_node = type { i32 }
define void @maybe_comment(i32* %0, %struct.data_node* %1) {
%3 = tail call i32 @getc(i32* %0)
switch i32 %3, label %8 [
i32 47, label %4
i32 42, label %6
]
4: ; preds = %2
%5 = tail call i32 @oneline_comment(i32* %0)
br label %10
6: ; preds = %2
%7 = tail call i32 @maybe_doc_comment(i32* %0, %struct.data_node* %1)
br label %10
8: ; preds = %2
%9 = tail call i32 @ungetc(i32 %3, i32* %0)
br label %10
10: ; preds = %8, %6, %4
ret void
}