#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*/ Bool;

/* Variables and functions */
int /*<<< orphan*/ False;
int /*<<< orphan*/ True;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
Bool isabbreviation(char *arg, char *s, int minslen) {
  int arglen;
  int slen;
  if (strcmp(arg, s) == 0)
    return (True);
  arglen = strlen(arg);
  slen = strlen(s);
  if (slen >= arglen || slen < minslen)
    return (False);
  if (strncmp(arg, s, slen) == 0)
    return (True);
  return (False);
}


x86 assembly (clang, -O0):
<isabbreviation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    116b <isabbreviation+0x3b>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <isabbreviation+0xb3>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    119b <isabbreviation+0x6b>
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ac <isabbreviation+0x7c>
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <isabbreviation+0xb3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11d7 <isabbreviation+0xa7>
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <isabbreviation+0xb3>
mov    0x2e0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isabbreviation>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <strcmp@plt>
test   %rax,%rax
je     117e <isabbreviation+0x4e>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    0x2e85(%rip),%rcx
cmp    %ebp,%eax
jge    118e <isabbreviation+0x5e>
cmp    %r15d,%eax
jl     118e <isabbreviation+0x5e>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1187 <isabbreviation+0x57>
mov    0x2e5b(%rip),%rcx
jmp    118e <isabbreviation+0x5e>
mov    0x2e5a(%rip),%rcx
mov    (%rcx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@True = global i32 0
@False = global i32 0
define i32 @isabbreviation(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i64 @strcmp(i8* %10, i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = load i32, i32* @True
store i32 %15, i32* %4
br label %40
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %8
%19 = load i8*, i8** %6
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = load i32, i32* %8
%23 = icmp sge i32 %21, %22
br i1 %23, label %28, label %24
24: ; preds = %16
%25 = load i32, i32* %9
%26 = load i32, i32* %7
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24, %16
%29 = load i32, i32* @False
store i32 %29, i32* %4
br label %40
30: ; preds = %24
%31 = load i8*, i8** %5
%32 = load i8*, i8** %6
%33 = load i32, i32* %9
%34 = call i64 @strncmp(i8* %31, i8* %32, i32 %33)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = load i32, i32* @True
store i32 %37, i32* %4
br label %40
38: ; preds = %30
%39 = load i32, i32* @False
store i32 %39, i32* %4
br label %40
40: ; preds = %38, %36, %28, %14
%41 = load i32, i32* %4
ret i32 %41
}

LLVM IR (-O2):
@True = global i32 0
@False = global i32 0
define i32 @isabbreviation(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %0)
%8 = tail call i32 @strlen(i8* %1)
%9 = icmp sge i32 %8, %7
%10 = icmp slt i32 %8, %2
%11 = or i1 %9, %10
br i1 %11, label %16, label %12
12: ; preds = %6
%13 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %8)
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i32* @True, i32* @False
br label %16
16: ; preds = %12, %6, %3
%17 = phi i32* [ @True, %3 ], [ @False, %6 ], [ %15, %12 ]
%18 = load i32, i32* %17
ret i32 %18
}