#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ clearDrivers(char **);
int /*<<< orphan*/ discardTag(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int nextEntity(char *, int /*<<< orphan*/ *);
scalar_t__ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
int parseOverview(const char *dbdir, FILE *out) {
  FILE *in;
  char printerid[256], manu[256], model[256], tag[256], driver[256];
  char *drivers[20] = {0};
  int index = 0;
  char cmd[1024] = {0};
  snprintf(cmd, 1024, "foomatic-combo-xml -O -l %s", dbdir);
  in = popen(cmd, "r");
  if (in == NULL)
    return 0;
  if (nextEntity(tag, in) == 1 && strcmp(tag, "overview") == 0) {
    printf("-1\n");
    while (nextEntity(tag, in) == 1) {
      if (strcmp(tag, "overview") == 0 || strcmp(tag, "printer") != 0)
        break;
      strcpy(printerid, "");
      strcpy(manu, "");
      strcpy(model, "");
      clearDrivers(drivers);
      while (nextEntity(tag, in) == 1) {
        if (strcmp(tag, "id") == 0)
          nextEntity(printerid, in);
        else if (strcmp(tag, "make") == 0)
          nextEntity(manu, in);
        else if (strcmp(tag, "model") == 0)
          nextEntity(model, in);
        else if (strcmp(tag, "drivers") == 0) {
          index = 0;
          while (nextEntity(tag, in) == 1 && strcmp(tag, "driver") == 0 &&
                 index < 20) {
            nextEntity(driver, in);
            drivers[index++] = strdup(driver);
            nextEntity(driver, in);
          }
          continue;
        } else if (strcmp(tag, "printer") == 0) {
          printf("%s %s\n", manu, model);
          index = 0;
          while (drivers[index]) {
            fprintf(out, "FILE=%s|%s\n", printerid, drivers[index]);
            fprintf(out, "MANUFACTURER=%s\n", manu);
            fprintf(out, "MODELNAME=%s\n", model);
            fprintf(out, "MODEL=%s\n", model);
            fprintf(out, "DESCRIPTION=%s %s (%s)\n", manu, model,
                    drivers[index]);
            fprintf(out, "\n");
            index++;
          }
          break;
        } else {
          discardTag(tag, in);
          continue;
        }
        nextEntity(tag, in);
      }
    }
  }
  if (pclose(in) == 0)
    index = 1;
  else
    index = 0;
  return index;
}


x86 assembly (clang, -O0):
<parseOverview>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9e0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x5c0(%rbp),%rdi
xor    %esi,%esi
mov    $0xa0,%edx
call   1070 <memset@plt>
movl   $0x0,-0x5c4(%rbp)
lea    -0x9d0(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x9d0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xde6(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0x9d0(%rbp),%rdi
lea    0xe02(%rip),%rsi
call   10d0 <popen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    124d <parseOverview+0x8d>
movl   $0x0,-0x4(%rbp)
jmp    165f <parseOverview+0x49f>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
cmp    $0x1,%eax
jne    162a <parseOverview+0x46a>
lea    -0x420(%rbp),%rdi
lea    0xda8(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    162a <parseOverview+0x46a>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
cmp    $0x1,%eax
jne    1625 <parseOverview+0x465>
lea    -0x420(%rbp),%rdi
lea    0xd64(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     12e4 <parseOverview+0x124>
lea    -0x420(%rbp),%rdi
lea    0xd54(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     12e9 <parseOverview+0x129>
jmp    1625 <parseOverview+0x465>
lea    -0x120(%rbp),%rdi
lea    0xdaa(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x220(%rbp),%rdi
lea    0xd97(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x320(%rbp),%rdi
lea    0xd84(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x5c0(%rbp),%rdi
call   1090 <clearDrivers@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
cmp    $0x1,%eax
jne    1620 <parseOverview+0x460>
lea    -0x420(%rbp),%rdi
lea    0xcdc(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1379 <parseOverview+0x1b9>
lea    -0x120(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
jmp    160b <parseOverview+0x44b>
lea    -0x420(%rbp),%rdi
lea    0xcad(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13ab <parseOverview+0x1eb>
lea    -0x220(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
jmp    1606 <parseOverview+0x446>
lea    -0x420(%rbp),%rdi
lea    0xc80(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13dd <parseOverview+0x21d>
lea    -0x320(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
jmp    1601 <parseOverview+0x441>
lea    -0x420(%rbp),%rdi
lea    0xc54(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    14c6 <parseOverview+0x306>
movl   $0x0,-0x5c4(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x9d1(%rbp)
jne    145f <parseOverview+0x29f>
lea    -0x420(%rbp),%rdi
lea    0xc12(%rip),%rsi
call   10a0 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9d1(%rbp)
jne    145f <parseOverview+0x29f>
cmpl   $0x14,-0x5c4(%rbp)
setl   %al
mov    %al,-0x9d1(%rbp)
mov    -0x9d1(%rbp),%al
test   $0x1,%al
jne    1472 <parseOverview+0x2b2>
jmp    14c1 <parseOverview+0x301>
lea    -0x520(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
lea    -0x520(%rbp),%rdi
call   10e0 <strdup@plt>
mov    %rax,%rcx
mov    -0x5c4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x5c4(%rbp)
cltq
mov    %rcx,-0x5c0(%rbp,%rax,8)
ff
lea    -0x520(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
jmp    1404 <parseOverview+0x244>
jmp    132e <parseOverview+0x16e>
lea    -0x420(%rbp),%rdi
lea    0xb55(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    15ec <parseOverview+0x42c>
lea    -0x220(%rbp),%rsi
lea    -0x320(%rbp),%rdx
lea    0xb56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x5c4(%rbp)
movslq -0x5c4(%rbp),%rax
cmpq   $0x0,-0x5c0(%rbp,%rax,8)
je     15e7 <parseOverview+0x427>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
movslq -0x5c4(%rbp),%rax
mov    -0x5c0(%rbp,%rax,8),%rcx
ff
lea    0xb15(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x220(%rbp),%rdx
lea    0xb08(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x320(%rbp),%rdx
lea    0xb00(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x320(%rbp),%rdx
lea    0xaf5(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x220(%rbp),%rdx
lea    -0x320(%rbp),%rcx
movslq -0x5c4(%rbp),%rax
mov    -0x5c0(%rbp,%rax,8),%r8
ff
lea    0xad0(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xad4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x5c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c4(%rbp)
jmp    1509 <parseOverview+0x349>
jmp    1620 <parseOverview+0x460>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <discardTag@plt>
jmp    132e <parseOverview+0x16e>
jmp    1606 <parseOverview+0x446>
jmp    160b <parseOverview+0x44b>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <nextEntity@plt>
jmp    132e <parseOverview+0x16e>
jmp    1291 <parseOverview+0xd1>
jmp    162a <parseOverview+0x46a>
mov    -0x20(%rbp),%rdi
call   1050 <pclose@plt>
cmp    $0x0,%rax
jne    164c <parseOverview+0x48c>
movl   $0x1,-0x5c4(%rbp)
jmp    1656 <parseOverview+0x496>
movl   $0x0,-0x5c4(%rbp)
mov    -0x5c4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x9e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseOverview>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9b8,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,%r15
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0x5b0(%rsp),%rbx
xor    %ebp,%ebp
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
lea    0xda9(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rcx
call   1070 <snprintf@plt>
lea    0xdbd(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <popen@plt>
test   %rax,%rax
je     15ac <parseOverview+0x3cc>
mov    %rax,%r14
lea    0xb0(%rsp),%rdi
mov    %rax,%rsi
call   10e0 <nextEntity@plt>
cmp    $0x1,%eax
jne    159b <parseOverview+0x3bb>
lea    0xd7a(%rip),%rsi
lea    0xb0(%rsp),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    159b <parseOverview+0x3bb>
lea    0xddf(%rip),%rdi
call   1040 <puts@plt>
lea    0xb0(%rsp),%rdi
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
cmp    $0x1,%eax
jne    159b <parseOverview+0x3bb>
lea    0xb0(%rsp),%r12
lea    0x3b0(%rsp),%r15
jmp    1304 <parseOverview+0x124>
nop
mov    %r12,%rdi
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
cmp    $0x1,%eax
jne    159b <parseOverview+0x3bb>
mov    %r12,%rdi
lea    0xd0e(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     159b <parseOverview+0x3bb>
mov    %r12,%rdi
lea    0xcff(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    159b <parseOverview+0x3bb>
mov    %r15,%rdi
lea    0xd5f(%rip),%rbp
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x2b0(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x1b0(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x10(%rsp),%rdi
call   10a0 <clearDrivers@plt>
jmp    1393 <parseOverview+0x1b3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
cmp    $0x1,%eax
jne    12f0 <parseOverview+0x110>
mov    %r12,%rdi
lea    0xc7c(%rip),%rsi
call   10c0 <strcmp@plt>
mov    %r15,%rdi
test   %rax,%rax
je     1380 <parseOverview+0x1a0>
mov    %r12,%rdi
lea    0xc68(%rip),%rsi
call   10c0 <strcmp@plt>
lea    0x2b0(%rsp),%rdi
test   %rax,%rax
je     1380 <parseOverview+0x1a0>
mov    %r12,%rdi
lea    0xc51(%rip),%rsi
call   10c0 <strcmp@plt>
lea    0x1b0(%rsp),%rdi
test   %rax,%rax
je     1380 <parseOverview+0x1a0>
mov    %r12,%rdi
lea    0xc3b(%rip),%rsi
call   10c0 <strcmp@plt>
mov    %r12,%rdi
test   %rax,%rax
je     1432 <parseOverview+0x252>
lea    0xc11(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     14b6 <parseOverview+0x2d6>
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <discardTag@plt>
jmp    1393 <parseOverview+0x1b3>
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
cmp    $0x1,%eax
jne    1393 <parseOverview+0x1b3>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
lea    0xbe9(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    1393 <parseOverview+0x1b3>
cmp    $0x13,%rbp
ja     1393 <parseOverview+0x1b3>
lea    0x4b0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
mov    %rbx,%rdi
call   1100 <strdup@plt>
mov    %rax,0x10(%rsp,%rbp,8)
add    $0x1,%rbp
mov    %rbx,%rdi
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   10e0 <nextEntity@plt>
cmp    $0x1,%eax
je     1450 <parseOverview+0x270>
jmp    1393 <parseOverview+0x1b3>
lea    0xb8d(%rip),%rdi
lea    0x2b0(%rsp),%rsi
lea    0x1b0(%rsp),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rcx
test   %rcx,%rcx
je     12f0 <parseOverview+0x110>
lea    0x18(%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
lea    0xb52(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %rbp,%rdi
lea    0xb4a(%rip),%rsi
lea    0x1b0(%rsp),%rbx
lea    0x2b0(%rsp),%r15
mov    %r15,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %rbp,%rdi
lea    0xb37(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %rbp,%rdi
lea    0xb31(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    -0x8(%r13),%r8
mov    %rbp,%rdi
lea    0xb23(%rip),%rsi
mov    %r15,%rdx
lea    0x3b0(%rsp),%r15
mov    %rbx,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0xa,%edi
mov    %rbp,%rsi
call   10b0 <fputc@plt>
mov    0x0(%r13),%rcx
add    $0x8,%r13
test   %rcx,%rcx
jne    14f0 <parseOverview+0x310>
jmp    12f0 <parseOverview+0x110>
mov    %r14,%rdi
call   1060 <pclose@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x9b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"foomatic-combo-xml -O -l %s\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"overview\00"
@.str.3 = [4 x i8] c"-1\0A\00"
@.str.4 = [8 x i8] c"printer\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [3 x i8] c"id\00"
@.str.7 = [5 x i8] c"make\00"
@.str.8 = [6 x i8] c"model\00"
@.str.9 = [8 x i8] c"drivers\00"
@.str.10 = [7 x i8] c"driver\00"
@.str.11 = [7 x i8] c"%s %s\0A\00"
@.str.12 = [12 x i8] c"FILE=%s|%s\0A\00"
@.str.13 = [17 x i8] c"MANUFACTURER=%s\0A\00"
@.str.14 = [14 x i8] c"MODELNAME=%s\0A\00"
@.str.15 = [10 x i8] c"MODEL=%s\0A\00"
@.str.16 = [24 x i8] c"DESCRIPTION=%s %s (%s)\0A\00"
@.str.17 = [2 x i8] c"\0A\00"
define i32 @parseOverview(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = alloca [256 x i8]
%10 = alloca [256 x i8]
%11 = alloca [256 x i8]
%12 = alloca [20 x i8*]
%13 = alloca i32
%14 = alloca [1024 x i8]
store i8* %0, i8** %4
store i32* %1, i32** %5
%15 = bitcast [20 x i8*]* %12 to i8*
store i32 0, i32* %13
%16 = bitcast [1024 x i8]* %14 to i8*
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%18 = load i8*, i8** %4
%19 = call i32 @snprintf(i8* %17, i32 1024, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%21 = call i32* @popen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %6
%22 = load i32*, i32** %6
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %25
24: ; preds = %2
store i32 0, i32* %3
br label %185
25: ; preds = %2
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%27 = load i32*, i32** %6
%28 = call i32 @nextEntity(i8* %26, i32* %27)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %177
30: ; preds = %25
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %177
34: ; preds = %30
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %175, %34
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%38 = load i32*, i32** %6
%39 = call i32 @nextEntity(i8* %37, i32* %38)
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %176
41: ; preds = %36
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %41
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %45, %41
br label %176
50: ; preds = %45
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%52 = call i32 @strcpy(i8* %51, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%54 = call i32 @strcpy(i8* %53, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%56 = call i32 @strcpy(i8* %55, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%57 = getelementptr inbounds [20 x i8*], [20 x i8*]* %12, i64 0, i64 0
%58 = call i32 @clearDrivers(i8** %57)
br label %59
59: ; preds = %171, %165, %120, %50
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%61 = load i32*, i32** %6
%62 = call i32 @nextEntity(i8* %60, i32* %61)
%63 = icmp eq i32 %62, 1
br i1 %63, label %64, label %175
64: ; preds = %59
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%70 = load i32*, i32** %6
%71 = call i32 @nextEntity(i8* %69, i32* %70)
br label %171
72: ; preds = %64
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%74 = call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %72
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%78 = load i32*, i32** %6
%79 = call i32 @nextEntity(i8* %77, i32* %78)
br label %170
80: ; preds = %72
%81 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%82 = call i64 @strcmp(i8* %81, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %88
84: ; preds = %80
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%86 = load i32*, i32** %6
%87 = call i32 @nextEntity(i8* %85, i32* %86)
br label %169
88: ; preds = %80
%89 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%90 = call i64 @strcmp(i8* %89, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %121
92: ; preds = %88
store i32 0, i32* %13
br label %93
93: ; preds = %107, %92
%94 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%95 = load i32*, i32** %6
%96 = call i32 @nextEntity(i8* %94, i32* %95)
%97 = icmp eq i32 %96, 1
br i1 %97, label %98, label %105
98: ; preds = %93
%99 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%100 = call i64 @strcmp(i8* %99, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %98
%103 = load i32, i32* %13
%104 = icmp slt i32 %103, 20
br label %105
105: ; preds = %102, %98, %93
%106 = phi i1 [ false, %98 ], [ false, %93 ], [ %104, %102 ]
br i1 %106, label %107, label %120
107: ; preds = %105
%108 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%109 = load i32*, i32** %6
%110 = call i32 @nextEntity(i8* %108, i32* %109)
%111 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%112 = call i8* @strdup(i8* %111)
%113 = load i32, i32* %13
%114 = add nsw i32 %113, 1
store i32 %114, i32* %13
%115 = sext i32 %113 to i64
%116 = getelementptr inbounds [20 x i8*], [20 x i8*]* %12, i64 0, i64 %115
store i8* %112, i8** %116
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%118 = load i32*, i32** %6
%119 = call i32 @nextEntity(i8* %117, i32* %118)
br label %93
120: ; preds = %105
br label %59
121: ; preds = %88
%122 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%123 = call i64 @strcmp(i8* %122, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%124 = icmp eq i64 %123, 0
br i1 %124, label %125, label %165
125: ; preds = %121
%126 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%127 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %126, i8* %127)
store i32 0, i32* %13
br label %129
129: ; preds = %135, %125
%130 = load i32, i32* %13
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [20 x i8*], [20 x i8*]* %12, i64 0, i64 %131
%133 = load i8*, i8** %132
%134 = icmp ne i8* %133, null
br i1 %134, label %135, label %164
135: ; preds = %129
%136 = load i32*, i32** %5
%137 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%138 = load i32, i32* %13
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [20 x i8*], [20 x i8*]* %12, i64 0, i64 %139
%141 = load i8*, i8** %140
%142 = call i32 (i32*, i8*, ...) @fprintf(i32* %136, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %137, i8* %141)
%143 = load i32*, i32** %5
%144 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%145 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8* %144)
%146 = load i32*, i32** %5
%147 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%148 = call i32 (i32*, i8*, ...) @fprintf(i32* %146, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* %147)
%149 = load i32*, i32** %5
%150 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%151 = call i32 (i32*, i8*, ...) @fprintf(i32* %149, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8* %150)
%152 = load i32*, i32** %5
%153 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%154 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%155 = load i32, i32* %13
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [20 x i8*], [20 x i8*]* %12, i64 0, i64 %156
%158 = load i8*, i8** %157
%159 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i8* %153, i8* %154, i8* %158)
%160 = load i32*, i32** %5
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
%162 = load i32, i32* %13
%163 = add nsw i32 %162, 1
store i32 %163, i32* %13
br label %129
164: ; preds = %129
br label %175
165: ; preds = %121
%166 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%167 = load i32*, i32** %6
%168 = call i32 @discardTag(i8* %166, i32* %167)
br label %59
169: ; preds = %84
br label %170
170: ; preds = %169, %76
br label %171
171: ; preds = %170, %68
%172 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%173 = load i32*, i32** %6
%174 = call i32 @nextEntity(i8* %172, i32* %173)
br label %59
175: ; preds = %164, %59
br label %36
176: ; preds = %49, %36
br label %177
177: ; preds = %176, %30, %25
%178 = load i32*, i32** %6
%179 = call i64 @pclose(i32* %178)
%180 = icmp eq i64 %179, 0
br i1 %180, label %181, label %182
181: ; preds = %177
store i32 1, i32* %13
br label %183
182: ; preds = %177
store i32 0, i32* %13
br label %183
183: ; preds = %182, %181
%184 = load i32, i32* %13
store i32 %184, i32* %3
br label %185
185: ; preds = %183, %24
%186 = load i32, i32* %3
ret i32 %186
}

LLVM IR (-O2):
@.str = [28 x i8] c"foomatic-combo-xml -O -l %s\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"overview\00"
@.str.4 = [8 x i8] c"printer\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [3 x i8] c"id\00"
@.str.7 = [5 x i8] c"make\00"
@.str.8 = [6 x i8] c"model\00"
@.str.9 = [8 x i8] c"drivers\00"
@.str.10 = [7 x i8] c"driver\00"
@.str.11 = [7 x i8] c"%s %s\0A\00"
@.str.12 = [12 x i8] c"FILE=%s|%s\0A\00"
@.str.13 = [17 x i8] c"MANUFACTURER=%s\0A\00"
@.str.14 = [14 x i8] c"MODELNAME=%s\0A\00"
@.str.15 = [10 x i8] c"MODEL=%s\0A\00"
@.str.16 = [24 x i8] c"DESCRIPTION=%s %s (%s)\0A\00"
@str = [3 x i8] c"-1\00"
define i32 @parseOverview(i8* %0, i32* 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 [20 x i8*]
%9 = alloca [1024 x i8]
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%15 = bitcast [20 x i8*]* %8 to i8*
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%17 = call i32 @snprintf(i8* %16, i32 1024, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%18 = call i32* @popen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %112, label %20
20: ; preds = %2
%21 = call i32 @nextEntity(i8* %13, i32* %18)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %108
23: ; preds = %20
%24 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %108
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%28 = call i32 @nextEntity(i8* %13, i32* %18)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %108
30: ; preds = %26
%31 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 0
br label %32
32: ; preds = %30, %105
%33 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %108, label %35
35: ; preds = %32
%36 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %108
38: ; preds = %35
%39 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%40 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%41 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%42 = call i32 @clearDrivers(i8** %31)
%43 = call i32 @nextEntity(i8* %13, i32* %18)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %105
45: ; preds = %38, %74
%46 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %101, label %48
48: ; preds = %45
%49 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %101, label %51
51: ; preds = %48
%52 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %101, label %54
54: ; preds = %51
%55 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %77
57: ; preds = %54
%58 = call i32 @nextEntity(i8* %13, i32* %18)
%59 = icmp eq i32 %58, 1
br i1 %59, label %60, label %74
60: ; preds = %57, %66
%61 = phi i64 [ %69, %66 ], [ 0, %57 ]
%62 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
%64 = icmp ult i64 %61, 20
%65 = select i1 %63, i1 %64, i1 false
br i1 %65, label %66, label %74
66: ; preds = %60
%67 = call i32 @nextEntity(i8* %14, i32* %18)
%68 = call i8* @strdup(i8* %14)
%69 = add nuw nsw i64 %61, 1
%70 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 %61
store i8* %68, i8** %70
%71 = call i32 @nextEntity(i8* %14, i32* %18)
%72 = call i32 @nextEntity(i8* %13, i32* %18)
%73 = icmp eq i32 %72, 1
br i1 %73, label %60, label %74
74: ; preds = %66, %60, %57, %99, %101
%75 = call i32 @nextEntity(i8* %13, i32* %18)
%76 = icmp eq i32 %75, 1
br i1 %76, label %45, label %105
77: ; preds = %54
%78 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %99
80: ; preds = %77
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %11, i8* %12)
%82 = load i8*, i8** %31
%83 = icmp eq i8* %82, null
br i1 %83, label %105, label %84
84: ; preds = %80, %84
%85 = phi i64 [ %95, %84 ], [ 0, %80 ]
%86 = phi i8* [ %97, %84 ], [ %82, %80 ]
%87 = phi i8** [ %96, %84 ], [ %31, %80 ]
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %10, i8* %86)
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8* %11)
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* %12)
%91 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8* %12)
%92 = load i8*, i8** %87
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i8* %11, i8* %12, i8* %92)
%94 = call i32 @fputc(i32 10, i32* %1)
%95 = add nuw i64 %85, 1
%96 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 %95
%97 = load i8*, i8** %96
%98 = icmp eq i8* %97, null
br i1 %98, label %105, label %84
99: ; preds = %77
%100 = call i32 @discardTag(i8* %13, i32* %18)
br label %74
101: ; preds = %51, %48, %45
%102 = phi i8* [ %10, %45 ], [ %11, %48 ], [ %12, %51 ]
%103 = call i32 @nextEntity(i8* %102, i32* %18)
%104 = call i32 @nextEntity(i8* %13, i32* %18)
br label %74
105: ; preds = %74, %84, %38, %80
%106 = call i32 @nextEntity(i8* %13, i32* %18)
%107 = icmp eq i32 %106, 1
br i1 %107, label %32, label %108
108: ; preds = %32, %35, %105, %26, %23, %20
%109 = call i64 @pclose(i32* %18)
%110 = icmp eq i64 %109, 0
%111 = zext i1 %110 to i32
br label %112
112: ; preds = %2, %108
%113 = phi i32 [ %111, %108 ], [ 0, %2 ]
ret i32 %113
}