#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*/ A_BOLD;
int EOF;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ getyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ printw(char *, ...);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int main(int argc, char const *argv[]) {
  int ch, prev, row, col;
  prev = EOF;
  FILE *fp;
  int y, x;
  if (argc != 2) {
    printf("Usage: %s <a c file name>\n", argv[0]);
    exit(1);
  }
  fp = fopen(argv[1], "r");
  if (fp == NULL) {
    perror("Cannot open input file");
    exit(1);
  }
  initscr();
  getmaxyx(stdscr, row, col);
  while ((ch = fgetc(fp)) != EOF) {
    getyx(stdscr, y, x);
    if (y == (row - 1)) {
      printw("<-Press Any Key->");
      getch();
      clear();
      move(0, 0);
    }
    if (prev == '/' && ch == '*') {
      attron(A_BOLD);
      getyx(stdscr, y, x);
      move(y, x - 1);
      printw("%c%c", '/', ch);
    } else {
      printw("%c", ch);
    }
    refresh();
    if (prev == '*' && ch == '/') {
      attroff(A_BOLD);
    }
    prev = ch;
  }
  endwin();
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1259 <main+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdb6(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb3(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1292 <main+0x82>
lea    0xd9a(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    $0x0,%al
call   1070 <initscr@plt>
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10a0 <getmaxyx@plt>
mov    -0x28(%rbp),%rdi
call   1080 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2d28(%rip),%rcx
cmp    (%rcx),%eax
je     13b6 <main+0x1a6>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
call   1050 <getyx@plt>
mov    -0x2c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1312 <main+0x102>
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   10b0 <printw@plt>
mov    $0x0,%al
call   10d0 <getch@plt>
mov    $0x0,%al
call   1120 <clear@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1130 <move@plt>
cmpl   $0x2f,-0x18(%rbp)
jne    1371 <main+0x161>
cmpl   $0x2a,-0x14(%rbp)
jne    1371 <main+0x161>
mov    0x2ca3(%rip),%rax
mov    (%rax),%edi
call   1090 <attron@plt>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
call   1050 <getyx@plt>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
sub    $0x1,%esi
call   1130 <move@plt>
mov    -0x14(%rbp),%edx
lea    0xce6(%rip),%rdi
mov    $0x2f,%esi
mov    $0x0,%al
call   10b0 <printw@plt>
jmp    1382 <main+0x172>
mov    -0x14(%rbp),%esi
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   10b0 <printw@plt>
mov    $0x0,%al
call   10c0 <refresh@plt>
cmpl   $0x2a,-0x18(%rbp)
jne    13ab <main+0x19b>
cmpl   $0x2f,-0x14(%rbp)
jne    13ab <main+0x19b>
mov    0x2c2c(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    12ad <main+0x9d>
mov    $0x0,%al
call   10e0 <endwin@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1314 <main+0x124>
mov    0x2ddd(%rip),%r12
mov    (%r12),%r15d
mov    0x8(%rsi),%rdi
lea    0xe01(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     132d <main+0x13d>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <initscr@plt>
mov    0x2da7(%rip),%r13
mov    0x0(%r13),%edi
call   10a0 <getmaxyx@plt>
mov    %rbx,%rdi
call   1080 <fgetc@plt>
cmp    (%r12),%eax
jne    1270 <main+0x80>
xor    %eax,%eax
call   10d0 <endwin@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d59(%rip),%r14
jmp    128e <main+0x9e>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1080 <fgetc@plt>
cmp    (%r12),%eax
je     1250 <main+0x60>
mov    %r15d,%ebp
mov    %eax,%r15d
mov    0x0(%r13),%edi
call   1050 <getyx@plt>
cmp    $0x2f,%ebp
jne    12e0 <main+0xf0>
cmp    $0x2a,%r15d
jne    12e0 <main+0xf0>
mov    (%r14),%edi
call   1090 <attron@plt>
mov    0x0(%r13),%edi
call   1050 <getyx@plt>
call   1110 <move@plt>
lea    0xd6f(%rip),%rdi
mov    $0x2f,%esi
mov    $0x2a,%edx
xor    %eax,%eax
call   10b0 <printw@plt>
jmp    12f1 <main+0x101>
nopl   0x0(%rax,%rax,1)
lea    0xd4f(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   10b0 <printw@plt>
xor    %eax,%eax
call   10c0 <refresh@plt>
cmp    $0x2a,%ebp
jne    1280 <main+0x90>
cmp    $0x2f,%r15d
jne    1280 <main+0x90>
mov    (%r14),%edi
call   1030 <attroff@plt>
jmp    1280 <main+0x90>
mov    (%rsi),%rsi
lea    0xce2(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xce9(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [27 x i8] c"Usage: %s <a c file name>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [23 x i8] c"Cannot open input file\00"
@stdscr = global i32 0
@.str.3 = [18 x i8] c"<-Press Any Key->\00"
@A_BOLD = global i32 0
@.str.4 = [5 x i8] c"%c%c\00"
@.str.5 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* @EOF
store i32 %13, i32* %7
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %10
%27 = load i32*, i32** %10
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %22
%33 = call i32 (...) @initscr()
%34 = load i32, i32* @stdscr
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = call i32 @getmaxyx(i32 %34, i32 %35, i32 %36)
br label %38
38: ; preds = %89, %32
%39 = load i32*, i32** %10
%40 = call i32 @fgetc(i32* %39)
store i32 %40, i32* %6
%41 = load i32, i32* @EOF
%42 = icmp ne i32 %40, %41
br i1 %42, label %43, label %91
43: ; preds = %38
%44 = load i32, i32* @stdscr
%45 = load i32, i32* %11
%46 = load i32, i32* %12
%47 = call i32 @getyx(i32 %44, i32 %45, i32 %46)
%48 = load i32, i32* %11
%49 = load i32, i32* %8
%50 = sub nsw i32 %49, 1
%51 = icmp eq i32 %48, %50
br i1 %51, label %52, label %57
52: ; preds = %43
%53 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%54 = call i32 (...) @getch()
%55 = call i32 (...) @clear()
%56 = call i32 @move(i32 0, i32 0)
br label %57
57: ; preds = %52, %43
%58 = load i32, i32* %7
%59 = icmp eq i32 %58, 47
br i1 %59, label %60, label %76
60: ; preds = %57
%61 = load i32, i32* %6
%62 = icmp eq i32 %61, 42
br i1 %62, label %63, label %76
63: ; preds = %60
%64 = load i32, i32* @A_BOLD
%65 = call i32 @attron(i32 %64)
%66 = load i32, i32* @stdscr
%67 = load i32, i32* %11
%68 = load i32, i32* %12
%69 = call i32 @getyx(i32 %66, i32 %67, i32 %68)
%70 = load i32, i32* %11
%71 = load i32, i32* %12
%72 = sub nsw i32 %71, 1
%73 = call i32 @move(i32 %70, i32 %72)
%74 = load i32, i32* %6
%75 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 47, i32 %74)
br label %79
76: ; preds = %60, %57
%77 = load i32, i32* %6
%78 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %76, %63
%80 = call i32 (...) @refresh()
%81 = load i32, i32* %7
%82 = icmp eq i32 %81, 42
br i1 %82, label %83, label %89
83: ; preds = %79
%84 = load i32, i32* %6
%85 = icmp eq i32 %84, 47
br i1 %85, label %86, label %89
86: ; preds = %83
%87 = load i32, i32* @A_BOLD
%88 = call i32 @attroff(i32 %87)
br label %89
89: ; preds = %86, %83, %79
%90 = load i32, i32* %6
store i32 %90, i32* %7
br label %38
91: ; preds = %38
%92 = call i32 (...) @endwin()
%93 = load i32*, i32** %10
%94 = call i32 @fclose(i32* %93)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [27 x i8] c"Usage: %s <a c file name>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [23 x i8] c"Cannot open input file\00"
@stdscr = global i32 0
@A_BOLD = global i32 0
@.str.4 = [5 x i8] c"%c%c\00"
@.str.5 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %9
%18 = tail call i32 (...) @initscr()
%19 = load i32, i32* @stdscr
%20 = tail call i32 @getmaxyx(i32 %19, i32 undef, i32 undef)
%21 = tail call i32 @fgetc(i32* %12)
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %53, label %24
24: ; preds = %17, %49
%25 = phi i32 [ %50, %49 ], [ %21, %17 ]
%26 = phi i32 [ %25, %49 ], [ %3, %17 ]
%27 = load i32, i32* @stdscr
%28 = tail call i32 @getyx(i32 %27, i32 undef, i32 undef)
%29 = icmp eq i32 %26, 47
%30 = icmp eq i32 %25, 42
%31 = and i1 %29, %30
br i1 %31, label %32, label %39
32: ; preds = %24
%33 = load i32, i32* @A_BOLD
%34 = tail call i32 @attron(i32 %33)
%35 = load i32, i32* @stdscr
%36 = tail call i32 @getyx(i32 %35, i32 undef, i32 undef)
%37 = tail call i32 @move(i32 undef, i32 undef)
%38 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 47, i32 42)
br label %41
39: ; preds = %24
%40 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %25)
br label %41
41: ; preds = %39, %32
%42 = tail call i32 (...) @refresh()
%43 = icmp eq i32 %26, 42
%44 = icmp eq i32 %25, 47
%45 = and i1 %43, %44
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = load i32, i32* @A_BOLD
%48 = tail call i32 @attroff(i32 %47)
br label %49
49: ; preds = %46, %41
%50 = tail call i32 @fgetc(i32* %12)
%51 = load i32, i32* @EOF
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %24
53: ; preds = %49, %17
%54 = tail call i32 (...) @endwin()
%55 = tail call i32 @fclose(i32* %12)
ret i32 0
}