#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int int32_t;

/* Variables and functions */
scalar_t__ memcmp(int /*<<< orphan*/ const *, char *, size_t);
bool IsPrompt(int32_t length, const uint8_t *data) {
  if (length == 5 && memcmp(data, "COM1>", (size_t)length) == 0) {
    return true;
  }
  if (length == 5 && memcmp(data, "COM2>", (size_t)length) == 0) {
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<IsPrompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    1153 <IsPrompt+0x43>
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rdx
lea    0xec8(%rip),%rsi
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jne    1153 <IsPrompt+0x43>
movl   $0x1,-0x4(%rbp)
jmp    118e <IsPrompt+0x7e>
cmpl   $0x5,-0x8(%rbp)
jne    1187 <IsPrompt+0x77>
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rdx
lea    0xe9a(%rip),%rsi
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jne    1187 <IsPrompt+0x77>
movl   $0x1,-0x4(%rbp)
jmp    118e <IsPrompt+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsPrompt>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x5,%edi
jne    1152 <IsPrompt+0x42>
mov    %rsi,%rbx
lea    0xede(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <memcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1154 <IsPrompt+0x44>
lea    0xec6(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <memcmp@plt>
test   %rax,%rax
je     1154 <IsPrompt+0x44>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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