#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 const *);
int /*<<< orphan*/ cli_buildopt_kore_source(struct buildopt *, char const *);
int /*<<< orphan*/ cli_buildopt_ldflags(struct buildopt *, char *);
int /*<<< orphan*/ cli_buildopt_mime(struct buildopt *, char *);
struct buildopt *cli_buildopt_new(char *);
int /*<<< orphan*/ cli_buildopt_single_binary(struct buildopt *, char *);
char *cli_read_line(int /*<<< orphan*/ *, char *, int);
char *cli_text_trim(char *, scalar_t__);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fatal(char *, char const *, ...);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
char *getenv(char *);
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;
  const char *env;
  struct buildopt *bopt;
  char buf[BUFSIZ], *p, *t;
  if ((fp = fopen(path, "r")) == NULL)
    fatal("cli_buildopt_parse: fopen(%s): %s", path, strerror(errno));
  bopt = NULL;
  while ((p = cli_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)
        fatal("unexpected '%s'", p);
      *(t)++ = '\0';
      if (strcmp(t, "{"))
        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 = cli_text_trim(p, strlen(p));
    t = cli_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 if (!strcasecmp(p, "mime_add")) {
      cli_buildopt_mime(bopt, t);
    } else {
      printf("ignoring unknown option '%s'\n", p);
    }
  }
  fclose(fp);
  if ((env = getenv("KORE_SOURCE")) != NULL)
    cli_buildopt_kore_source(NULL, env);
  if ((env = getenv("KORE_FLAVOR")) != NULL)
    cli_buildopt_kore_flavor(NULL, env);
}


x86 assembly (clang, -O0):
<cli_buildopt_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x50(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    12c4 <cli_buildopt_parse+0x84>
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2d2f(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1160 <fatal@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
call   1140 <cli_read_line@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     15cb <cli_buildopt_parse+0x38b>
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%rax
jne    1305 <cli_buildopt_parse+0xc5>
jmp    12cc <cli_buildopt_parse+0x8c>
cmpq   $0x0,-0x20(%rbp)
je     1337 <cli_buildopt_parse+0xf7>
mov    -0x38(%rbp),%rdi
lea    0xd07(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%rax
jne    1337 <cli_buildopt_parse+0xf7>
movq   $0x0,-0x20(%rbp)
jmp    12cc <cli_buildopt_parse+0x8c>
cmpq   $0x0,-0x20(%rbp)
jne    13e1 <cli_buildopt_parse+0x1a1>
mov    -0x38(%rbp),%rdi
mov    $0x3d,%esi
call   1080 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     1363 <cli_buildopt_parse+0x123>
jmp    1417 <cli_buildopt_parse+0x1d7>
mov    -0x38(%rbp),%rdi
mov    $0x20,%esi
call   1080 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1391 <cli_buildopt_parse+0x151>
mov    -0x38(%rbp),%rsi
lea    0xc9a(%rip),%rdi
mov    $0x0,%al
call   1160 <fatal@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x0,(%rax)
mov    -0x40(%rbp),%rdi
lea    0xc86(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%rax
je     13cf <cli_buildopt_parse+0x18f>
mov    -0x40(%rbp),%rsi
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1160 <fatal@plt>
mov    -0x38(%rbp),%rdi
call   10e0 <cli_buildopt_new@plt>
mov    %rax,-0x20(%rbp)
jmp    12cc <cli_buildopt_parse+0x8c>
mov    -0x38(%rbp),%rdi
mov    $0x3d,%esi
call   1080 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1412 <cli_buildopt_parse+0x1d2>
mov    -0x38(%rbp),%rsi
lea    0xc45(%rip),%rdi
call   1090 <printf@plt>
jmp    12cc <cli_buildopt_parse+0x8c>
jmp    1417 <cli_buildopt_parse+0x1d7>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    %rax,%rsi
call   10c0 <cli_text_trim@plt>
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    %rax,%rsi
call   10c0 <cli_text_trim@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xbf0(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1496 <cli_buildopt_parse+0x256>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10a0 <cli_buildopt_cflags@plt>
jmp    15c6 <cli_buildopt_parse+0x386>
mov    -0x38(%rbp),%rdi
lea    0xbcc(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14c1 <cli_buildopt_parse+0x281>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1060 <cli_buildopt_cxxflags@plt>
jmp    15c1 <cli_buildopt_parse+0x381>
mov    -0x38(%rbp),%rdi
lea    0xbaa(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14ec <cli_buildopt_parse+0x2ac>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10d0 <cli_buildopt_ldflags@plt>
jmp    15bc <cli_buildopt_parse+0x37c>
mov    -0x38(%rbp),%rdi
lea    0xb87(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1517 <cli_buildopt_parse+0x2d7>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10f0 <cli_buildopt_single_binary@plt>
jmp    15b7 <cli_buildopt_parse+0x377>
mov    -0x38(%rbp),%rdi
lea    0xb6a(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1542 <cli_buildopt_parse+0x302>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1110 <cli_buildopt_kore_source@plt>
jmp    15b2 <cli_buildopt_parse+0x372>
mov    -0x38(%rbp),%rdi
lea    0xb4b(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    156d <cli_buildopt_parse+0x32d>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10b0 <cli_buildopt_kore_flavor@plt>
jmp    15ad <cli_buildopt_parse+0x36d>
mov    -0x38(%rbp),%rdi
lea    0xb2c(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1598 <cli_buildopt_parse+0x358>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1130 <cli_buildopt_mime@plt>
jmp    15a8 <cli_buildopt_parse+0x368>
mov    -0x38(%rbp),%rsi
lea    0xb0a(%rip),%rdi
call   1090 <printf@plt>
jmp    15ad <cli_buildopt_parse+0x36d>
jmp    15b2 <cli_buildopt_parse+0x372>
jmp    15b7 <cli_buildopt_parse+0x377>
jmp    15bc <cli_buildopt_parse+0x37c>
jmp    15c1 <cli_buildopt_parse+0x381>
jmp    15c6 <cli_buildopt_parse+0x386>
jmp    12cc <cli_buildopt_parse+0x8c>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xaf0(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     15fb <cli_buildopt_parse+0x3bb>
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1110 <cli_buildopt_kore_source@plt>
lea    0xad5(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1622 <cli_buildopt_parse+0x3e2>
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <cli_buildopt_kore_flavor@plt>
mov    -0x28(%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    0x2d85(%rip),%rax
mov    (%rax),%ebx
mov    %rsp,%r14
mov    %rbx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0xe2a(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    12a6 <cli_buildopt_parse+0x66>
mov    0x2d4c(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xd66(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1160 <fatal@plt>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1140 <cli_read_line@plt>
test   %rax,%rax
mov    %r13,%r15
je     1523 <cli_buildopt_parse+0x2e3>
mov    %rax,%r12
xor    %r13d,%r13d
mov    %r14,-0x30(%rbp)
mov    %r15,-0x38(%rbp)
jmp    12fb <cli_buildopt_parse+0xbb>
lea    0xd77(%rip),%rdi
mov    %r12,%rsi
call   1090 <printf@plt>
mov    -0x38(%rbp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1140 <cli_read_line@plt>
mov    %rax,%r12
test   %rax,%rax
je     1523 <cli_buildopt_parse+0x2e3>
cmpb   $0x0,(%r12)
je     12e2 <cli_buildopt_parse+0xa2>
mov    %r12,%rdi
test   %r13,%r13
je     1340 <cli_buildopt_parse+0x100>
lea    0xd11(%rip),%rsi
call   1100 <strcmp@plt>
test   %rax,%rax
je     149b <cli_buildopt_parse+0x25b>
mov    %r12,%rdi
mov    $0x3d,%esi
call   1080 <strchr@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1356 <cli_buildopt_parse+0x116>
jmp    12cf <cli_buildopt_parse+0x8f>
cs nopw 0x0(%rax,%rax,1)
mov    $0x3d,%esi
call   1080 <strchr@plt>
mov    %rax,%r15
test   %rax,%rax
je     14b0 <cli_buildopt_parse+0x270>
mov    %rbx,%r14
movb   $0x0,(%r15)
add    $0x1,%r15
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   10c0 <cli_text_trim@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   10c0 <cli_text_trim@plt>
mov    %rax,%r12
mov    %rbx,%rdi
lea    0xccf(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     143a <cli_buildopt_parse+0x1fa>
mov    %rbx,%rdi
lea    0xcbf(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     1447 <cli_buildopt_parse+0x207>
mov    %rbx,%rdi
lea    0xcb1(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
mov    -0x38(%rbp),%r15
je     145e <cli_buildopt_parse+0x21e>
mov    %rbx,%rdi
lea    0xc9e(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     146e <cli_buildopt_parse+0x22e>
mov    %rbx,%rdi
lea    0xc95(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     147e <cli_buildopt_parse+0x23e>
mov    %rbx,%rdi
lea    0xc8e(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     148e <cli_buildopt_parse+0x24e>
mov    %rbx,%rdi
lea    0xc87(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     14a3 <cli_buildopt_parse+0x263>
lea    0xc80(%rip),%rdi
mov    %rbx,%rsi
call   1090 <printf@plt>
jmp    1517 <cli_buildopt_parse+0x2d7>
mov    %r13,%rdi
mov    %r12,%rsi
call   10a0 <cli_buildopt_cflags@plt>
jmp    1452 <cli_buildopt_parse+0x212>
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <cli_buildopt_cxxflags@plt>
mov    %r14,%rbx
mov    -0x30(%rbp),%r14
jmp    12de <cli_buildopt_parse+0x9e>
mov    %r13,%rdi
mov    %r12,%rsi
call   10d0 <cli_buildopt_ldflags@plt>
jmp    1517 <cli_buildopt_parse+0x2d7>
mov    %r13,%rdi
mov    %r12,%rsi
call   10f0 <cli_buildopt_single_binary@plt>
jmp    1517 <cli_buildopt_parse+0x2d7>
mov    %r13,%rdi
mov    %r12,%rsi
call   1110 <cli_buildopt_kore_source@plt>
jmp    1517 <cli_buildopt_parse+0x2d7>
mov    %r13,%rdi
mov    %r12,%rsi
call   10b0 <cli_buildopt_kore_flavor@plt>
jmp    1517 <cli_buildopt_parse+0x2d7>
xor    %r13d,%r13d
jmp    12e2 <cli_buildopt_parse+0xa2>
mov    %r13,%rdi
mov    %r12,%rsi
call   1130 <cli_buildopt_mime@plt>
jmp    1517 <cli_buildopt_parse+0x2d7>
mov    %rbx,%r14
mov    %r12,%rdi
mov    $0x20,%esi
call   1080 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    14d9 <cli_buildopt_parse+0x299>
lea    0xb55(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1160 <fatal@plt>
mov    %rbx,%rax
add    $0x1,%rbx
movb   $0x0,(%rax)
mov    %rbx,%rdi
lea    0xb47(%rip),%rsi
call   1100 <strcmp@plt>
test   %rax,%rax
mov    -0x38(%rbp),%r15
je     150c <cli_buildopt_parse+0x2cc>
lea    0xb34(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1160 <fatal@plt>
mov    %r12,%rdi
call   10e0 <cli_buildopt_new@plt>
mov    %rax,%r13
mov    %r14,%rbx
mov    -0x30(%rbp),%r14
jmp    12e2 <cli_buildopt_parse+0xa2>
mov    %r15,%rdi
call   1050 <fclose@plt>
lea    0xb99(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1546 <cli_buildopt_parse+0x306>
xor    %edi,%edi
mov    %rax,%rsi
call   1110 <cli_buildopt_kore_source@plt>
lea    0xb8a(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1561 <cli_buildopt_parse+0x321>
xor    %edi,%edi
mov    %rax,%rsi
call   10b0 <cli_buildopt_kore_flavor@plt>
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 = [9 x i8] c"mime_add\00"
@.str.14 = [30 x i8] c"ignoring unknown option '%s'\0A\00"
@.str.15 = [12 x i8] c"KORE_SOURCE\00"
@.str.16 = [12 x i8] c"KORE_FLAVOR\00"
define void @cli_buildopt_parse(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca %struct.buildopt*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %2
%10 = load i32, i32* @BUFSIZ
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %6
%13 = alloca i8, i64 %11
store i64 %11, i64* %7
%14 = load i8*, i8** %2
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %3
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %22
17: ; preds = %1
%18 = load i8*, i8** %2
%19 = load i32, i32* @errno
%20 = call i32 @strerror(i32 %19)
%21 = call i32 (i8*, i8*, ...) @fatal(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %18, i32 %20)
br label %22
22: ; preds = %17, %1
store %struct.buildopt* null, %struct.buildopt** %5
br label %23
23: ; preds = %151, %72, %65, %40, %32, %22
%24 = load i32*, i32** %3
%25 = trunc i64 %11 to i32
%26 = call i8* @cli_read_line(i32* %24, i8* %13, i32 %25)
store i8* %26, i8** %8
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %152
28: ; preds = %23
%29 = load i8*, i8** %8
%30 = call i64 @strlen(i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
br label %23
33: ; preds = %28
%34 = load %struct.buildopt*, %struct.buildopt** %5
%35 = icmp ne %struct.buildopt* %34, null
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i8*, i8** %8
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%39 = icmp ne i64 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %36
store %struct.buildopt* null, %struct.buildopt** %5
br label %23
41: ; preds = %36, %33
%42 = load %struct.buildopt*, %struct.buildopt** %5
%43 = icmp eq %struct.buildopt* %42, null
br i1 %43, label %44, label %68
44: ; preds = %41
%45 = load i8*, i8** %8
%46 = call i8* @strchr(i8* %45, i8 signext 61)
store i8* %46, i8** %9
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %49
48: ; preds = %44
br label %76
49: ; preds = %44
%50 = load i8*, i8** %8
%51 = call i8* @strchr(i8* %50, i8 signext 32)
store i8* %51, i8** %9
%52 = icmp eq i8* %51, null
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = load i8*, i8** %8
%55 = call i32 (i8*, i8*, ...) @fatal(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %53, %49
%57 = load i8*, i8** %9
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %9
store i8 0, i8* %57
%59 = load i8*, i8** %9
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %56
%63 = load i8*, i8** %9
%64 = call i32 (i8*, i8*, ...) @fatal(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %63)
br label %65
65: ; preds = %62, %56
%66 = load i8*, i8** %8
%67 = call %struct.buildopt* @cli_buildopt_new(i8* %66)
store %struct.buildopt* %67, %struct.buildopt** %5
br label %23
68: ; preds = %41
%69 = load i8*, i8** %8
%70 = call i8* @strchr(i8* %69, i8 signext 61)
store i8* %70, i8** %9
%71 = icmp eq i8* %70, null
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = load i8*, i8** %8
%74 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %73)
br label %23
75: ; preds = %68
br label %76
76: ; preds = %75, %48
%77 = load i8*, i8** %9
%78 = getelementptr inbounds i8, i8* %77, i32 1
store i8* %78, i8** %9
store i8 0, i8* %77
%79 = load i8*, i8** %8
%80 = load i8*, i8** %8
%81 = call i64 @strlen(i8* %80)
%82 = call i8* @cli_text_trim(i8* %79, i64 %81)
store i8* %82, i8** %8
%83 = load i8*, i8** %9
%84 = load i8*, i8** %9
%85 = call i64 @strlen(i8* %84)
%86 = call i8* @cli_text_trim(i8* %83, i64 %85)
store i8* %86, i8** %9
%87 = load i8*, i8** %8
%88 = call i32 @strcasecmp(i8* %87, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%89 = icmp ne i32 %88, 0
br i1 %89, label %94, label %90
90: ; preds = %76
%91 = load %struct.buildopt*, %struct.buildopt** %5
%92 = load i8*, i8** %9
%93 = call i32 @cli_buildopt_cflags(%struct.buildopt* %91, i8* %92)
br label %151
94: ; preds = %76
%95 = load i8*, i8** %8
%96 = call i32 @strcasecmp(i8* %95, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%97 = icmp ne i32 %96, 0
br i1 %97, label %102, label %98
98: ; preds = %94
%99 = load %struct.buildopt*, %struct.buildopt** %5
%100 = load i8*, i8** %9
%101 = call i32 @cli_buildopt_cxxflags(%struct.buildopt* %99, i8* %100)
br label %150
102: ; preds = %94
%103 = load i8*, i8** %8
%104 = call i32 @strcasecmp(i8* %103, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%105 = icmp ne i32 %104, 0
br i1 %105, label %110, label %106
106: ; preds = %102
%107 = load %struct.buildopt*, %struct.buildopt** %5
%108 = load i8*, i8** %9
%109 = call i32 @cli_buildopt_ldflags(%struct.buildopt* %107, i8* %108)
br label %149
110: ; preds = %102
%111 = load i8*, i8** %8
%112 = call i32 @strcasecmp(i8* %111, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%113 = icmp ne i32 %112, 0
br i1 %113, label %118, label %114
114: ; preds = %110
%115 = load %struct.buildopt*, %struct.buildopt** %5
%116 = load i8*, i8** %9
%117 = call i32 @cli_buildopt_single_binary(%struct.buildopt* %115, i8* %116)
br label %148
118: ; preds = %110
%119 = load i8*, i8** %8
%120 = call i32 @strcasecmp(i8* %119, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%121 = icmp ne i32 %120, 0
br i1 %121, label %126, label %122
122: ; preds = %118
%123 = load %struct.buildopt*, %struct.buildopt** %5
%124 = load i8*, i8** %9
%125 = call i32 @cli_buildopt_kore_source(%struct.buildopt* %123, i8* %124)
br label %147
126: ; preds = %118
%127 = load i8*, i8** %8
%128 = call i32 @strcasecmp(i8* %127, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%129 = icmp ne i32 %128, 0
br i1 %129, label %134, label %130
130: ; preds = %126
%131 = load %struct.buildopt*, %struct.buildopt** %5
%132 = load i8*, i8** %9
%133 = call i32 @cli_buildopt_kore_flavor(%struct.buildopt* %131, i8* %132)
br label %146
134: ; preds = %126
%135 = load i8*, i8** %8
%136 = call i32 @strcasecmp(i8* %135, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%137 = icmp ne i32 %136, 0
br i1 %137, label %142, label %138
138: ; preds = %134
%139 = load %struct.buildopt*, %struct.buildopt** %5
%140 = load i8*, i8** %9
%141 = call i32 @cli_buildopt_mime(%struct.buildopt* %139, i8* %140)
br label %145
142: ; preds = %134
%143 = load i8*, i8** %8
%144 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), i8* %143)
br label %145
145: ; preds = %142, %138
br label %146
146: ; preds = %145, %130
br label %147
147: ; preds = %146, %122
br label %148
148: ; preds = %147, %114
br label %149
149: ; preds = %148, %106
br label %150
150: ; preds = %149, %98
br label %151
151: ; preds = %150, %90
br label %23
152: ; preds = %23
%153 = load i32*, i32** %3
%154 = call i32 @fclose(i32* %153)
%155 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
store i8* %155, i8** %4
%156 = icmp ne i8* %155, null
br i1 %156, label %157, label %160
157: ; preds = %152
%158 = load i8*, i8** %4
%159 = call i32 @cli_buildopt_kore_source(%struct.buildopt* null, i8* %158)
br label %160
160: ; preds = %157, %152
%161 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
store i8* %161, i8** %4
%162 = icmp ne i8* %161, null
br i1 %162, label %163, label %166
163: ; preds = %160
%164 = load i8*, i8** %4
%165 = call i32 @cli_buildopt_kore_flavor(%struct.buildopt* null, i8* %164)
br label %166
166: ; preds = %163, %160
%167 = load i8*, i8** %6
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 = [9 x i8] c"mime_add\00"
@.str.14 = [30 x i8] c"ignoring unknown option '%s'\0A\00"
@.str.15 = [12 x i8] c"KORE_SOURCE\00"
@.str.16 = [12 x i8] c"KORE_FLAVOR\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*, ...) @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* @cli_read_line(i32* %5, i8* %4, i32 %2)
%13 = icmp eq i8* %12, null
br i1 %13, label %97, 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*, ...) @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*, ...) @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* @cli_read_line(i32* %5, i8* %4, i32 %2)
%45 = icmp eq i8* %44, null
br i1 %45, label %97, 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, %93, %95, %88, %78, %68, %49, %18
%52 = call i8* @cli_read_line(i32* %5, i8* %4, i32 %2)
%53 = icmp eq i8* %52, null
br i1 %53, label %97, 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* @cli_text_trim(i8* %19, i64 %57)
%59 = call i64 @strlen(i8* %56)
%60 = call i8* @cli_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 @strcasecmp(i8* %58, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %90
%94 = call i32 @cli_buildopt_mime(%struct.buildopt* %16, i8* %60)
br label %51
95: ; preds = %90
%96 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), i8* %58)
br label %51
97: ; preds = %42, %51, %11
%98 = call i32 @fclose(i32* %5)
%99 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
%100 = icmp eq i8* %99, null
br i1 %100, label %103, label %101
101: ; preds = %97
%102 = call i32 @cli_buildopt_kore_source(%struct.buildopt* null, i8* %99)
br label %103
103: ; preds = %101, %97
%104 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
%105 = icmp eq i8* %104, null
br i1 %105, label %108, label %106
106: ; preds = %103
%107 = call i32 @cli_buildopt_kore_flavor(%struct.buildopt* null, i8* %104)
br label %108
108: ; preds = %106, %103
ret void
}