#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 strlen(char const *);
int /*<<< orphan*/ strncmp(char const *, char const *, int);
int does_ctrl_o(const char *exit_cap, const char *acs_cap) {
  const char *eptr = exit_cap, *aptr = acs_cap;
  int l;
  l = strlen(acs_cap);
  while (*eptr != 0) {
    if (!strncmp(eptr, aptr, l))
      return 1;
    eptr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<does_ctrl_o>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1192 <does_ctrl_o+0x72>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1181 <does_ctrl_o+0x61>
movl   $0x1,-0x4(%rbp)
jmp    1199 <does_ctrl_o+0x79>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114c <does_ctrl_o+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<does_ctrl_o>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rbp
mov    %rsi,%rdi
call   1040 <strlen@plt>
xor    %r14d,%r14d
cmpb   $0x0,0x0(%rbp)
je     1163 <does_ctrl_o+0x43>
mov    %eax,%ebx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     115d <does_ctrl_o+0x3d>
cmpb   $0x0,0x1(%rbp)
lea    0x1(%rbp),%rbp
jne    1140 <does_ctrl_o+0x20>
jmp    1163 <does_ctrl_o+0x43>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @does_ctrl_o(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
store i8* %9, i8** %6
%10 = load i8*, i8** %5
store i8* %10, i8** %7
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %8
br label %13
13: ; preds = %25, %2
%14 = load i8*, i8** %6
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %13
%19 = load i8*, i8** %6
%20 = load i8*, i8** %7
%21 = load i32, i32* %8
%22 = call i32 @strncmp(i8* %19, i8* %20, i32 %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %18
store i32 1, i32* %3
br label %29
25: ; preds = %18
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %6
br label %13
28: ; preds = %13
store i32 0, i32* %3
br label %29
29: ; preds = %28, %24
%30 = load i32, i32* %3
ret i32 %30
}

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