#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*/ unset_fmt;
typedef int /*<<< orphan*/ string_fmt;
typedef int /*<<< orphan*/ set_fmt;
typedef int /*<<< orphan*/ line;

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ isdigit(char);
scalar_t__ isspace(char);
int /*<<< orphan*/ print_bool(char *, int);
int /*<<< orphan*/ print_dec(char *, char *);
int /*<<< orphan*/ print_hex(char *, char *);
int /*<<< orphan*/ print_string(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int sscanf(char *, char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
unsigned int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  char unset_fmt[256], string_fmt[256], set_fmt[256], line[256];
  char *prefix = "CONFIG", *package = "KConfig";
  if (argc > 3) {
    fprintf(stderr, "Usage: %s [<package name> [<config prefix>]]\n\n",
            argv[0]);
    return 1;
  }
  if (argc > 2)
    prefix = argv[2];
  if (argc > 1)
    package = argv[1];
  snprintf(set_fmt, sizeof(set_fmt), "%s_%%255[^=]=%%255s", prefix);
  snprintf(string_fmt, sizeof(string_fmt), "%s_%%255[^=]=\"%%255[^\"]\"",
           prefix);
  snprintf(unset_fmt, sizeof(unset_fmt), "# %s_%%255s is not set", prefix);
  printf("package %s is\n\n", package);
  while (fgets(line, sizeof(line), stdin)) {
    char name[256], val[256];
    if (line[strlen(line) - 1] != '\n') {
      fprintf(stderr, "Line longer than %zu chars, skipping...\n",
              sizeof(line) - 1);
      while (fgets(line, sizeof(line), stdin)) {
        if (line[strlen(line) - 1] == '\n')
          break;
      }
      continue;
    }
    if (sscanf(line, unset_fmt, name) == 1) {
      print_bool(name, false);
      continue;
    }
    if (sscanf(line, string_fmt, name, val) == 2) {
      print_string(name, val);
      continue;
    }
    switch (sscanf(line, set_fmt, name, val)) {
    case 1:
      continue;
    case 2:
      if (strcmp(val, "\"\"") == 0) {
        print_string(name, "");
      } else if (strcmp(val, "y") == 0) {
        print_bool(name, true);
      } else if (strncmp(val, "0x", 2) == 0) {
        print_hex(name, val + 2);
      } else if (isdigit(val[0])) {
        print_dec(name, val);
      } else {
        fprintf(stderr, "couldn't parse value '%s' for '%s'\n", val, name);
      }
      continue;
    default:
      break;
    }
    unsigned int i = 0;
    while (isspace(line[i]))
      ++i;
    if (line[i] == '#') {
      printf("   --%s", line + i + 1);
      continue;
    } else if (i == strlen(line)) {
      continue;
    }
    fprintf(stderr, "spurious line:\n%s", line);
  }
  printf("\nend %s;\n", package);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x630,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe00(%rip),%rax
mov    %rax,-0x418(%rbp)
lea    0xdf9(%rip),%rax
mov    %rax,-0x420(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    1249 <main+0x69>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1664 <main+0x484>
cmpl   $0x2,-0x8(%rbp)
jle    1262 <main+0x82>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x418(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    127b <main+0x9b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x420(%rbp)
lea    -0x310(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    $0x100,%esi
lea    0xda9(%rip),%rdx
call   1080 <snprintf@plt>
lea    -0x210(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    $0x100,%esi
lea    0xd9e(%rip),%rdx
call   1080 <snprintf@plt>
lea    -0x110(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    $0x100,%esi
lea    0xd98(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0x420(%rbp),%rsi
lea    0xd9c(%rip),%rdi
call   1070 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2cef(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     164a <main+0x46a>
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
mov    %eax,%eax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     13a2 <main+0x1c2>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
lea    0xd51(%rip),%rsi
mov    $0xff,%edx
mov    $0x0,%al
call   10e0 <fprintf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2c8d(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     139d <main+0x1bd>
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
mov    %eax,%eax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1398 <main+0x1b8>
jmp    139d <main+0x1bd>
jmp    134d <main+0x16d>
jmp    12eb <main+0x10b>
lea    -0x410(%rbp),%rdi
lea    -0x110(%rbp),%rsi
lea    -0x520(%rbp),%rdx
mov    $0x0,%al
call   1100 <sscanf@plt>
cmp    $0x1,%eax
jne    13da <main+0x1fa>
lea    -0x520(%rbp),%rdi
xor    %esi,%esi
call   1090 <print_bool@plt>
jmp    12eb <main+0x10b>
lea    -0x410(%rbp),%rdi
lea    -0x210(%rbp),%rsi
lea    -0x520(%rbp),%rdx
lea    -0x620(%rbp),%rcx
mov    $0x0,%al
call   1100 <sscanf@plt>
cmp    $0x2,%eax
jne    141e <main+0x23e>
lea    -0x520(%rbp),%rdi
lea    -0x620(%rbp),%rsi
call   10a0 <print_string@plt>
jmp    12eb <main+0x10b>
xor    %eax,%eax
lea    -0x410(%rbp),%rdi
lea    -0x310(%rbp),%rsi
lea    -0x520(%rbp),%rdx
lea    -0x620(%rbp),%rcx
call   1100 <sscanf@plt>
mov    %eax,%ecx
mov    %ecx,-0x628(%rbp)
sub    $0x1,%eax
je     146b <main+0x28b>
jmp    1457 <main+0x277>
mov    -0x628(%rbp),%eax
sub    $0x2,%eax
je     1470 <main+0x290>
jmp    1579 <main+0x399>
jmp    12eb <main+0x10b>
lea    -0x620(%rbp),%rdi
lea    0xc3d(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    14a4 <main+0x2c4>
lea    -0x520(%rbp),%rdi
lea    0xba3(%rip),%rsi
call   10a0 <print_string@plt>
jmp    1574 <main+0x394>
lea    -0x620(%rbp),%rdi
lea    0xc0c(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    14d6 <main+0x2f6>
lea    -0x520(%rbp),%rdi
mov    $0x1,%esi
call   1090 <print_bool@plt>
jmp    156f <main+0x38f>
lea    -0x620(%rbp),%rdi
lea    0xbdc(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1513 <main+0x333>
lea    -0x520(%rbp),%rdi
lea    -0x620(%rbp),%rsi
add    $0x2,%rsi
call   10f0 <print_hex@plt>
jmp    156a <main+0x38a>
movsbl -0x620(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
je     1540 <main+0x360>
lea    -0x520(%rbp),%rdi
lea    -0x620(%rbp),%rsi
call   1050 <print_dec@plt>
jmp    1565 <main+0x385>
mov    0x2a91(%rip),%rax
mov    (%rax),%edi
lea    -0x620(%rbp),%rdx
lea    -0x520(%rbp),%rcx
lea    0xb65(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
jmp    156a <main+0x38a>
jmp    156f <main+0x38f>
jmp    1574 <main+0x394>
jmp    12eb <main+0x10b>
jmp    157e <main+0x39e>
movl   $0x0,-0x624(%rbp)
mov    -0x624(%rbp),%eax
movsbl -0x410(%rbp,%rax,1),%edi
ff
call   10b0 <isspace@plt>
cmp    $0x0,%rax
je     15b9 <main+0x3d9>
mov    -0x624(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x624(%rbp)
jmp    1588 <main+0x3a8>
mov    -0x624(%rbp),%eax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    15f5 <main+0x415>
lea    -0x410(%rbp),%rsi
mov    -0x624(%rbp),%eax
add    %rax,%rsi
add    $0x1,%rsi
lea    0xafc(%rip),%rdi
call   1070 <printf@plt>
jmp    12eb <main+0x10b>
mov    -0x624(%rbp),%eax
mov    %eax,-0x62c(%rbp)
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x62c(%rbp),%eax
cmp    %ecx,%eax
jne    1622 <main+0x442>
jmp    12eb <main+0x10b>
jmp    1627 <main+0x447>
mov    0x29aa(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rdx
lea    0xab1(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
jmp    12eb <main+0x10b>
mov    -0x420(%rbp),%rsi
lea    0xaa9(%rip),%rdi
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x630,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x618,%rsp
cmp    $0x4,%edi
jl     120a <main+0x3a>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe16(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%eax
jmp    1546 <main+0x376>
cmp    $0x3,%edi
jne    1215 <main+0x45>
mov    0x10(%rsi),%rbx
jmp    1221 <main+0x51>
lea    0xde4(%rip),%rbx
cmp    $0x2,%edi
jl     1227 <main+0x57>
mov    0x8(%rsi),%rbp
jmp    122e <main+0x5e>
lea    0xdd9(%rip),%rbp
lea    0xe09(%rip),%rdx
lea    0x310(%rsp),%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1080 <snprintf@plt>
lea    0xe01(%rip),%rdx
lea    0x210(%rsp),%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1080 <snprintf@plt>
lea    0xdfe(%rip),%rdx
lea    0x410(%rsp),%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1080 <snprintf@plt>
lea    0xdf9(%rip),%rdi
mov    %rbp,0x8(%rsp)
mov    %rbp,%rsi
call   1070 <printf@plt>
mov    0x2d4b(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0x110(%rsp),%rdi
mov    $0x100,%esi
call   10c0 <fgets@plt>
test   %rax,%rax
je     1533 <main+0x363>
lea    0x110(%rsp),%rbx
lea    0x410(%rsp),%r12
lea    0x510(%rsp),%r13
lea    0x210(%rsp),%r15
jmp    1309 <main+0x139>
mov    %r13,%rdi
mov    %r14,%rsi
call   10a0 <print_string@plt>
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10c0 <fgets@plt>
test   %rax,%rax
je     1533 <main+0x363>
mov    %rbx,%rdi
call   1060 <strlen@plt>
add    $0xffffffff,%eax
cmpb   $0xa,0x110(%rsp,%rax,1)
0a
jne    1340 <main+0x170>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10f0 <sscanf@plt>
cmp    $0x1,%eax
jne    13a0 <main+0x1d0>
mov    %r13,%rdi
xor    %esi,%esi
call   1090 <print_bool@plt>
jmp    12f0 <main+0x120>
nop
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
mov    $0xff,%edx
lea    0xd3d(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
nopl   0x0(%rax)
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10c0 <fgets@plt>
test   %rax,%rax
je     12f0 <main+0x120>
mov    %rbx,%rdi
call   1060 <strlen@plt>
add    $0xffffffff,%eax
cmpb   $0xa,0x110(%rsp,%rax,1)
0a
jne    1360 <main+0x190>
jmp    12f0 <main+0x120>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rcx
xor    %eax,%eax
call   10f0 <sscanf@plt>
cmp    $0x2,%eax
je     12dd <main+0x10d>
mov    %rbx,%rdi
lea    0x310(%rsp),%rsi
mov    %r13,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   10f0 <sscanf@plt>
cmp    $0x1,%eax
je     12f0 <main+0x120>
cmp    $0x2,%eax
jne    141e <main+0x24e>
mov    0x10(%rsp),%eax
mov    $0x2222,%ecx
xor    %ecx,%eax
movzbl 0x12(%rsp),%ecx
or     %ax,%cx
lea    0x10(%rsp),%rdi
je     14b4 <main+0x2e4>
cmpw   $0x79,0x10(%rsp)
jne    14c8 <main+0x2f8>
mov    %r13,%rdi
mov    $0x1,%esi
jmp    1338 <main+0x168>
mov    $0xffffffff,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14d
movsbl 0x110(%rsp,%r14,1),%edi
call   10b0 <isspace@plt>
test   %rax,%rax
jne    1430 <main+0x260>
mov    %r14d,%eax
cmpb   $0x23,0x110(%rsp,%rax,1)
23
jne    147c <main+0x2ac>
lea    (%rsp,%rax,1),%rsi
add    $0x110,%rsi
add    $0x1,%rsi
lea    0xc7b(%rip),%rdi
call   1070 <printf@plt>
lea    0x210(%rsp),%r15
jmp    12f0 <main+0x120>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    %r14d,%eax
lea    0x210(%rsp),%r15
je     12f0 <main+0x120>
mov    0x2b3c(%rip),%rax
mov    (%rax),%edi
lea    0xc48(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    12f0 <main+0x120>
mov    %r13,%rdi
lea    0xb7f(%rip),%rsi
call   10a0 <print_string@plt>
jmp    12f0 <main+0x120>
lea    0xbef(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     14fd <main+0x32d>
movsbl 0x10(%rsp),%edi
call   1040 <isdigit@plt>
test   %eax,%eax
je     150f <main+0x33f>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
call   1050 <print_dec@plt>
jmp    12f0 <main+0x120>
mov    %r13,%rdi
lea    0x12(%rsp),%rsi
call   10e0 <print_hex@plt>
jmp    12f0 <main+0x120>
mov    0x2ac2(%rip),%rax
mov    (%rax),%edi
lea    0xba2(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    12f0 <main+0x120>
lea    0xbc5(%rip),%rdi
mov    0x8(%rsp),%rsi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x618,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"CONFIG\00"
@.str.1 = [8 x i8] c"KConfig\00"
@stderr = global i32 0
@.str.2 = [47 x i8] c"Usage: %s [<package name> [<config prefix>]]\0A\0A\00"
@.str.3 = [20 x i8] c"%s_%%255[^=]=%%255s\00"
@.str.4 = [25 x i8] c"%s_%%255[^=]=\22%%255[^\22]\22\00"
@.str.5 = [23 x i8] c"# %s_%%255s is not set\00"
@.str.6 = [16 x i8] c"package %s is\0A\0A\00"
@stdin = global i32 0
@.str.7 = [41 x i8] c"Line longer than %zu chars, skipping...\0A\00"
@.str.8 = [3 x i8] c"\22\22\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [2 x i8] c"y\00"
@.str.11 = [3 x i8] c"0x\00"
@.str.12 = [36 x i8] c"couldn't parse value '%s' for '%s'\0A\00"
@.str.13 = [8 x i8] c" --%s\00"
@.str.14 = [18 x i8] c"spurious line:\0A%s\00"
@.str.15 = [10 x i8] c"\0Aend %s;\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = alloca [256 x i8]
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [256 x i8]
%13 = alloca [256 x i8]
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %11
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 3
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %21)
store i32 1, i32* %3
br label %191
23: ; preds = %2
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 2
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
store i8* %29, i8** %10
br label %30
30: ; preds = %26, %23
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 1
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
store i8* %36, i8** %11
br label %37
37: ; preds = %33, %30
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%39 = load i8*, i8** %10
%40 = call i32 @snprintf(i8* %38, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %39)
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%42 = load i8*, i8** %10
%43 = call i32 @snprintf(i8* %41, i32 256, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%45 = load i8*, i8** %10
%46 = call i32 @snprintf(i8* %44, i32 256, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %45)
%47 = load i8*, i8** %11
%48 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %184, %182, %170, %150, %109, %99, %89, %82, %37
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%51 = load i32, i32* @stdin
%52 = call i64 @fgets(i8* %50, i32 256, i32 %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %188
54: ; preds = %49
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%56 = call i32 @strlen(i8* %55)
%57 = sub i32 %56, 1
%58 = zext i32 %57 to i64
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 10
br i1 %62, label %63, label %83
63: ; preds = %54
%64 = load i32, i32* @stderr
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i64 255)
br label %66
66: ; preds = %81, %63
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%68 = load i32, i32* @stdin
%69 = call i64 @fgets(i8* %67, i32 256, i32 %68)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %82
71: ; preds = %66
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%73 = call i32 @strlen(i8* %72)
%74 = sub i32 %73, 1
%75 = zext i32 %74 to i64
%76 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %75
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 10
br i1 %79, label %80, label %81
80: ; preds = %71
br label %82
81: ; preds = %71
br label %66
82: ; preds = %80, %66
br label %49
83: ; preds = %54
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%86 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%87 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %84, i8* %85, i8* %86)
%88 = icmp eq i32 %87, 1
br i1 %88, label %89, label %92
89: ; preds = %83
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%91 = call i32 @print_bool(i8* %90, i32 0)
br label %49
92: ; preds = %83
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%94 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%96 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%97 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %93, i8* %94, i8* %95, i8* %96)
%98 = icmp eq i32 %97, 2
br i1 %98, label %99, label %103
99: ; preds = %92
%100 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%101 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%102 = call i32 @print_string(i8* %100, i8* %101)
br label %49
103: ; preds = %92
%104 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%105 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%106 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%107 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%108 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %104, i8* %105, i8* %106, i8* %107)
switch i32 %108, label %151 [
i32 1, label %109
i32 2, label %110
]
109: ; preds = %103
br label %49
110: ; preds = %103
%111 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%112 = call i32 @strcmp(i8* %111, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %117
114: ; preds = %110
%115 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%116 = call i32 @print_string(i8* %115, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
br label %150
117: ; preds = %110
%118 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%119 = call i32 @strcmp(i8* %118, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %124
121: ; preds = %117
%122 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%123 = call i32 @print_bool(i8* %122, i32 1)
br label %149
124: ; preds = %117
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%126 = call i32 @strncmp(i8* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 2)
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %133
128: ; preds = %124
%129 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%130 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%131 = getelementptr inbounds i8, i8* %130, i64 2
%132 = call i32 @print_hex(i8* %129, i8* %131)
br label %148
133: ; preds = %124
%134 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%135 = load i8, i8* %134
%136 = call i32 @isdigit(i8 signext %135)
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %142
138: ; preds = %133
%139 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%140 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%141 = call i32 @print_dec(i8* %139, i8* %140)
br label %147
142: ; preds = %133
%143 = load i32, i32* @stderr
%144 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%145 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%146 = call i32 (i32, i8*, ...) @fprintf(i32 %143, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0), i8* %144, i8* %145)
br label %147
147: ; preds = %142, %138
br label %148
148: ; preds = %147, %128
br label %149
149: ; preds = %148, %121
br label %150
150: ; preds = %149, %114
br label %49
151: ; preds = %103
br label %152
152: ; preds = %151
store i32 0, i32* %14
br label %153
153: ; preds = %160, %152
%154 = load i32, i32* %14
%155 = zext i32 %154 to i64
%156 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %155
%157 = load i8, i8* %156
%158 = call i64 @isspace(i8 signext %157)
%159 = icmp ne i64 %158, 0
br i1 %159, label %160, label %163
160: ; preds = %153
%161 = load i32, i32* %14
%162 = add i32 %161, 1
store i32 %162, i32* %14
br label %153
163: ; preds = %153
%164 = load i32, i32* %14
%165 = zext i32 %164 to i64
%166 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %165
%167 = load i8, i8* %166
%168 = sext i8 %167 to i32
%169 = icmp eq i32 %168, 35
br i1 %169, label %170, label %177
170: ; preds = %163
%171 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%172 = load i32, i32* %14
%173 = zext i32 %172 to i64
%174 = getelementptr inbounds i8, i8* %171, i64 %173
%175 = getelementptr inbounds i8, i8* %174, i64 1
%176 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8* %175)
br label %49
177: ; preds = %163
%178 = load i32, i32* %14
%179 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%180 = call i32 @strlen(i8* %179)
%181 = icmp eq i32 %178, %180
br i1 %181, label %182, label %183
182: ; preds = %177
br label %49
183: ; preds = %177
br label %184
184: ; preds = %183
%185 = load i32, i32* @stderr
%186 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%187 = call i32 (i32, i8*, ...) @fprintf(i32 %185, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i8* %186)
br label %49
188: ; preds = %49
%189 = load i8*, i8** %11
%190 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8* %189)
store i32 0, i32* %3
br label %191
191: ; preds = %188, %17
%192 = load i32, i32* %3
ret i32 %192
}

LLVM IR (-O2):
@.str = [7 x i8] c"CONFIG\00"
@.str.1 = [8 x i8] c"KConfig\00"
@stderr = global i32 0
@.str.2 = [47 x i8] c"Usage: %s [<package name> [<config prefix>]]\0A\0A\00"
@.str.3 = [20 x i8] c"%s_%%255[^=]=%%255s\00"
@.str.4 = [25 x i8] c"%s_%%255[^=]=\22%%255[^\22]\22\00"
@.str.5 = [23 x i8] c"# %s_%%255s is not set\00"
@.str.6 = [16 x i8] c"package %s is\0A\0A\00"
@stdin = global i32 0
@.str.7 = [41 x i8] c"Line longer than %zu chars, skipping...\0A\00"
@.str.8 = [3 x i8] c"\22\22\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.11 = [3 x i8] c"0x\00"
@.str.12 = [36 x i8] c"couldn't parse value '%s' for '%s'\0A\00"
@.str.13 = [8 x i8] c" --%s\00"
@.str.14 = [18 x i8] c"spurious line:\0A%s\00"
@.str.15 = [10 x i8] c"\0Aend %s;\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = icmp sgt i32 %0, 3
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %129
18: ; preds = %2
%19 = icmp eq i32 %0, 3
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
br label %25
23: ; preds = %18
%24 = icmp sgt i32 %0, 1
br i1 %24, label %25, label %29
25: ; preds = %20, %23
%26 = phi i8* [ %22, %20 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %23 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = load i8*, i8** %27
br label %29
29: ; preds = %25, %23
%30 = phi i8* [ %26, %25 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %23 ]
%31 = phi i8* [ %28, %25 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %23 ]
%32 = call i32 @snprintf(i8* %11, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%33 = call i32 @snprintf(i8* %10, i32 256, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %30)
%34 = call i32 @snprintf(i8* %9, i32 256, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %30)
%35 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%36 = load i32, i32* @stdin
%37 = call i64 @fgets(i8* %12, i32 256, i32 %36)
%38 = icmp eq i64 %37, 0
br i1 %38, label %127, label %39
39: ; preds = %29
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%42 = bitcast [256 x i8]* %8 to i16*
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 2
br label %44
44: ; preds = %39, %123
%45 = call i32 @strlen(i8* %12)
%46 = add i32 %45, -1
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = icmp eq i8 %49, 10
br i1 %50, label %65, label %51
51: ; preds = %44
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i64 255)
br label %54
54: ; preds = %58, %51
%55 = load i32, i32* @stdin
%56 = call i64 @fgets(i8* %12, i32 256, i32 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %123, label %58
58: ; preds = %54
%59 = call i32 @strlen(i8* %12)
%60 = add i32 %59, -1
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = icmp eq i8 %63, 10
br i1 %64, label %123, label %54
65: ; preds = %44
%66 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* %9, i8* %40)
%67 = icmp eq i32 %66, 1
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 @print_bool(i8* %40, i32 0)
br label %123
70: ; preds = %65
%71 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* %10, i8* %40, i8* %41)
%72 = icmp eq i32 %71, 2
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 @print_string(i8* %40, i8* %41)
br label %123
75: ; preds = %70
%76 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* %11, i8* %40, i8* %41)
switch i32 %76, label %101 [
i32 1, label %123
i32 2, label %77
]
77: ; preds = %75
%78 = call i32 @bcmp(i8* dereferenceable(3) %41, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i64 3)
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %77
%81 = call i32 @print_string(i8* %40, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
br label %123
82: ; preds = %77
%83 = load i16, i16* %42
%84 = icmp eq i16 %83, 121
br i1 %84, label %85, label %87
85: ; preds = %82
%86 = call i32 @print_bool(i8* %40, i32 1)
br label %123
87: ; preds = %82
%88 = call i32 @strncmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 2)
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %87
%91 = call i32 @print_hex(i8* %40, i8* %43)
br label %123
92: ; preds = %87
%93 = load i8, i8* %41
%94 = call i32 @isdigit(i8 signext %93)
%95 = icmp eq i32 %94, 0
br i1 %95, label %98, label %96
96: ; preds = %92
%97 = call i32 @print_dec(i8* %40, i8* %41)
br label %123
98: ; preds = %92
%99 = load i32, i32* @stderr
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0), i8* %41, i8* %40)
br label %123
101: ; preds = %75, %101
%102 = phi i32 [ %108, %101 ], [ 0, %75 ]
%103 = zext i32 %102 to i64
%104 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %103
%105 = load i8, i8* %104
%106 = call i64 @isspace(i8 signext %105)
%107 = icmp eq i64 %106, 0
%108 = add i32 %102, 1
br i1 %107, label %109, label %101
109: ; preds = %101
%110 = zext i32 %102 to i64
%111 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %110
%112 = load i8, i8* %111
%113 = icmp eq i8 %112, 35
br i1 %113, label %114, label %117
114: ; preds = %109
%115 = getelementptr inbounds i8, i8* %111, i64 1
%116 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8* %115)
br label %123
117: ; preds = %109
%118 = call i32 @strlen(i8* %12)
%119 = icmp eq i32 %102, %118
br i1 %119, label %123, label %120
120: ; preds = %117
%121 = load i32, i32* @stderr
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i8* %12)
br label %123
123: ; preds = %54, %58, %114, %120, %117, %80, %90, %98, %96, %85, %75, %73, %68
%124 = load i32, i32* @stdin
%125 = call i64 @fgets(i8* %12, i32 256, i32 %124)
%126 = icmp eq i64 %125, 0
br i1 %126, label %127, label %44
127: ; preds = %123, %29
%128 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8* %31)
br label %129
129: ; preds = %127, %14
%130 = phi i32 [ 1, %14 ], [ 0, %127 ]
ret i32 %130
}