#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 /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char com[30];
  int i = 2, a = 0;
  printf(" Enter comment: \n ");
  gets(com);
  if (com[0] == '/') {
    if (com[1] == '/')
      printf("It is a comment \n");
    else if (com[1] == '*') {
      for (i = 2; i <= 30; i++) {
        if (com[i] == '*' && com[i + 1] == '/') {
          printf("It is a comment \n ");
          a = 1;
          break;
        } else
          continue;
      }
      if (a == 0)
        printf("It is not a comment \n ");
    } else
      printf(" It is not a comment \n ");
  } else
    printf(" It is not a comment \n ");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <gets@plt>
movsbl -0x30(%rbp),%eax
cmp    $0x2f,%eax
jne    121f <main+0xff>
movsbl -0x2f(%rbp),%eax
cmp    $0x2f,%eax
jne    117d <main+0x5d>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    121a <main+0xfa>
movsbl -0x2f(%rbp),%eax
cmp    $0x2a,%eax
jne    1209 <main+0xe9>
movl   $0x2,-0x34(%rbp)
cmpl   $0x1e,-0x34(%rbp)
jg     11ee <main+0xce>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x2a,%eax
jne    11db <main+0xbb>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x2f,%eax
jne    11db <main+0xbb>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x38(%rbp)
jmp    11ee <main+0xce>
jmp    11e0 <main+0xc0>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1191 <main+0x71>
cmpl   $0x0,-0x38(%rbp)
jne    1204 <main+0xe4>
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
jmp    1215 <main+0xf5>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
jmp    121a <main+0xfa>
jmp    122b <main+0x10b>
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1050 <gets@plt>
cmpb   $0x2f,(%rsp)
jne    119e <main+0x6e>
mov    0x1(%rsp),%al
cmp    $0x2f,%al
je     11b1 <main+0x81>
cmp    $0x2a,%al
jne    119e <main+0x6e>
mov    $0x4,%eax
jmp    1174 <main+0x44>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x2,%rax
cmpb   $0x2a,-0x2(%rsp,%rax,1)
jne    1182 <main+0x52>
cmpb   $0x2f,-0x1(%rsp,%rax,1)
je     1195 <main+0x65>
cmp    $0x20,%rax
je     11bf <main+0x8f>
cmpb   $0x2a,-0x1(%rsp,%rax,1)
jne    1170 <main+0x40>
cmpb   $0x2f,(%rsp,%rax,1)
jne    1170 <main+0x40>
lea    0xe77(%rip),%rdi
jmp    11a5 <main+0x75>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
jmp    11aa <main+0x7a>
lea    0xe61(%rip),%rdi
jmp    11a5 <main+0x75>

LLVM IR (-O0):
@.str = [19 x i8] c" Enter comment: \0A \00"
@.str.1 = [18 x i8] c"It is a comment \0A\00"
@.str.2 = [19 x i8] c"It is a comment \0A \00"
@.str.3 = [23 x i8] c"It is not a comment \0A \00"
@.str.4 = [24 x i8] c" It is not a comment \0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %3
store i32 0, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 47
br i1 %11, label %12, label %59
12: ; preds = %0
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 47
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %58
19: ; preds = %12
%20 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 42
br i1 %23, label %24, label %55
24: ; preds = %19
store i32 2, i32* %3
br label %25
25: ; preds = %46, %24
%26 = load i32, i32* %3
%27 = icmp sle i32 %26, 30
br i1 %27, label %28, label %49
28: ; preds = %25
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 42
br i1 %34, label %35, label %45
35: ; preds = %28
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 47
br i1 %42, label %43, label %45
43: ; preds = %35
%44 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %4
br label %49
45: ; preds = %35, %28
br label %46
46: ; preds = %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %25
49: ; preds = %43, %25
%50 = load i32, i32* %4
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52, %49
br label %57
55: ; preds = %19
%56 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %57
57: ; preds = %55, %54
br label %58
58: ; preds = %57, %17
br label %61
59: ; preds = %0
%60 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %61
61: ; preds = %59, %58
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c" Enter comment: \0A \00"
@.str.2 = [19 x i8] c"It is a comment \0A \00"
@.str.3 = [23 x i8] c"It is not a comment \0A \00"
@.str.4 = [24 x i8] c" It is not a comment \0A \00"
@str = [17 x i8] c"It is a comment \00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 47
br i1 %6, label %7, label %40
7: ; preds = %0
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 1
%9 = load i8, i8* %8
switch i8 %9, label %38 [
i8 47, label %10
i8 42, label %12
]
10: ; preds = %7
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %42
12: ; preds = %7, %35
%13 = phi i64 [ %30, %35 ], [ 2, %7 ]
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 42
%17 = or i64 %13, 1
br i1 %16, label %18, label %24
18: ; preds = %12
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %17
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 47
br i1 %21, label %22, label %24
22: ; preds = %31, %18
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %42
24: ; preds = %12, %18
%25 = icmp eq i64 %17, 31
br i1 %25, label %36, label %26
26: ; preds = %24
%27 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %17
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 42
%30 = add nuw nsw i64 %13, 2
br i1 %29, label %31, label %35
31: ; preds = %26
%32 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %30
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 47
br i1 %34, label %22, label %35
35: ; preds = %31, %26
br label %12
36: ; preds = %24
%37 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %42
38: ; preds = %7
%39 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %42
40: ; preds = %0
%41 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %22, %10, %36, %38, %40
ret i32 0
}