#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__ strncmp(char *, char *, int);
int line_iserror(char *line) {
  int rc;
  char *next;
  if (strncmp(line, "*** ERROR[", 10) == 0)
    rc = 1;
  else {
    for (next = line; *next == ' '; next++)
      ;
    if (*next == '^')
      rc = 1;
    else if (strncmp(next, "...", 3) == 0)
      rc = 1;
    else
      rc = 0;
  }
  return rc;
}


x86 assembly (clang, -O0):
<line_iserror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0xa,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1147 <line_iserror+0x37>
movl   $0x1,-0xc(%rbp)
jmp    11cd <line_iserror+0xbd>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1175 <line_iserror+0x65>
jmp    1164 <line_iserror+0x54>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114f <line_iserror+0x3f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5e,%eax
jne    1191 <line_iserror+0x81>
movl   $0x1,-0xc(%rbp)
jmp    11c8 <line_iserror+0xb8>
mov    -0x18(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11bc <line_iserror+0xac>
movl   $0x1,-0xc(%rbp)
jmp    11c3 <line_iserror+0xb3>
movl   $0x0,-0xc(%rbp)
jmp    11c8 <line_iserror+0xb8>
jmp    11cd <line_iserror+0xbd>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line_iserror>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0xa,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1172 <line_iserror+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rbx),%ecx
cmp    $0x20,%cl
jne    114e <line_iserror+0x3e>
add    $0x1,%rbx
jmp    1140 <line_iserror+0x30>
cmp    $0x5e,%cl
je     1172 <line_iserror+0x62>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"*** ERROR[\00"
@.str.1 = [4 x i8] c"...\00"
define i32 @line_iserror(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %3
br label %34
9: ; preds = %1
%10 = load i8*, i8** %2
store i8* %10, i8** %4
br label %11
11: ; preds = %17, %9
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %20
16: ; preds = %11
br label %17
17: ; preds = %16
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
br label %11
20: ; preds = %11
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 94
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 1, i32* %3
br label %33
26: ; preds = %20
%27 = load i8*, i8** %4
%28 = call i64 @strncmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 1, i32* %3
br label %32
31: ; preds = %26
store i32 0, i32* %3
br label %32
32: ; preds = %31, %30
br label %33
33: ; preds = %32, %25
br label %34
34: ; preds = %33, %8
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [11 x i8] c"*** ERROR[\00"
@.str.1 = [4 x i8] c"...\00"
define i32 @line_iserror(i8* %0) {
%2 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10)
%3 = icmp eq i64 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %7
%5 = phi i8* [ %8, %7 ], [ %0, %1 ]
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 32, label %7
i8 94, label %13
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
9: ; preds = %4
%10 = tail call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %4, %9, %1
%14 = phi i32 [ 1, %1 ], [ %12, %9 ], [ 1, %4 ]
ret i32 %14
}