#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 */
struct incdir {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_include(char const *, int, struct incdir *);
void extract_incname(const char *start, char endchar, struct incdir *list) {
  const char *end = start;
  while (*end != endchar) {
    if (!*end)
      return;
    ++end;
  }
  add_include(start, end - start, list);
}


x86 assembly (clang, -O0):
<extract_incname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     1164 <extract_incname+0x54>
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1153 <extract_incname+0x43>
jmp    117e <extract_incname+0x6e>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112e <extract_incname+0x1e>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
call   1030 <add_include@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_incname>:
mov    (%rdi),%cl
mov    %rdi,%rax
cmp    %sil,%cl
je     1131 <extract_incname+0x21>
mov    %rdi,%rax
nopl   (%rax)
test   %cl,%cl
je     113a <extract_incname+0x2a>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
cmp    %sil,%cl
jne    1120 <extract_incname+0x10>
sub    %edi,%eax
mov    %eax,%esi
jmp    1030 <add_include@plt>
ret

LLVM IR (-O0):
%struct.incdir = type { i32 }
define void @extract_incname(i8* %0, i8 signext %1, %struct.incdir* %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca %struct.incdir*
%7 = alloca i8*
store i8* %0, i8** %4
store i8 %1, i8* %5
store %struct.incdir* %2, %struct.incdir** %6
%8 = load i8*, i8** %4
store i8* %8, i8** %7
br label %9
9: ; preds = %21, %3
%10 = load i8*, i8** %7
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %12, %14
br i1 %15, label %16, label %24
16: ; preds = %9
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
br label %34
21: ; preds = %16
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %7
br label %9
24: ; preds = %9
%25 = load i8*, i8** %4
%26 = load i8*, i8** %7
%27 = load i8*, i8** %4
%28 = ptrtoint i8* %26 to i64
%29 = ptrtoint i8* %27 to i64
%30 = sub i64 %28, %29
%31 = trunc i64 %30 to i32
%32 = load %struct.incdir*, %struct.incdir** %6
%33 = call i32 @add_include(i8* %25, i32 %31, %struct.incdir* %32)
br label %34
34: ; preds = %24, %20
ret void
}

LLVM IR (-O2):
%struct.incdir = type { i32 }
define void @extract_incname(i8* %0, i8 signext %1, %struct.incdir* %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, %1
br i1 %5, label %14, label %6
6: ; preds = %3, %10
%7 = phi i8 [ %12, %10 ], [ %4, %3 ]
%8 = phi i8* [ %11, %10 ], [ %0, %3 ]
%9 = icmp eq i8 %7, 0
br i1 %9, label %21, label %10
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, %1
br i1 %13, label %14, label %6
14: ; preds = %10, %3
%15 = phi i8* [ %0, %3 ], [ %11, %10 ]
%16 = ptrtoint i8* %15 to i64
%17 = ptrtoint i8* %0 to i64
%18 = sub i64 %16, %17
%19 = trunc i64 %18 to i32
%20 = tail call i32 @add_include(i8* %0, i32 %19, %struct.incdir* %2)
br label %21
21: ; preds = %6, %14
ret void
}