#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 */
scalar_t__ scan_str(char const **, char *);
scalar_t__ skip_whitespace(char const **);
int is_string(const char *type) {
  skip_whitespace(&type);
  scan_str(&type, "const");
  skip_whitespace(&type);
  return scan_str(&type, "char") && skip_whitespace(&type) &&
         scan_str(&type, "*") && skip_whitespace(&type) && !*type;
}


x86 assembly (clang, -O0):
<is_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <skip_whitespace@plt>
lea    -0x8(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1040 <scan_str@plt>
lea    -0x8(%rbp),%rdi
call   1030 <skip_whitespace@plt>
lea    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1040 <scan_str@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     11d7 <is_string+0xb7>
lea    -0x8(%rbp),%rdi
call   1030 <skip_whitespace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     11d7 <is_string+0xb7>
lea    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1040 <scan_str@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     11d7 <is_string+0xb7>
lea    -0x8(%rbp),%rdi
call   1030 <skip_whitespace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     11d7 <is_string+0xb7>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_string>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <skip_whitespace@plt>
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
call   1040 <scan_str@plt>
mov    %rbx,%rdi
call   1030 <skip_whitespace@plt>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <scan_str@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     11a5 <is_string+0x85>
lea    0x8(%rsp),%rdi
call   1030 <skip_whitespace@plt>
test   %rax,%rax
je     11a5 <is_string+0x85>
lea    0xe91(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1040 <scan_str@plt>
test   %rax,%rax
je     11a5 <is_string+0x85>
lea    0x8(%rsp),%rdi
call   1030 <skip_whitespace@plt>
test   %rax,%rax
je     11a5 <is_string+0x85>
mov    0x8(%rsp),%rax
xor    %ebx,%ebx
cmpb   $0x0,(%rax)
sete   %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"const\00"
@.str.1 = [5 x i8] c"char\00"
@.str.2 = [2 x i8] c"*\00"
define i32 @is_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 @skip_whitespace(i8** %2)
%4 = call i64 @scan_str(i8** %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i64 @skip_whitespace(i8** %2)
%6 = call i64 @scan_str(i8** %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %1
%9 = call i64 @skip_whitespace(i8** %2)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = call i64 @scan_str(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = call i64 @skip_whitespace(i8** %2)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = icmp ne i8 %19, 0
%21 = xor i1 %20, true
br label %22
22: ; preds = %17, %14, %11, %8, %1
%23 = phi i1 [ false, %14 ], [ false, %11 ], [ false, %8 ], [ false, %1 ], [ %21, %17 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
@.str = [6 x i8] c"const\00"
@.str.1 = [5 x i8] c"char\00"
@.str.2 = [2 x i8] c"*\00"
define i32 @is_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 @skip_whitespace(i8** %2)
%4 = call i64 @scan_str(i8** %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i64 @skip_whitespace(i8** %2)
%6 = call i64 @scan_str(i8** %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %22, label %8
8: ; preds = %1
%9 = call i64 @skip_whitespace(i8** %2)
%10 = icmp eq i64 %9, 0
br i1 %10, label %22, label %11
11: ; preds = %8
%12 = call i64 @scan_str(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %22, label %14
14: ; preds = %11
%15 = call i64 @skip_whitespace(i8** %2)
%16 = icmp eq i64 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %14
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %17, %14, %11, %8, %1
%23 = phi i32 [ 0, %14 ], [ 0, %11 ], [ 0, %8 ], [ 0, %1 ], [ %21, %17 ]
ret i32 %23
}