#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 buildopt {
  int dummy;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ cli_buildopt_cflags(struct buildopt *, char *);
int /*<<< orphan*/ cli_buildopt_cxxflags(struct buildopt *, char *);
int /*<<< orphan*/ cli_buildopt_kore_flavor(struct buildopt *, char *);
int /*<<< orphan*/ cli_buildopt_kore_source(struct buildopt *, char *);
int /*<<< orphan*/ cli_buildopt_ldflags(struct buildopt *, char *);
struct buildopt *cli_buildopt_new(char *);
int /*<<< orphan*/ cli_buildopt_single_binary(struct buildopt *, char *);
int /*<<< orphan*/ cli_fatal(char *, char const *, ...);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ *fopen(char const *, char *);
char *kore_read_line(int /*<<< orphan*/ *, char *, int);
char *kore_text_trim(char *, scalar_t__);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcasecmp(char *, char *);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
scalar_t__ strlen(char *);
void cli_buildopt_parse(const char *path) {
  FILE *fp;
  struct buildopt *bopt;
  char buf[BUFSIZ], *p, *t;
  if ((fp = fopen(path, "r")) == NULL)
    cli_fatal("cli_buildopt_parse: fopen(%s): %s", path, strerror(errno));
  bopt = NULL;
  while ((p = kore_read_line(fp, buf, sizeof(buf))) != NULL) {
    if (strlen(p) == 0)
      continue;
    if (bopt != NULL && !strcmp(p, "}")) {
      bopt = NULL;
      continue;
    }
    if (bopt == NULL) {
      if ((t = strchr(p, '=')) != NULL)
        goto parse_option;
      if ((t = strchr(p, ' ')) == NULL)
        cli_fatal("unexpected '%s'", p);
      *(t)++ = '\0';
      if (strcmp(t, "{"))
        cli_fatal("expected '{', got '%s'", t);
      bopt = cli_buildopt_new(p);
      continue;
    }
    if ((t = strchr(p, '=')) == NULL) {
      printf("bad buildopt line: '%s'\n", p);
      continue;
    }
  parse_option:
    *(t)++ = '\0';
    p = kore_text_trim(p, strlen(p));
    t = kore_text_trim(t, strlen(t));
    if (!strcasecmp(p, "cflags")) {
      cli_buildopt_cflags(bopt, t);
    } else if (!strcasecmp(p, "cxxflags")) {
      cli_buildopt_cxxflags(bopt, t);
    } else if (!strcasecmp(p, "ldflags")) {
      cli_buildopt_ldflags(bopt, t);
    } else if (!strcasecmp(p, "single_binary")) {
      cli_buildopt_single_binary(bopt, t);
    } else if (!strcasecmp(p, "kore_source")) {
      cli_buildopt_kore_source(bopt, t);
    } else if (!strcasecmp(p, "kore_flavor")) {
      cli_buildopt_kore_flavor(bopt, t);
    } else {
      printf("ignoring unknown option '%s'\n", p);
    }
  }
}


x86 assembly (clang, -O0):
<cli_buildopt_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x48(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1294 <cli_buildopt_parse+0x84>
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1100 <cli_fatal@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
call   1110 <kore_read_line@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     156b <cli_buildopt_parse+0x35b>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jne    12d5 <cli_buildopt_parse+0xc5>
jmp    129c <cli_buildopt_parse+0x8c>
cmpq   $0x0,-0x18(%rbp)
je     1307 <cli_buildopt_parse+0xf7>
mov    -0x30(%rbp),%rdi
lea    0xd37(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    1307 <cli_buildopt_parse+0xf7>
movq   $0x0,-0x18(%rbp)
jmp    129c <cli_buildopt_parse+0x8c>
cmpq   $0x0,-0x18(%rbp)
jne    13b1 <cli_buildopt_parse+0x1a1>
mov    -0x30(%rbp),%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     1333 <cli_buildopt_parse+0x123>
jmp    13e7 <cli_buildopt_parse+0x1d7>
mov    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1060 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1361 <cli_buildopt_parse+0x151>
mov    -0x30(%rbp),%rsi
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1100 <cli_fatal@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rdi
lea    0xcb6(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     139f <cli_buildopt_parse+0x18f>
mov    -0x38(%rbp),%rsi
lea    0xc9e(%rip),%rdi
mov    $0x0,%al
call   1100 <cli_fatal@plt>
mov    -0x30(%rbp),%rdi
call   10b0 <cli_buildopt_new@plt>
mov    %rax,-0x18(%rbp)
jmp    129c <cli_buildopt_parse+0x8c>
mov    -0x30(%rbp),%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    13e2 <cli_buildopt_parse+0x1d2>
mov    -0x30(%rbp),%rsi
lea    0xc75(%rip),%rdi
call   1070 <printf@plt>
jmp    129c <cli_buildopt_parse+0x8c>
jmp    13e7 <cli_buildopt_parse+0x1d7>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    %rax,%rsi
call   10f0 <kore_text_trim@plt>
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rsi
call   10f0 <kore_text_trim@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xc20(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1466 <cli_buildopt_parse+0x256>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1080 <cli_buildopt_cflags@plt>
jmp    1566 <cli_buildopt_parse+0x356>
mov    -0x30(%rbp),%rdi
lea    0xbfc(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1491 <cli_buildopt_parse+0x281>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1040 <cli_buildopt_cxxflags@plt>
jmp    1561 <cli_buildopt_parse+0x351>
mov    -0x30(%rbp),%rdi
lea    0xbda(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14bc <cli_buildopt_parse+0x2ac>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10a0 <cli_buildopt_ldflags@plt>
jmp    155c <cli_buildopt_parse+0x34c>
mov    -0x30(%rbp),%rdi
lea    0xbb7(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14e7 <cli_buildopt_parse+0x2d7>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10c0 <cli_buildopt_single_binary@plt>
jmp    1557 <cli_buildopt_parse+0x347>
mov    -0x30(%rbp),%rdi
lea    0xb9a(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1512 <cli_buildopt_parse+0x302>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10e0 <cli_buildopt_kore_source@plt>
jmp    1552 <cli_buildopt_parse+0x342>
mov    -0x30(%rbp),%rdi
lea    0xb7b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    153d <cli_buildopt_parse+0x32d>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1090 <cli_buildopt_kore_flavor@plt>
jmp    154d <cli_buildopt_parse+0x33d>
mov    -0x30(%rbp),%rsi
lea    0xb5c(%rip),%rdi
call   1070 <printf@plt>
jmp    1552 <cli_buildopt_parse+0x342>
jmp    1557 <cli_buildopt_parse+0x347>
jmp    155c <cli_buildopt_parse+0x34c>
jmp    1561 <cli_buildopt_parse+0x351>
jmp    1566 <cli_buildopt_parse+0x356>
jmp    129c <cli_buildopt_parse+0x8c>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_buildopt_parse>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
mov    0x2db5(%rip),%rax
mov    (%rax),%ebx
mov    %rsp,%r14
mov    %rbx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0xe5a(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1276 <cli_buildopt_parse+0x66>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
lea    0xd96(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1100 <cli_fatal@plt>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1110 <kore_read_line@plt>
test   %rax,%rax
je     14c0 <cli_buildopt_parse+0x2b0>
mov    %rax,%r12
mov    %r13,%r15
xor    %r13d,%r13d
mov    %r14,-0x30(%rbp)
mov    %r15,-0x38(%rbp)
jmp    12cb <cli_buildopt_parse+0xbb>
lea    0xda7(%rip),%rdi
mov    %r12,%rsi
call   1070 <printf@plt>
mov    -0x38(%rbp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1110 <kore_read_line@plt>
mov    %rax,%r12
test   %rax,%rax
je     14c0 <cli_buildopt_parse+0x2b0>
cmpb   $0x0,(%r12)
je     12b2 <cli_buildopt_parse+0xa2>
mov    %r12,%rdi
test   %r13,%r13
je     1310 <cli_buildopt_parse+0x100>
lea    0xd41(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1445 <cli_buildopt_parse+0x235>
mov    %r12,%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1326 <cli_buildopt_parse+0x116>
jmp    129f <cli_buildopt_parse+0x8f>
cs nopw 0x0(%rax,%rax,1)
mov    $0x3d,%esi
call   1060 <strchr@plt>
mov    %rax,%r15
test   %rax,%rax
je     144d <cli_buildopt_parse+0x23d>
mov    %rbx,%r14
movb   $0x0,(%r15)
add    $0x1,%r15
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   10f0 <kore_text_trim@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   10f0 <kore_text_trim@plt>
mov    %rax,%r12
mov    %rbx,%rdi
lea    0xcff(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     13e7 <cli_buildopt_parse+0x1d7>
mov    %rbx,%rdi
lea    0xcf3(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     13f4 <cli_buildopt_parse+0x1e4>
mov    %rbx,%rdi
lea    0xce9(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
mov    -0x38(%rbp),%r15
je     140b <cli_buildopt_parse+0x1fb>
mov    %rbx,%rdi
lea    0xcda(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     141b <cli_buildopt_parse+0x20b>
mov    %rbx,%rdi
lea    0xcd5(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     142b <cli_buildopt_parse+0x21b>
mov    %rbx,%rdi
lea    0xcce(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1438 <cli_buildopt_parse+0x228>
lea    0xcca(%rip),%rdi
mov    %rbx,%rsi
call   1070 <printf@plt>
jmp    14b4 <cli_buildopt_parse+0x2a4>
mov    %r13,%rdi
mov    %r12,%rsi
call   1080 <cli_buildopt_cflags@plt>
jmp    13ff <cli_buildopt_parse+0x1ef>
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <cli_buildopt_cxxflags@plt>
mov    %r14,%rbx
mov    -0x30(%rbp),%r14
jmp    12ae <cli_buildopt_parse+0x9e>
mov    %r13,%rdi
mov    %r12,%rsi
call   10a0 <cli_buildopt_ldflags@plt>
jmp    14b4 <cli_buildopt_parse+0x2a4>
mov    %r13,%rdi
mov    %r12,%rsi
call   10c0 <cli_buildopt_single_binary@plt>
jmp    14b4 <cli_buildopt_parse+0x2a4>
mov    %r13,%rdi
mov    %r12,%rsi
call   10e0 <cli_buildopt_kore_source@plt>
jmp    14b4 <cli_buildopt_parse+0x2a4>
mov    %r13,%rdi
mov    %r12,%rsi
call   1090 <cli_buildopt_kore_flavor@plt>
jmp    14b4 <cli_buildopt_parse+0x2a4>
xor    %r13d,%r13d
jmp    12b2 <cli_buildopt_parse+0xa2>
mov    %rbx,%r14
mov    %r12,%rdi
mov    $0x20,%esi
call   1060 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1476 <cli_buildopt_parse+0x266>
lea    0xbb8(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1100 <cli_fatal@plt>
mov    %rbx,%rax
add    $0x1,%rbx
movb   $0x0,(%rax)
mov    %rbx,%rdi
lea    0xbaa(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
mov    -0x38(%rbp),%r15
je     14a9 <cli_buildopt_parse+0x299>
lea    0xb97(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1100 <cli_fatal@plt>
mov    %r12,%rdi
call   10b0 <cli_buildopt_new@plt>
mov    %rax,%r13
mov    %r14,%rbx
mov    -0x30(%rbp),%r14
jmp    12b2 <cli_buildopt_parse+0xa2>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.buildopt = type { i32 }
@BUFSIZ = global i32 0
@.str = [2 x i8] c"r\00"
@.str.1 = [34 x i8] c"cli_buildopt_parse: fopen(%s): %s\00"
@errno = global i32 0
@.str.2 = [2 x i8] c"}\00"
@.str.3 = [16 x i8] c"unexpected '%s'\00"
@.str.4 = [2 x i8] c"{\00"
@.str.5 = [23 x i8] c"expected '{', got '%s'\00"
@.str.6 = [25 x i8] c"bad buildopt line: '%s'\0A\00"
@.str.7 = [7 x i8] c"cflags\00"
@.str.8 = [9 x i8] c"cxxflags\00"
@.str.9 = [8 x i8] c"ldflags\00"
@.str.10 = [14 x i8] c"single_binary\00"
@.str.11 = [12 x i8] c"kore_source\00"
@.str.12 = [12 x i8] c"kore_flavor\00"
@.str.13 = [30 x i8] c"ignoring unknown option '%s'\0A\00"
define void @cli_buildopt_parse(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca %struct.buildopt*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %2
%9 = load i32, i32* @BUFSIZ
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i8, i64 %10
store i64 %10, i64* %6
%13 = load i8*, i8** %2
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %3
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %21
16: ; preds = %1
%17 = load i8*, i8** %2
%18 = load i32, i32* @errno
%19 = call i32 @strerror(i32 %18)
%20 = call i32 (i8*, i8*, ...) @cli_fatal(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %19)
br label %21
21: ; preds = %16, %1
store %struct.buildopt* null, %struct.buildopt** %4
br label %22
22: ; preds = %141, %71, %64, %39, %31, %21
%23 = load i32*, i32** %3
%24 = trunc i64 %10 to i32
%25 = call i8* @kore_read_line(i32* %23, i8* %12, i32 %24)
store i8* %25, i8** %7
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %142
27: ; preds = %22
%28 = load i8*, i8** %7
%29 = call i64 @strlen(i8* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27
br label %22
32: ; preds = %27
%33 = load %struct.buildopt*, %struct.buildopt** %4
%34 = icmp ne %struct.buildopt* %33, null
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load i8*, i8** %7
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp ne i64 %37, 0
br i1 %38, label %40, label %39
39: ; preds = %35
store %struct.buildopt* null, %struct.buildopt** %4
br label %22
40: ; preds = %35, %32
%41 = load %struct.buildopt*, %struct.buildopt** %4
%42 = icmp eq %struct.buildopt* %41, null
br i1 %42, label %43, label %67
43: ; preds = %40
%44 = load i8*, i8** %7
%45 = call i8* @strchr(i8* %44, i8 signext 61)
store i8* %45, i8** %8
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %48
47: ; preds = %43
br label %75
48: ; preds = %43
%49 = load i8*, i8** %7
%50 = call i8* @strchr(i8* %49, i8 signext 32)
store i8* %50, i8** %8
%51 = icmp eq i8* %50, null
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i8*, i8** %7
%54 = call i32 (i8*, i8*, ...) @cli_fatal(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %53)
br label %55
55: ; preds = %52, %48
%56 = load i8*, i8** %8
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %8
store i8 0, i8* %56
%58 = load i8*, i8** %8
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %55
%62 = load i8*, i8** %8
%63 = call i32 (i8*, i8*, ...) @cli_fatal(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %62)
br label %64
64: ; preds = %61, %55
%65 = load i8*, i8** %7
%66 = call %struct.buildopt* @cli_buildopt_new(i8* %65)
store %struct.buildopt* %66, %struct.buildopt** %4
br label %22
67: ; preds = %40
%68 = load i8*, i8** %7
%69 = call i8* @strchr(i8* %68, i8 signext 61)
store i8* %69, i8** %8
%70 = icmp eq i8* %69, null
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = load i8*, i8** %7
%73 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %72)
br label %22
74: ; preds = %67
br label %75
75: ; preds = %74, %47
%76 = load i8*, i8** %8
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %8
store i8 0, i8* %76
%78 = load i8*, i8** %7
%79 = load i8*, i8** %7
%80 = call i64 @strlen(i8* %79)
%81 = call i8* @kore_text_trim(i8* %78, i64 %80)
store i8* %81, i8** %7
%82 = load i8*, i8** %8
%83 = load i8*, i8** %8
%84 = call i64 @strlen(i8* %83)
%85 = call i8* @kore_text_trim(i8* %82, i64 %84)
store i8* %85, i8** %8
%86 = load i8*, i8** %7
%87 = call i32 @strcasecmp(i8* %86, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%88 = icmp ne i32 %87, 0
br i1 %88, label %93, label %89
89: ; preds = %75
%90 = load %struct.buildopt*, %struct.buildopt** %4
%91 = load i8*, i8** %8
%92 = call i32 @cli_buildopt_cflags(%struct.buildopt* %90, i8* %91)
br label %141
93: ; preds = %75
%94 = load i8*, i8** %7
%95 = call i32 @strcasecmp(i8* %94, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%96 = icmp ne i32 %95, 0
br i1 %96, label %101, label %97
97: ; preds = %93
%98 = load %struct.buildopt*, %struct.buildopt** %4
%99 = load i8*, i8** %8
%100 = call i32 @cli_buildopt_cxxflags(%struct.buildopt* %98, i8* %99)
br label %140
101: ; preds = %93
%102 = load i8*, i8** %7
%103 = call i32 @strcasecmp(i8* %102, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%104 = icmp ne i32 %103, 0
br i1 %104, label %109, label %105
105: ; preds = %101
%106 = load %struct.buildopt*, %struct.buildopt** %4
%107 = load i8*, i8** %8
%108 = call i32 @cli_buildopt_ldflags(%struct.buildopt* %106, i8* %107)
br label %139
109: ; preds = %101
%110 = load i8*, i8** %7
%111 = call i32 @strcasecmp(i8* %110, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%112 = icmp ne i32 %111, 0
br i1 %112, label %117, label %113
113: ; preds = %109
%114 = load %struct.buildopt*, %struct.buildopt** %4
%115 = load i8*, i8** %8
%116 = call i32 @cli_buildopt_single_binary(%struct.buildopt* %114, i8* %115)
br label %138
117: ; preds = %109
%118 = load i8*, i8** %7
%119 = call i32 @strcasecmp(i8* %118, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%120 = icmp ne i32 %119, 0
br i1 %120, label %125, label %121
121: ; preds = %117
%122 = load %struct.buildopt*, %struct.buildopt** %4
%123 = load i8*, i8** %8
%124 = call i32 @cli_buildopt_kore_source(%struct.buildopt* %122, i8* %123)
br label %137
125: ; preds = %117
%126 = load i8*, i8** %7
%127 = call i32 @strcasecmp(i8* %126, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%128 = icmp ne i32 %127, 0
br i1 %128, label %133, label %129
129: ; preds = %125
%130 = load %struct.buildopt*, %struct.buildopt** %4
%131 = load i8*, i8** %8
%132 = call i32 @cli_buildopt_kore_flavor(%struct.buildopt* %130, i8* %131)
br label %136
133: ; preds = %125
%134 = load i8*, i8** %7
%135 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.13, i64 0, i64 0), i8* %134)
br label %136
136: ; preds = %133, %129
br label %137
137: ; preds = %136, %121
br label %138
138: ; preds = %137, %113
br label %139
139: ; preds = %138, %105
br label %140
140: ; preds = %139, %97
br label %141
141: ; preds = %140, %89
br label %22
142: ; preds = %22
%143 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
%struct.buildopt = type { i32 }
@BUFSIZ = global i32 0
@.str = [2 x i8] c"r\00"
@.str.1 = [34 x i8] c"cli_buildopt_parse: fopen(%s): %s\00"
@errno = global i32 0
@.str.2 = [2 x i8] c"}\00"
@.str.3 = [16 x i8] c"unexpected '%s'\00"
@.str.4 = [2 x i8] c"{\00"
@.str.5 = [23 x i8] c"expected '{', got '%s'\00"
@.str.6 = [25 x i8] c"bad buildopt line: '%s'\0A\00"
@.str.7 = [7 x i8] c"cflags\00"
@.str.8 = [9 x i8] c"cxxflags\00"
@.str.9 = [8 x i8] c"ldflags\00"
@.str.10 = [14 x i8] c"single_binary\00"
@.str.11 = [12 x i8] c"kore_source\00"
@.str.12 = [12 x i8] c"kore_flavor\00"
@.str.13 = [30 x i8] c"ignoring unknown option '%s'\0A\00"
define void @cli_buildopt_parse(i8* %0) {
%2 = load i32, i32* @BUFSIZ
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @errno
%9 = tail call i32 @strerror(i32 %8)
%10 = tail call i32 (i8*, i8*, ...) @cli_fatal(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %9)
br label %11
11: ; preds = %7, %1
%12 = call i8* @kore_read_line(i32* %5, i8* %4, i32 %2)
%13 = icmp eq i8* %12, null
br i1 %13, label %92, label %14
14: ; preds = %11, %42
%15 = phi i8* [ %44, %42 ], [ %12, %11 ]
%16 = phi %struct.buildopt* [ %43, %42 ], [ null, %11 ]
%17 = icmp eq %struct.buildopt* %16, null
br label %18
18: ; preds = %14, %51
%19 = phi i8* [ %15, %14 ], [ %52, %51 ]
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %51, label %22
22: ; preds = %18
br i1 %17, label %26, label %23
23: ; preds = %22
%24 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %42, label %46
26: ; preds = %22
%27 = call i8* @strchr(i8* %19, i8 signext 61)
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %54
29: ; preds = %26
%30 = call i8* @strchr(i8* %19, i8 signext 32)
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, i8*, ...) @cli_fatal(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %34
34: ; preds = %32, %29
%35 = getelementptr inbounds i8, i8* %30, i64 1
store i8 0, i8* %30
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %34
%39 = call i32 (i8*, i8*, ...) @cli_fatal(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %35)
br label %40
40: ; preds = %38, %34
%41 = call %struct.buildopt* @cli_buildopt_new(i8* %19)
br label %42
42: ; preds = %23, %40
%43 = phi %struct.buildopt* [ %41, %40 ], [ null, %23 ]
%44 = call i8* @kore_read_line(i32* %5, i8* %4, i32 %2)
%45 = icmp eq i8* %44, null
br i1 %45, label %92, label %14
46: ; preds = %23
%47 = call i8* @strchr(i8* %19, i8 signext 61)
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %19)
br label %51
51: ; preds = %63, %73, %83, %90, %88, %78, %68, %49, %18
%52 = call i8* @kore_read_line(i32* %5, i8* %4, i32 %2)
%53 = icmp eq i8* %52, null
br i1 %53, label %92, label %18
54: ; preds = %46, %26
%55 = phi i8* [ %27, %26 ], [ %47, %46 ]
%56 = getelementptr inbounds i8, i8* %55, i64 1
store i8 0, i8* %55
%57 = call i64 @strlen(i8* %19)
%58 = call i8* @kore_text_trim(i8* %19, i64 %57)
%59 = call i64 @strlen(i8* %56)
%60 = call i8* @kore_text_trim(i8* %56, i64 %59)
%61 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %54
%64 = call i32 @cli_buildopt_cflags(%struct.buildopt* %16, i8* %60)
br label %51
65: ; preds = %54
%66 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 @cli_buildopt_cxxflags(%struct.buildopt* %16, i8* %60)
br label %51
70: ; preds = %65
%71 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 @cli_buildopt_ldflags(%struct.buildopt* %16, i8* %60)
br label %51
75: ; preds = %70
%76 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = call i32 @cli_buildopt_single_binary(%struct.buildopt* %16, i8* %60)
br label %51
80: ; preds = %75
%81 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = call i32 @cli_buildopt_kore_source(%struct.buildopt* %16, i8* %60)
br label %51
85: ; preds = %80
%86 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = call i32 @cli_buildopt_kore_flavor(%struct.buildopt* %16, i8* %60)
br label %51
90: ; preds = %85
%91 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.13, i64 0, i64 0), i8* %58)
br label %51
92: ; preds = %42, %51, %11
ret void
}