#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 _xml_wfgetc(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int _oswcomment(FILE *fp_in, FILE *fp_out) {
  int c;
  if ((c = fgetc(fp_in)) == '!') {
    fputc(c, fp_out);
    while ((c = _xml_wfgetc(fp_in, fp_out)) != EOF) {
      if (c == '!') {
        if ((c = fgetc(fp_in)) == '>') {
          fputc(c, fp_out);
          return (1);
        }
        ungetc(c, fp_in);
      } else if (c == '-') {
        if ((c = fgetc(fp_in)) == '-') {
          fputc(c, fp_out);
          if ((c = fgetc(fp_in)) == '>') {
            fputc(c, fp_out);
            return (1);
          }
          ungetc(c, fp_in);
        } else {
          ungetc(c, fp_in);
        }
      } else {
        continue;
      }
    }
    return (-1);
  } else {
    ungetc(c, fp_in);
  }
  return (0);
}


x86 assembly (clang, -O0):
<_oswcomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x21,%eax
jne    126d <_oswcomment+0x12d>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <fputc@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <_xml_wfgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%eax
je     1261 <_oswcomment+0x121>
cmpl   $0x21,-0x1c(%rbp)
jne    11d8 <_oswcomment+0x98>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x3e,%eax
jne    11c7 <_oswcomment+0x87>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <fputc@plt>
movl   $0x1,-0x4(%rbp)
jmp    1280 <_oswcomment+0x140>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <ungetc@plt>
jmp    125c <_oswcomment+0x11c>
cmpl   $0x2d,-0x1c(%rbp)
jne    1252 <_oswcomment+0x112>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x2d,%eax
jne    1241 <_oswcomment+0x101>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <fputc@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x3e,%eax
jne    1230 <_oswcomment+0xf0>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <fputc@plt>
movl   $0x1,-0x4(%rbp)
jmp    1280 <_oswcomment+0x140>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <ungetc@plt>
jmp    124d <_oswcomment+0x10d>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <ungetc@plt>
jmp    1257 <_oswcomment+0x117>
jmp    1171 <_oswcomment+0x31>
jmp    125c <_oswcomment+0x11c>
jmp    1171 <_oswcomment+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1280 <_oswcomment+0x140>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <ungetc@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_oswcomment>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <fgetc@plt>
cmp    $0x21,%eax
jne    11ec <_oswcomment+0xac>
mov    $0x21,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <_xml_wfgetc@plt>
mov    0x2e6e(%rip),%rbp
mov    $0xffffffff,%r15d
jmp    11b2 <_oswcomment+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0x3e,%eax
je     1207 <_oswcomment+0xc7>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <ungetc@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <_xml_wfgetc@plt>
cmp    0x0(%rbp),%eax
je     11f9 <_oswcomment+0xb9>
cmp    $0x2d,%eax
je     11d0 <_oswcomment+0x90>
cmp    $0x21,%eax
je     1190 <_oswcomment+0x50>
jmp    11a7 <_oswcomment+0x67>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0x2d,%eax
jne    119d <_oswcomment+0x5d>
mov    $0x2d,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
jmp    1190 <_oswcomment+0x50>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <ungetc@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x3e,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    $0x1,%r15d
jmp    11f9 <_oswcomment+0xb9>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @_oswcomment(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
%7 = load i32*, i32** %4
%8 = call i32 @fgetc(i32* %7)
store i32 %8, i32* %6
%9 = icmp eq i32 %8, 33
br i1 %9, label %10, label %66
10: ; preds = %2
%11 = load i32, i32* %6
%12 = load i32*, i32** %5
%13 = call i32 @fputc(i32 %11, i32* %12)
br label %14
14: ; preds = %64, %62, %10
%15 = load i32*, i32** %4
%16 = load i32*, i32** %5
%17 = call i32 @_xml_wfgetc(i32* %15, i32* %16)
store i32 %17, i32* %6
%18 = load i32, i32* @EOF
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %65
20: ; preds = %14
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 33
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = load i32*, i32** %4
%25 = call i32 @fgetc(i32* %24)
store i32 %25, i32* %6
%26 = icmp eq i32 %25, 62
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i32, i32* %6
%29 = load i32*, i32** %5
%30 = call i32 @fputc(i32 %28, i32* %29)
store i32 1, i32* %3
br label %71
31: ; preds = %23
%32 = load i32, i32* %6
%33 = load i32*, i32** %4
%34 = call i32 @ungetc(i32 %32, i32* %33)
br label %64
35: ; preds = %20
%36 = load i32, i32* %6
%37 = icmp eq i32 %36, 45
br i1 %37, label %38, label %62
38: ; preds = %35
%39 = load i32*, i32** %4
%40 = call i32 @fgetc(i32* %39)
store i32 %40, i32* %6
%41 = icmp eq i32 %40, 45
br i1 %41, label %42, label %57
42: ; preds = %38
%43 = load i32, i32* %6
%44 = load i32*, i32** %5
%45 = call i32 @fputc(i32 %43, i32* %44)
%46 = load i32*, i32** %4
%47 = call i32 @fgetc(i32* %46)
store i32 %47, i32* %6
%48 = icmp eq i32 %47, 62
br i1 %48, label %49, label %53
49: ; preds = %42
%50 = load i32, i32* %6
%51 = load i32*, i32** %5
%52 = call i32 @fputc(i32 %50, i32* %51)
store i32 1, i32* %3
br label %71
53: ; preds = %42
%54 = load i32, i32* %6
%55 = load i32*, i32** %4
%56 = call i32 @ungetc(i32 %54, i32* %55)
br label %61
57: ; preds = %38
%58 = load i32, i32* %6
%59 = load i32*, i32** %4
%60 = call i32 @ungetc(i32 %58, i32* %59)
br label %61
61: ; preds = %57, %53
br label %63
62: ; preds = %35
br label %14
63: ; preds = %61
br label %64
64: ; preds = %63, %31
br label %14
65: ; preds = %14
store i32 -1, i32* %3
br label %71
66: ; preds = %2
%67 = load i32, i32* %6
%68 = load i32*, i32** %4
%69 = call i32 @ungetc(i32 %67, i32* %68)
br label %70
70: ; preds = %66
store i32 0, i32* %3
br label %71
71: ; preds = %70, %65, %49, %27
%72 = load i32, i32* %3
ret i32 %72
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @_oswcomment(i32* %0, i32* %1) {
%3 = tail call i32 @fgetc(i32* %0)
%4 = icmp eq i32 %3, 33
br i1 %4, label %5, label %33
5: ; preds = %2
%6 = tail call i32 @fputc(i32 33, i32* %1)
%7 = tail call i32 @_xml_wfgetc(i32* %0, i32* %1)
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %35, label %10
10: ; preds = %5, %29
%11 = phi i32 [ %30, %29 ], [ %7, %5 ]
switch i32 %11, label %29 [
i32 33, label %12
i32 45, label %17
]
12: ; preds = %10
%13 = tail call i32 @fgetc(i32* %0)
%14 = icmp eq i32 %13, 62
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = tail call i32 @fputc(i32 62, i32* %1)
br label %35
17: ; preds = %10
%18 = tail call i32 @fgetc(i32* %0)
%19 = icmp eq i32 %18, 45
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = tail call i32 @fputc(i32 45, i32* %1)
%22 = tail call i32 @fgetc(i32* %0)
%23 = icmp eq i32 %22, 62
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = tail call i32 @fputc(i32 62, i32* %1)
br label %35
26: ; preds = %17, %20, %12
%27 = phi i32 [ %13, %12 ], [ %22, %20 ], [ %18, %17 ]
%28 = tail call i32 @ungetc(i32 %27, i32* %0)
br label %29
29: ; preds = %26, %10
%30 = tail call i32 @_xml_wfgetc(i32* %0, i32* %1)
%31 = load i32, i32* @EOF
%32 = icmp eq i32 %30, %31
br i1 %32, label %35, label %10
33: ; preds = %2
%34 = tail call i32 @ungetc(i32 %3, i32* %0)
br label %35
35: ; preds = %29, %5, %33, %24, %15
%36 = phi i32 [ 1, %15 ], [ 1, %24 ], [ 0, %33 ], [ -1, %5 ], [ -1, %29 ]
ret i32 %36
}