#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*/ strlen(char *);
scalar_t__ strncmp(char *, char const *, int /*<<< orphan*/);
bool clrstr_is_close(const char *txt) {
  if (strncmp("<<<", txt, strlen("<<<")) != 0)
    return false;
  if (strncmp("<<<"
              ""
              ">>>",
              txt,
              strlen("<<<"
                     ""
                     ">>>")) == 0)
    return true;
  return false;
}


x86 assembly (clang, -O0):
<clrstr_is_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xec5(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xeb3(%rip),%rdi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1168 <clrstr_is_close+0x48>
movl   $0x0,-0x4(%rbp)
jmp    11ab <clrstr_is_close+0x8b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe8d(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe7b(%rip),%rdi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a4 <clrstr_is_close+0x84>
movl   $0x1,-0x4(%rbp)
jmp    11ab <clrstr_is_close+0x8b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clrstr_is_close>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1174 <clrstr_is_close+0x54>
lea    0xeb0(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"<<<\00"
@.str.1 = [7 x i8] c"<<<>>>\00"
define i32 @clrstr_is_close(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %16
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 1, i32* %2
br label %16
15: ; preds = %9
store i32 0, i32* %2
br label %16
16: ; preds = %15, %14, %8
%17 = load i32, i32* %2
ret i32 %17
}

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