#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*/ isgraph(char);
char *skipspace(char *);
size_t strlen(char *);
scalar_t__ strncmp(char *, char *, size_t);
char *iscmd(char *target, char *keyword) {
  size_t len = strlen(keyword);
  return strncmp(target, keyword, len) == 0 && !isgraph(target[len])
             ? skipspace(target + len)
             : NULL;
}


x86 assembly (clang, -O0):
<iscmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a8 <iscmd+0x68>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <isgraph@plt>
cmp    $0x0,%eax
jne    11a8 <iscmd+0x68>
mov    -0x8(%rbp),%rdi
add    -0x18(%rbp),%rdi
call   1050 <skipspace@plt>
mov    %rax,-0x20(%rbp)
jmp    11b3 <iscmd+0x73>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    11b3 <iscmd+0x73>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscmd>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1177 <iscmd+0x37>
movsbl (%r14,%r15,1),%edi
call   1060 <isgraph@plt>
test   %eax,%eax
je     117f <iscmd+0x3f>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
add    %r15,%r14
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <skipspace@plt>

LLVM IR (-O0):
define i8* @iscmd(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = load i64, i64* %5
%11 = call i64 @strncmp(i8* %8, i8* %9, i64 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load i64, i64* %5
%16 = getelementptr inbounds i8, i8* %14, i64 %15
%17 = load i8, i8* %16
%18 = call i32 @isgraph(i8 signext %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %13
%21 = load i8*, i8** %3
%22 = load i64, i64* %5
%23 = getelementptr inbounds i8, i8* %21, i64 %22
%24 = call i8* @skipspace(i8* %23)
br label %26
25: ; preds = %13, %2
br label %26
26: ; preds = %25, %20
%27 = phi i8* [ %24, %20 ], [ null, %25 ]
ret i8* %27
}

LLVM IR (-O2):
define i8* @iscmd(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i64 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %0, i64 %3
%8 = load i8, i8* %7
%9 = tail call i32 @isgraph(i8 signext %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i8* @skipspace(i8* %7)
br label %13
13: ; preds = %2, %6, %11
%14 = phi i8* [ %12, %11 ], [ null, %6 ], [ null, %2 ]
ret i8* %14
}