#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 get_keyword(char *);
int s_getchar();
scalar_t__ scan_white(int);
int /*<<< orphan*/ skip_end_comment(int);
int /*<<< orphan*/ skip_following_comment();
int scan_keyword() {
  char keyw[20];
  int kw_len = 0, kwt, c;
  while ((c = s_getchar()) != 0) {
    if (scan_white(c))
      continue;
    if (c == '\'')
      break;
    if (kw_len + 2 >= 20)
      break;
    keyw[kw_len++] = c;
  }
  keyw[kw_len] = 0;
  kwt = get_keyword(keyw);
  if (kwt == 260)
    skip_following_comment();
  if (kwt == 261)
    skip_end_comment(1);
  return kwt;
}


x86 assembly (clang, -O0):
<scan_keyword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x24(%rbp)
mov    $0x0,%al
call   1040 <s_getchar@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
je     11c7 <scan_keyword+0x77>
mov    -0x2c(%rbp),%edi
call   1050 <scan_white@plt>
cmp    $0x0,%rax
je     1189 <scan_keyword+0x39>
jmp    115f <scan_keyword+0xf>
cmpl   $0x27,-0x2c(%rbp)
jne    1198 <scan_keyword+0x48>
jmp    11c7 <scan_keyword+0x77>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
cmp    $0x14,%eax
jl     11ac <scan_keyword+0x5c>
jmp    11c7 <scan_keyword+0x77>
mov    -0x2c(%rbp),%eax
mov    %al,%cl
mov    -0x24(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cltq
mov    %cl,-0x20(%rbp,%rax,1)
jmp    115f <scan_keyword+0xf>
movslq -0x24(%rbp),%rax
movb   $0x0,-0x20(%rbp,%rax,1)
lea    -0x20(%rbp),%rdi
call   1070 <get_keyword@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x104,-0x28(%rbp)
jne    11f0 <scan_keyword+0xa0>
mov    $0x0,%al
call   1030 <skip_following_comment@plt>
cmpl   $0x105,-0x28(%rbp)
jne    1207 <scan_keyword+0xb7>
mov    $0x1,%edi
call   1060 <skip_end_comment@plt>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_keyword>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <s_getchar@plt>
test   %eax,%eax
je     118e <scan_keyword+0x3e>
mov    %eax,%ebx
mov    %eax,%edi
call   1050 <scan_white@plt>
test   %rax,%rax
jne    1160 <scan_keyword+0x10>
cmp    $0x27,%ebx
je     118e <scan_keyword+0x3e>
cmp    $0x11,%r14
ja     118e <scan_keyword+0x3e>
mov    %bl,(%rsp,%r14,1)
add    $0x1,%r14
jmp    1160 <scan_keyword+0x10>
mov    %r14d,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1070 <get_keyword@plt>
mov    %eax,%ebx
cmp    $0x105,%eax
je     11b7 <scan_keyword+0x67>
cmp    $0x104,%ebx
jne    11c1 <scan_keyword+0x71>
xor    %eax,%eax
call   1030 <skip_following_comment@plt>
jmp    11c1 <scan_keyword+0x71>
mov    $0x1,%edi
call   1060 <skip_end_comment@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @scan_keyword() {
%1 = alloca [20 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %2
br label %5
5: ; preds = %22, %12, %0
%6 = call i32 (...) @s_getchar()
store i32 %6, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %29
8: ; preds = %5
%9 = load i32, i32* %4
%10 = call i64 @scan_white(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %5
13: ; preds = %8
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 39
br i1 %15, label %16, label %17
16: ; preds = %13
br label %29
17: ; preds = %13
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 2
%20 = icmp sge i32 %19, 20
br i1 %20, label %21, label %22
21: ; preds = %17
br label %29
22: ; preds = %17
%23 = load i32, i32* %4
%24 = trunc i32 %23 to i8
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %27
store i8 %24, i8* %28
br label %5
29: ; preds = %21, %16, %5
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %31
store i8 0, i8* %32
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%34 = call i32 @get_keyword(i8* %33)
store i32 %34, i32* %3
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 260
br i1 %36, label %37, label %39
37: ; preds = %29
%38 = call i32 (...) @skip_following_comment()
br label %39
39: ; preds = %37, %29
%40 = load i32, i32* %3
%41 = icmp eq i32 %40, 261
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 @skip_end_comment(i32 1)
br label %44
44: ; preds = %42, %39
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
define i32 @scan_keyword() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %15, %0
%4 = phi i64 [ %17, %15 ], [ 0, %0 ]
br label %5
5: ; preds = %3, %8
%6 = tail call i32 (...) @s_getchar()
%7 = icmp eq i32 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %5
%9 = tail call i64 @scan_white(i32 %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %5
11: ; preds = %8
%12 = icmp eq i32 %6, 39
%13 = icmp ugt i64 %4, 17
%14 = select i1 %12, i1 true, i1 %13
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = trunc i32 %6 to i8
%17 = add nuw nsw i64 %4, 1
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %4
store i8 %16, i8* %18
br label %3
19: ; preds = %11, %5
%20 = and i64 %4, 4294967295
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %20
store i8 0, i8* %21
%22 = call i32 @get_keyword(i8* %2)
switch i32 %22, label %27 [
i32 260, label %23
i32 261, label %25
]
23: ; preds = %19
%24 = call i32 (...) @skip_following_comment()
br label %27
25: ; preds = %19
%26 = call i32 @skip_end_comment(i32 1)
br label %27
27: ; preds = %23, %19, %25
ret i32 %22
}