#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 *, int /*<<< orphan*/);
int utp_can_busy(char *command) {
  char *async[] = {
      "$ ",
      "frf",
      "pollpipe",
      NULL,
  };
  char **ptr;
  ptr = async;
  while (*ptr) {
    if (strncmp(command, *ptr, strlen(*ptr)) == 0)
      return 1;
    ptr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<utp_can_busy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ccd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmpq   $0x0,(%rax)
je     11c3 <utp_can_busy+0xa3>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11b2 <utp_can_busy+0x92>
movl   $0x1,-0x4(%rbp)
jmp    11ca <utp_can_busy+0xaa>
mov    -0x38(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
jmp    1160 <utp_can_busy+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utp_can_busy>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r14
movaps 0x2cdd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2cc1(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%r15
lea    0xeb1(%rip),%rbx
nop
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     117a <utp_can_busy+0x5a>
mov    (%r15),%rbx
add    $0x8,%r15
test   %rbx,%rbx
jne    1150 <utp_can_busy+0x30>
xor    %eax,%eax
jmp    117f <utp_can_busy+0x5f>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"$ \00"
@.str.1 = [4 x i8] c"frf\00"
@.str.2 = [9 x i8] c"pollpipe\00"
@__const.utp_can_busy.async = [4 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* null]
define i32 @utp_can_busy(i8* %0) {
%2 = alloca [4 x i8*]
%3 = bitcast [4 x i8*]* %2 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
br label %8
5: ; preds = %8
%6 = load i8*, i8** %14
%7 = icmp eq i8* %6, null
br i1 %7, label %15, label %8
8: ; preds = %1, %5
%9 = phi i8* [ %6, %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ]
%10 = phi i8** [ %14, %5 ], [ %4, %1 ]
%11 = tail call i32 @strlen(i8* %9)
%12 = tail call i64 @strncmp(i8* %0, i8* %9, i32 %11)
%13 = icmp eq i64 %12, 0
%14 = getelementptr inbounds i8*, i8** %10, i64 1
br i1 %13, label %15, label %5
15: ; preds = %8, %5
%16 = phi i32 [ 1, %8 ], [ 0, %5 ]
ret i32 %16
}