#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__ isspace(unsigned char);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
char *try_config(char *s, char *opt) {
  int len;
  len = strlen(opt);
  if (strncmp(s, opt, len) != 0 || !isspace((unsigned char)s[len]))
    return NULL;
  s += len;
  while (isspace((unsigned char)*s))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<try_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1181 <try_config+0x51>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
jne    118e <try_config+0x5e>
movq   $0x0,-0x8(%rbp)
jmp    11ce <try_config+0x9e>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     11c6 <try_config+0x96>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    119f <try_config+0x6f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try_config>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     115a <try_config+0x2a>
xor    %ebx,%ebx
jmp    1192 <try_config+0x62>
movslq %ebp,%rbx
movzbl (%r14,%rbx,1),%edi
call   1050 <isspace@plt>
test   %rax,%rax
je     1156 <try_config+0x26>
add    %r14,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1050 <isspace@plt>
test   %rax,%rax
jne    1180 <try_config+0x50>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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