#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__ strlen(char const *);
char *strstr(char const *, char const *);
short _check_command(const char *typed, const char *command, short strict) {
  char *result;
  int position;
  result = strstr(typed, command);
  if (result == NULL) {
    return 0;
  }
  position = (int)(result - typed);
  if (strict && strlen(typed) != strlen(command)) {
    return 0;
  }
  return position == 0;
}


x86 assembly (clang, -O0):
<_check_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dx,%ax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    115e <_check_command+0x3e>
movw   $0x0,-0x2(%rbp)
jmp    11ba <_check_command+0x9a>
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x2c(%rbp)
movswl -0x1a(%rbp),%eax
cmp    $0x0,%eax
je     11aa <_check_command+0x8a>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     11aa <_check_command+0x8a>
movw   $0x0,-0x2(%rbp)
jmp    11ba <_check_command+0x9a>
cmpl   $0x0,-0x2c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_command>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%r14
call   1040 <strstr@plt>
test   %rax,%rax
je     1163 <_check_command+0x43>
mov    %rax,%rbx
test   %bp,%bp
je     1159 <_check_command+0x39>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %rax,%rbp
jne    1163 <_check_command+0x43>
xor    %eax,%eax
sub    %r14d,%ebx
sete   %al
jmp    1165 <_check_command+0x45>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define signext i16 @_check_command(i8* %0, i8* %1, i16 signext %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i16
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i16 %2, i16* %7
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i8* @strstr(i8* %10, i8* %11)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %3
store i16 0, i16* %4
br label %38
16: ; preds = %3
%17 = load i8*, i8** %8
%18 = load i8*, i8** %5
%19 = ptrtoint i8* %17 to i64
%20 = ptrtoint i8* %18 to i64
%21 = sub i64 %19, %20
%22 = trunc i64 %21 to i32
store i32 %22, i32* %9
%23 = load i16, i16* %7
%24 = sext i16 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %33
26: ; preds = %16
%27 = load i8*, i8** %5
%28 = call i64 @strlen(i8* %27)
%29 = load i8*, i8** %6
%30 = call i64 @strlen(i8* %29)
%31 = icmp ne i64 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %26
store i16 0, i16* %4
br label %38
33: ; preds = %26, %16
%34 = load i32, i32* %9
%35 = icmp eq i32 %34, 0
%36 = zext i1 %35 to i32
%37 = trunc i32 %36 to i16
store i16 %37, i16* %4
br label %38
38: ; preds = %33, %32, %15
%39 = load i16, i16* %4
ret i16 %39
}

LLVM IR (-O2):
define signext i16 @_check_command(i8* %0, i8* nocapture %1, i16 signext %2) {
%4 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %19, label %6
6: ; preds = %3
%7 = ptrtoint i8* %4 to i64
%8 = ptrtoint i8* %0 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
%11 = icmp eq i16 %2, 0
br i1 %11, label %16, label %12
12: ; preds = %6
%13 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%14 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%15 = icmp eq i64 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12, %6
%17 = icmp eq i32 %10, 0
%18 = zext i1 %17 to i16
br label %19
19: ; preds = %12, %3, %16
%20 = phi i16 [ %18, %16 ], [ 0, %3 ], [ 0, %12 ]
ret i16 %20
}