#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*/ chmod(char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ file_chown(int, char *, char *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ manifest_getentry(char *, char *);
int /*<<< orphan*/ parsetemplate(int, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strstr(char *, char *);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/, int);
int readmanifests(int verbose, int debug, char *path) {
  struct data {
    char name[200];
    char ensure[200];
    char path[200];
    char owner[200];
    char group[200];
    char mode[200];
  } file[100];
  FILE *fp;
  char buffer[1024];
  int filecount = 0;
  int i, count;
  char manifest[512];
  strcpy(file[100].name, "0");
  strcpy(file[100].ensure, "0");
  strcpy(file[100].path, "0");
  strcpy(file[100].owner, "0");
  strcpy(file[100].group, "0");
  for (count = 0; count < 100; count++)
    file[count] = file[100];
  sprintf(manifest, "%s/manifests/init.pp", path);
  fp = fopen(manifest, "r");
  if (fp == NULL) {
    printf("Error: can't read manifest\n");
    exit(1);
  }
  if (debug == 0)
    printf("reading manifest: %s\n", manifest);
  while (feof(fp) != 1) {
    fgets(buffer, 1024, fp);
    if (buffer[0] == '#')
      continue;
    if (strstr(buffer, "file {") != 0) {
      ++filecount;
      for (count = 0;; count++) {
        if (buffer[count] == 34 || buffer[count] == 39)
          break;
      }
      count++;
      for (i = 0;; i++, count++) {
        if (buffer[count] == 34 || buffer[count] == 39)
          break;
        file[filecount].name[i] = buffer[count];
      }
      file[filecount].name[i] = '\0';
      if (debug == 0)
        printf("found file ... %s\n", file[filecount].name);
      while (strstr(buffer, "}") == 0) {
        fgets(buffer, 1024, fp);
        if (strstr(buffer, "ensure") != 0)
          manifest_getentry(buffer, file[filecount].ensure);
        if (strstr(buffer, "path") != 0)
          manifest_getentry(buffer, file[filecount].path);
        if (strstr(buffer, "owner") != 0)
          manifest_getentry(buffer, file[filecount].owner);
        if (strstr(buffer, "group") != 0)
          manifest_getentry(buffer, file[filecount].group);
        if (strstr(buffer, "mode") != 0)
          manifest_getentry(buffer, file[filecount].mode);
      }
    }
  }
  if (debug == 0)
    printf("closing manifest\n");
  for (i = 1; i <= filecount; i++) {
    if (verbose == 0)
      printf("creating ... %s\n", file[i].name);
    parsetemplate(debug, path, file[i].name, file[i].path);
    if ((strcmp(file[i].owner, "0") != 0) || (strcmp(file[i].group, "0") != 0))
      file_chown(debug, file[i].path, file[i].owner, file[i].group);
    if (debug == 0)
      printf("changing file mode to: %s\n", file[i].mode);
    if (strcmp(file[i].mode, "0") != 0)
      chmod(file[i].path, strtol(file[i].mode, 0, 8));
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<readmanifests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1db00,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x1d8e4(%rbp)
lea    -0x1d4d0(%rbp),%rdi
add    $0x1d4c0,%rdi
lea    0xdcc(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x1d4d0(%rbp),%rdi
add    $0x1d4c0,%rdi
add    $0xc8,%rdi
lea    0xdab(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x1d4d0(%rbp),%rdi
add    $0x1d4c0,%rdi
add    $0x190,%rdi
lea    0xd8a(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x1d4d0(%rbp),%rdi
add    $0x1d4c0,%rdi
add    $0x258,%rdi
lea    0xd69(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x1d4d0(%rbp),%rdi
add    $0x1d4c0,%rdi
add    $0x320,%rdi
lea    0xd48(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x1d8ec(%rbp)
cmpl   $0x64,-0x1d8ec(%rbp)
jge    1318 <readmanifests+0x118>
movslq -0x1d8ec(%rbp),%rax
lea    -0x1d4d0(%rbp),%rdi
imul   $0x4b0,%rax,%rax
add    %rax,%rdi
lea    -0x1d4d0(%rbp),%rsi
add    $0x1d4c0,%rsi
mov    $0x4b0,%edx
call   10c0 <memcpy@plt>
mov    -0x1d8ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8ec(%rbp)
jmp    12c7 <readmanifests+0xc7>
lea    -0x1daf0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xcd8(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x1daf0(%rbp),%rdi
lea    0xd38(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x1d4d8(%rbp)
cmpq   $0x0,-0x1d4d8(%rbp)
jne    136f <readmanifests+0x16f>
lea    0xcb9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
cmpl   $0x0,-0x8(%rbp)
jne    138e <readmanifests+0x18e>
lea    -0x1daf0(%rbp),%rsi
lea    0xcac(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1393 <readmanifests+0x193>
mov    -0x1d4d8(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x1,%eax
je     16fe <readmanifests+0x4fe>
lea    -0x1d8e0(%rbp),%rdi
mov    -0x1d4d8(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
movsbl -0x1d8e0(%rbp),%eax
cmp    $0x23,%eax
jne    13d5 <readmanifests+0x1d5>
jmp    1393 <readmanifests+0x193>
lea    -0x1d8e0(%rbp),%rdi
lea    0xc66(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     16f9 <readmanifests+0x4f9>
mov    -0x1d8e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8e4(%rbp)
movl   $0x0,-0x1d8ec(%rbp)
movslq -0x1d8ec(%rbp),%rax
movsbl -0x1d8e0(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
je     143b <readmanifests+0x23b>
movslq -0x1d8ec(%rbp),%rax
movsbl -0x1d8e0(%rbp,%rax,1),%eax
ff
cmp    $0x27,%eax
jne    1440 <readmanifests+0x240>
jmp    1459 <readmanifests+0x259>
jmp    1445 <readmanifests+0x245>
mov    -0x1d8ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8ec(%rbp)
jmp    140b <readmanifests+0x20b>
mov    -0x1d8ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8ec(%rbp)
movl   $0x0,-0x1d8e8(%rbp)
movslq -0x1d8ec(%rbp),%rax
movsbl -0x1d8e0(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
je     14a2 <readmanifests+0x2a2>
movslq -0x1d8ec(%rbp),%rax
movsbl -0x1d8e0(%rbp,%rax,1),%eax
ff
cmp    $0x27,%eax
jne    14a7 <readmanifests+0x2a7>
jmp    14fa <readmanifests+0x2fa>
movslq -0x1d8ec(%rbp),%rax
mov    -0x1d8e0(%rbp,%rax,1),%dl
movslq -0x1d8e4(%rbp),%rcx
lea    -0x1d4d0(%rbp),%rax
imul   $0x4b0,%rcx,%rcx
add    %rcx,%rax
movslq -0x1d8e8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1d8e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8e8(%rbp)
mov    -0x1d8ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8ec(%rbp)
jmp    1472 <readmanifests+0x272>
movslq -0x1d8e4(%rbp),%rcx
lea    -0x1d4d0(%rbp),%rax
imul   $0x4b0,%rcx,%rcx
add    %rcx,%rax
movslq -0x1d8e8(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x0,-0x8(%rbp)
jne    154d <readmanifests+0x34d>
movslq -0x1d8e4(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
lea    0xb0a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1552 <readmanifests+0x352>
lea    -0x1d8e0(%rbp),%rdi
lea    0xb03(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
jne    16f4 <readmanifests+0x4f4>
lea    -0x1d8e0(%rbp),%rdi
mov    -0x1d4d8(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
lea    -0x1d8e0(%rbp),%rdi
lea    0xad0(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     15cf <readmanifests+0x3cf>
lea    -0x1d8e0(%rbp),%rdi
movslq -0x1d8e4(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
add    $0xc8,%rsi
call   1110 <manifest_getentry@plt>
lea    -0x1d8e0(%rbp),%rdi
lea    0xa8f(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     1617 <readmanifests+0x417>
lea    -0x1d8e0(%rbp),%rdi
movslq -0x1d8e4(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
add    $0x190,%rsi
call   1110 <manifest_getentry@plt>
lea    -0x1d8e0(%rbp),%rdi
lea    0xa4c(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     165f <readmanifests+0x45f>
lea    -0x1d8e0(%rbp),%rdi
movslq -0x1d8e4(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
add    $0x258,%rsi
call   1110 <manifest_getentry@plt>
lea    -0x1d8e0(%rbp),%rdi
lea    0xa0a(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     16a7 <readmanifests+0x4a7>
lea    -0x1d8e0(%rbp),%rdi
movslq -0x1d8e4(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
add    $0x320,%rsi
call   1110 <manifest_getentry@plt>
lea    -0x1d8e0(%rbp),%rdi
lea    0x9c8(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     16ef <readmanifests+0x4ef>
lea    -0x1d8e0(%rbp),%rdi
movslq -0x1d8e4(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
add    $0x3e8,%rsi
call   1110 <manifest_getentry@plt>
jmp    1552 <readmanifests+0x352>
jmp    16f9 <readmanifests+0x4f9>
jmp    1393 <readmanifests+0x193>
cmpl   $0x0,-0x8(%rbp)
jne    1716 <readmanifests+0x516>
lea    0x973(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x1d8e8(%rbp)
mov    -0x1d8e8(%rbp),%eax
cmp    -0x1d8e4(%rbp),%eax
jg     1957 <readmanifests+0x757>
cmpl   $0x0,-0x4(%rbp)
jne    1762 <readmanifests+0x562>
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
lea    0x939(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rdx
imul   $0x4b0,%rax,%rax
add    %rax,%rdx
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rcx
imul   $0x4b0,%rax,%rax
add    %rax,%rcx
add    $0x190,%rcx
call   1040 <parsetemplate@plt>
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rdi
imul   $0x4b0,%rax,%rax
add    %rax,%rdi
add    $0x258,%rdi
lea    0x835(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    180f <readmanifests+0x60f>
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rdi
imul   $0x4b0,%rax,%rax
add    %rax,%rdi
add    $0x320,%rdi
lea    0x800(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1874 <readmanifests+0x674>
mov    -0x8(%rbp),%edi
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
add    $0x190,%rsi
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rdx
imul   $0x4b0,%rax,%rax
add    %rax,%rdx
add    $0x258,%rdx
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rcx
imul   $0x4b0,%rax,%rax
add    %rax,%rcx
add    $0x320,%rcx
call   1060 <file_chown@plt>
cmpl   $0x0,-0x8(%rbp)
jne    18ab <readmanifests+0x6ab>
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rsi
imul   $0x4b0,%rax,%rax
add    %rax,%rsi
add    $0x3e8,%rsi
lea    0x801(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rdi
imul   $0x4b0,%rax,%rax
add    %rax,%rdi
add    $0x3e8,%rdi
lea    0x72f(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     193e <readmanifests+0x73e>
movslq -0x1d8e8(%rbp),%rcx
lea    -0x1d4d0(%rbp),%rax
imul   $0x4b0,%rcx,%rcx
add    %rcx,%rax
add    $0x190,%rax
mov    %rax,-0x1daf8(%rbp)
movslq -0x1d8e8(%rbp),%rax
lea    -0x1d4d0(%rbp),%rdi
imul   $0x4b0,%rax,%rax
add    %rax,%rdi
add    $0x3e8,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10b0 <strtol@plt>
mov    -0x1daf8(%rbp),%rdi
mov    %eax,%esi
call   10d0 <chmod@plt>
jmp    1943 <readmanifests+0x743>
mov    -0x1d8e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8e8(%rbp)
jmp    1720 <readmanifests+0x520>
mov    -0x1d4d8(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x1db00,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readmanifests>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1db08,%rsp
mov    %rdx,0x18(%rsp)
mov    %esi,%r14d
mov    %edi,0x14(%rsp)
lea    0x1db00(%rsp),%rbx
lea    0xdc4(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x1dbc8(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x1dc90(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x1dd58(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x1de20(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    (%rsp,%rbp,1),%rdi
add    $0x640,%rdi
mov    $0x4b0,%edx
mov    %rbx,%rsi
call   10d0 <memcpy@plt>
lea    (%rsp,%rbp,1),%rdi
add    $0xaf0,%rdi
mov    $0x4b0,%edx
mov    %rbx,%rsi
call   10d0 <memcpy@plt>
lea    (%rsp,%rbp,1),%rdi
add    $0xfa0,%rdi
mov    $0x4b0,%edx
mov    %rbx,%rsi
call   10d0 <memcpy@plt>
lea    (%rsp,%rbp,1),%rdi
add    $0x1450,%rdi
mov    $0x4b0,%edx
mov    %rbx,%rsi
call   10d0 <memcpy@plt>
add    $0x12c0,%rbp
cmp    $0x1d4c0,%rbp
jne    1290 <readmanifests+0x80>
lea    0xcfb(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    0x18(%rsp),%rdx
call   1100 <sprintf@plt>
lea    0xd39(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     168e <readmanifests+0x47e>
mov    %r14d,%ebx
test   %r14d,%r14d
jne    1351 <readmanifests+0x141>
lea    0xcd2(%rip),%rdi
lea    0x40(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xaf0(%rsp),%r14
lea    0x240(%rsp),%r12
lea    0xcc5(%rip),%r15
xor    %r13d,%r13d
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   10b0 <feof@plt>
cmp    $0x1,%eax
je     1572 <readmanifests+0x362>
mov    %r12,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1090 <fgets@plt>
cmpb   $0x23,0x240(%rsp)
23
je     1370 <readmanifests+0x160>
mov    %r12,%rdi
mov    %r15,%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1370 <readmanifests+0x160>
add    $0x1,%r13
xor    %eax,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x240(%rsp,%rcx,1),%edx
cmp    $0x22,%dl
je     13db <readmanifests+0x1cb>
cmp    $0x27,%dl
je     13db <readmanifests+0x1cb>
add    $0x1,%rcx
add    $0x1,%eax
jmp    13c0 <readmanifests+0x1b0>
mov    %r13d,%esi
mov    %eax,%eax
lea    0x241(%rsp),%rcx
add    %rcx,%rax
xor    %edx,%edx
nopl   (%rax)
movzbl (%rax,%rdx,1),%ecx
cmp    $0x22,%cl
je     1408 <readmanifests+0x1f8>
cmp    $0x27,%cl
je     1408 <readmanifests+0x1f8>
mov    %cl,(%r14,%rdx,1)
add    $0x1,%rdx
jmp    13f0 <readmanifests+0x1e0>
imul   $0x4b0,%rsi,%rbp
mov    %edx,%eax
lea    (%rsp,%rbp,1),%rsi
add    $0x640,%rsi
movb   $0x0,(%rax,%rsi,1)
test   %ebx,%ebx
jne    1432 <readmanifests+0x222>
lea    0xc09(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
lea    0xc0b(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1452 <readmanifests+0x242>
add    $0x4b0,%r14
jmp    136b <readmanifests+0x15b>
lea    (%rsp,%rbp,1),%rax
add    $0x708,%rax
lea    0x7d0(%rsp,%rbp,1),%rcx
mov    %rcx,0x38(%rsp)
lea    0x898(%rsp,%rbp,1),%rcx
mov    %rcx,0x30(%rsp)
lea    0x960(%rsp,%rbp,1),%rcx
mov    %rcx,0x28(%rsp)
lea    (%rsp,%rbp,1),%rcx
add    $0xa28,%rcx
mov    %rcx,0x20(%rsp)
mov    %rax,%rbp
jmp    14b4 <readmanifests+0x2a4>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
lea    0xb9d(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
jne    1446 <readmanifests+0x236>
mov    %r12,%rdi
mov    $0x400,%esi
mov    0x8(%rsp),%rdx
call   1090 <fgets@plt>
mov    %r12,%rdi
lea    0xb79(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     14e5 <readmanifests+0x2d5>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1120 <manifest_getentry@plt>
mov    %r12,%rdi
lea    0xb61(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1506 <readmanifests+0x2f6>
mov    %r12,%rdi
mov    0x38(%rsp),%rsi
call   1120 <manifest_getentry@plt>
mov    %r12,%rdi
lea    0xb45(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1527 <readmanifests+0x317>
mov    %r12,%rdi
mov    0x30(%rsp),%rsi
call   1120 <manifest_getentry@plt>
mov    %r12,%rdi
lea    0xb2a(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1548 <readmanifests+0x338>
mov    %r12,%rdi
mov    0x28(%rsp),%rsi
call   1120 <manifest_getentry@plt>
mov    %r12,%rdi
lea    0xb0f(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     14a0 <readmanifests+0x290>
mov    %r12,%rdi
mov    0x20(%rsp),%rsi
call   1120 <manifest_getentry@plt>
jmp    14a0 <readmanifests+0x290>
test   %ebx,%ebx
jne    1582 <readmanifests+0x372>
lea    0xb15(%rip),%rdi
call   1040 <puts@plt>
test   %r13d,%r13d
je     1670 <readmanifests+0x460>
lea    0xed8(%rsp),%rbp
lea    0xa66(%rip),%r12
jmp    15b1 <readmanifests+0x3a1>
nopl   0x0(%rax)
add    $0x4b0,%rbp
add    $0xffffffffffffffff,%r13
je     1670 <readmanifests+0x460>
cmpl   $0x0,0x14(%rsp)
jne    15cd <readmanifests+0x3bd>
lea    -0x3e8(%rbp),%rsi
lea    0xaa0(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    -0x3e8(%rbp),%rdx
lea    -0x258(%rbp),%r14
mov    %ebx,%edi
mov    0x18(%rsp),%rsi
mov    %r14,%rcx
call   1050 <parsetemplate@plt>
lea    -0x190(%rbp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1615 <readmanifests+0x405>
lea    -0xc8(%rbp),%rdi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1629 <readmanifests+0x419>
lea    -0xc8(%rbp),%rcx
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <file_chown@plt>
test   %ebx,%ebx
jne    163e <readmanifests+0x42e>
lea    0xa43(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     15a0 <readmanifests+0x390>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10c0 <strtol@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   10e0 <chmod@plt>
jmp    15a0 <readmanifests+0x390>
mov    0x8(%rsp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x1db08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa0e(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.data = type { [200 x i8], [200 x i8], [200 x i8], [200 x i8], [200 x i8], [200 x i8] }
@.str = [2 x i8] c"0\00"
@.str.1 = [21 x i8] c"%s/manifests/init.pp\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [28 x i8] c"Error: can't read manifest\0A\00"
@.str.4 = [22 x i8] c"reading manifest: %s\0A\00"
@.str.5 = [7 x i8] c"file {\00"
@.str.6 = [19 x i8] c"found file ... %s\0A\00"
@.str.7 = [2 x i8] c"}\00"
@.str.8 = [7 x i8] c"ensure\00"
@.str.9 = [5 x i8] c"path\00"
@.str.10 = [6 x i8] c"owner\00"
@.str.11 = [6 x i8] c"group\00"
@.str.12 = [5 x i8] c"mode\00"
@.str.13 = [18 x i8] c"closing manifest\0A\00"
@.str.14 = [17 x i8] c"creating ... %s\0A\00"
@.str.15 = [27 x i8] c"changing file mode to: %s\0A\00"
define i32 @readmanifests(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [100 x %struct.data]
%8 = alloca i32*
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [512 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %10
%14 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 100
%15 = getelementptr inbounds %struct.data, %struct.data* %14, i32 0, i32 0
%16 = getelementptr inbounds [200 x i8], [200 x i8]* %15, i64 0, i64 0
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 100
%19 = getelementptr inbounds %struct.data, %struct.data* %18, i32 0, i32 1
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %19, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 100
%23 = getelementptr inbounds %struct.data, %struct.data* %22, i32 0, i32 2
%24 = getelementptr inbounds [200 x i8], [200 x i8]* %23, i64 0, i64 0
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%26 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 100
%27 = getelementptr inbounds %struct.data, %struct.data* %26, i32 0, i32 3
%28 = getelementptr inbounds [200 x i8], [200 x i8]* %27, i64 0, i64 0
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%30 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 100
%31 = getelementptr inbounds %struct.data, %struct.data* %30, i32 0, i32 4
%32 = getelementptr inbounds [200 x i8], [200 x i8]* %31, i64 0, i64 0
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %12
br label %34
34: ; preds = %44, %3
%35 = load i32, i32* %12
%36 = icmp slt i32 %35, 100
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load i32, i32* %12
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %39
%41 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 100
%42 = bitcast %struct.data* %40 to i8*
%43 = bitcast %struct.data* %41 to i8*
br label %44
44: ; preds = %37
%45 = load i32, i32* %12
%46 = add nsw i32 %45, 1
store i32 %46, i32* %12
br label %34
47: ; preds = %34
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%49 = load i8*, i8** %6
%50 = call i32 @sprintf(i8* %48, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%52 = call i32* @fopen(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %52, i32** %8
%53 = load i32*, i32** %8
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %58
55: ; preds = %47
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %47
%59 = load i32, i32* %5
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %62)
br label %64
64: ; preds = %61, %58
br label %65
65: ; preds = %226, %77, %64
%66 = load i32*, i32** %8
%67 = call i32 @feof(i32* %66)
%68 = icmp ne i32 %67, 1
br i1 %68, label %69, label %227
69: ; preds = %65
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%71 = load i32*, i32** %8
%72 = call i32 @fgets(i8* %70, i32 1024, i32* %71)
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 35
br i1 %76, label %77, label %78
77: ; preds = %69
br label %65
78: ; preds = %69
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%80 = call i64 @strstr(i8* %79, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %226
82: ; preds = %78
%83 = load i32, i32* %10
%84 = add nsw i32 %83, 1
store i32 %84, i32* %10
store i32 0, i32* %12
br label %85
85: ; preds = %101, %82
%86 = load i32, i32* %12
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 34
br i1 %91, label %99, label %92
92: ; preds = %85
%93 = load i32, i32* %12
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %94
%96 = load i8, i8* %95
%97 = sext i8 %96 to i32
%98 = icmp eq i32 %97, 39
br i1 %98, label %99, label %100
99: ; preds = %92, %85
br label %104
100: ; preds = %92
br label %101
101: ; preds = %100
%102 = load i32, i32* %12
%103 = add nsw i32 %102, 1
store i32 %103, i32* %12
br label %85
104: ; preds = %99
%105 = load i32, i32* %12
%106 = add nsw i32 %105, 1
store i32 %106, i32* %12
store i32 0, i32* %11
br label %107
107: ; preds = %134, %104
%108 = load i32, i32* %12
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 34
br i1 %113, label %121, label %114
114: ; preds = %107
%115 = load i32, i32* %12
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %116
%118 = load i8, i8* %117
%119 = sext i8 %118 to i32
%120 = icmp eq i32 %119, 39
br i1 %120, label %121, label %122
121: ; preds = %114, %107
br label %139
122: ; preds = %114
%123 = load i32, i32* %12
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %124
%126 = load i8, i8* %125
%127 = load i32, i32* %10
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %128
%130 = getelementptr inbounds %struct.data, %struct.data* %129, i32 0, i32 0
%131 = load i32, i32* %11
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [200 x i8], [200 x i8]* %130, i64 0, i64 %132
store i8 %126, i8* %133
br label %134
134: ; preds = %122
%135 = load i32, i32* %11
%136 = add nsw i32 %135, 1
store i32 %136, i32* %11
%137 = load i32, i32* %12
%138 = add nsw i32 %137, 1
store i32 %138, i32* %12
br label %107
139: ; preds = %121
%140 = load i32, i32* %10
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %141
%143 = getelementptr inbounds %struct.data, %struct.data* %142, i32 0, i32 0
%144 = load i32, i32* %11
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [200 x i8], [200 x i8]* %143, i64 0, i64 %145
store i8 0, i8* %146
%147 = load i32, i32* %5
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %156
149: ; preds = %139
%150 = load i32, i32* %10
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %151
%153 = getelementptr inbounds %struct.data, %struct.data* %152, i32 0, i32 0
%154 = getelementptr inbounds [200 x i8], [200 x i8]* %153, i64 0, i64 0
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %154)
br label %156
156: ; preds = %149, %139
br label %157
157: ; preds = %224, %156
%158 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%159 = call i64 @strstr(i8* %158, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%160 = icmp eq i64 %159, 0
br i1 %160, label %161, label %225
161: ; preds = %157
%162 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%163 = load i32*, i32** %8
%164 = call i32 @fgets(i8* %162, i32 1024, i32* %163)
%165 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%166 = call i64 @strstr(i8* %165, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%167 = icmp ne i64 %166, 0
br i1 %167, label %168, label %176
168: ; preds = %161
%169 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%170 = load i32, i32* %10
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %171
%173 = getelementptr inbounds %struct.data, %struct.data* %172, i32 0, i32 1
%174 = getelementptr inbounds [200 x i8], [200 x i8]* %173, i64 0, i64 0
%175 = call i32 @manifest_getentry(i8* %169, i8* %174)
br label %176
176: ; preds = %168, %161
%177 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%178 = call i64 @strstr(i8* %177, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%179 = icmp ne i64 %178, 0
br i1 %179, label %180, label %188
180: ; preds = %176
%181 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%182 = load i32, i32* %10
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %183
%185 = getelementptr inbounds %struct.data, %struct.data* %184, i32 0, i32 2
%186 = getelementptr inbounds [200 x i8], [200 x i8]* %185, i64 0, i64 0
%187 = call i32 @manifest_getentry(i8* %181, i8* %186)
br label %188
188: ; preds = %180, %176
%189 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%190 = call i64 @strstr(i8* %189, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%191 = icmp ne i64 %190, 0
br i1 %191, label %192, label %200
192: ; preds = %188
%193 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%194 = load i32, i32* %10
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %195
%197 = getelementptr inbounds %struct.data, %struct.data* %196, i32 0, i32 3
%198 = getelementptr inbounds [200 x i8], [200 x i8]* %197, i64 0, i64 0
%199 = call i32 @manifest_getentry(i8* %193, i8* %198)
br label %200
200: ; preds = %192, %188
%201 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%202 = call i64 @strstr(i8* %201, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%203 = icmp ne i64 %202, 0
br i1 %203, label %204, label %212
204: ; preds = %200
%205 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%206 = load i32, i32* %10
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %207
%209 = getelementptr inbounds %struct.data, %struct.data* %208, i32 0, i32 4
%210 = getelementptr inbounds [200 x i8], [200 x i8]* %209, i64 0, i64 0
%211 = call i32 @manifest_getentry(i8* %205, i8* %210)
br label %212
212: ; preds = %204, %200
%213 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%214 = call i64 @strstr(i8* %213, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%215 = icmp ne i64 %214, 0
br i1 %215, label %216, label %224
216: ; preds = %212
%217 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%218 = load i32, i32* %10
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %219
%221 = getelementptr inbounds %struct.data, %struct.data* %220, i32 0, i32 5
%222 = getelementptr inbounds [200 x i8], [200 x i8]* %221, i64 0, i64 0
%223 = call i32 @manifest_getentry(i8* %217, i8* %222)
br label %224
224: ; preds = %216, %212
br label %157
225: ; preds = %157
br label %226
226: ; preds = %225, %78
br label %65
227: ; preds = %65
%228 = load i32, i32* %5
%229 = icmp eq i32 %228, 0
br i1 %229, label %230, label %232
230: ; preds = %227
%231 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
br label %232
232: ; preds = %230, %227
store i32 1, i32* %11
br label %233
233: ; preds = %326, %232
%234 = load i32, i32* %11
%235 = load i32, i32* %10
%236 = icmp sle i32 %234, %235
br i1 %236, label %237, label %329
237: ; preds = %233
%238 = load i32, i32* %4
%239 = icmp eq i32 %238, 0
br i1 %239, label %240, label %247
240: ; preds = %237
%241 = load i32, i32* %11
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %242
%244 = getelementptr inbounds %struct.data, %struct.data* %243, i32 0, i32 0
%245 = getelementptr inbounds [200 x i8], [200 x i8]* %244, i64 0, i64 0
%246 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %245)
br label %247
247: ; preds = %240, %237
%248 = load i32, i32* %5
%249 = load i8*, i8** %6
%250 = load i32, i32* %11
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %251
%253 = getelementptr inbounds %struct.data, %struct.data* %252, i32 0, i32 0
%254 = getelementptr inbounds [200 x i8], [200 x i8]* %253, i64 0, i64 0
%255 = load i32, i32* %11
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %256
%258 = getelementptr inbounds %struct.data, %struct.data* %257, i32 0, i32 2
%259 = getelementptr inbounds [200 x i8], [200 x i8]* %258, i64 0, i64 0
%260 = call i32 @parsetemplate(i32 %248, i8* %249, i8* %254, i8* %259)
%261 = load i32, i32* %11
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %262
%264 = getelementptr inbounds %struct.data, %struct.data* %263, i32 0, i32 3
%265 = getelementptr inbounds [200 x i8], [200 x i8]* %264, i64 0, i64 0
%266 = call i64 @strcmp(i8* %265, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%267 = icmp ne i64 %266, 0
br i1 %267, label %276, label %268
268: ; preds = %247
%269 = load i32, i32* %11
%270 = sext i32 %269 to i64
%271 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %270
%272 = getelementptr inbounds %struct.data, %struct.data* %271, i32 0, i32 4
%273 = getelementptr inbounds [200 x i8], [200 x i8]* %272, i64 0, i64 0
%274 = call i64 @strcmp(i8* %273, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%275 = icmp ne i64 %274, 0
br i1 %275, label %276, label %294
276: ; preds = %268, %247
%277 = load i32, i32* %5
%278 = load i32, i32* %11
%279 = sext i32 %278 to i64
%280 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %279
%281 = getelementptr inbounds %struct.data, %struct.data* %280, i32 0, i32 2
%282 = getelementptr inbounds [200 x i8], [200 x i8]* %281, i64 0, i64 0
%283 = load i32, i32* %11
%284 = sext i32 %283 to i64
%285 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %284
%286 = getelementptr inbounds %struct.data, %struct.data* %285, i32 0, i32 3
%287 = getelementptr inbounds [200 x i8], [200 x i8]* %286, i64 0, i64 0
%288 = load i32, i32* %11
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %289
%291 = getelementptr inbounds %struct.data, %struct.data* %290, i32 0, i32 4
%292 = getelementptr inbounds [200 x i8], [200 x i8]* %291, i64 0, i64 0
%293 = call i32 @file_chown(i32 %277, i8* %282, i8* %287, i8* %292)
br label %294
294: ; preds = %276, %268
%295 = load i32, i32* %5
%296 = icmp eq i32 %295, 0
br i1 %296, label %297, label %304
297: ; preds = %294
%298 = load i32, i32* %11
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %299
%301 = getelementptr inbounds %struct.data, %struct.data* %300, i32 0, i32 5
%302 = getelementptr inbounds [200 x i8], [200 x i8]* %301, i64 0, i64 0
%303 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i8* %302)
br label %304
304: ; preds = %297, %294
%305 = load i32, i32* %11
%306 = sext i32 %305 to i64
%307 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %306
%308 = getelementptr inbounds %struct.data, %struct.data* %307, i32 0, i32 5
%309 = getelementptr inbounds [200 x i8], [200 x i8]* %308, i64 0, i64 0
%310 = call i64 @strcmp(i8* %309, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%311 = icmp ne i64 %310, 0
br i1 %311, label %312, label %325
312: ; preds = %304
%313 = load i32, i32* %11
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %314
%316 = getelementptr inbounds %struct.data, %struct.data* %315, i32 0, i32 2
%317 = getelementptr inbounds [200 x i8], [200 x i8]* %316, i64 0, i64 0
%318 = load i32, i32* %11
%319 = sext i32 %318 to i64
%320 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %7, i64 0, i64 %319
%321 = getelementptr inbounds %struct.data, %struct.data* %320, i32 0, i32 5
%322 = getelementptr inbounds [200 x i8], [200 x i8]* %321, i64 0, i64 0
%323 = call i32 @strtol(i8* %322, i32 0, i32 8)
%324 = call i32 @chmod(i8* %317, i32 %323)
br label %325
325: ; preds = %312, %304
br label %326
326: ; preds = %325
%327 = load i32, i32* %11
%328 = add nsw i32 %327, 1
store i32 %328, i32* %11
br label %233
329: ; preds = %233
%330 = load i32*, i32** %8
%331 = call i32 @fclose(i32* %330)
ret i32 0
}

LLVM IR (-O2):
%struct.data = type { [200 x i8], [200 x i8], [200 x i8], [200 x i8], [200 x i8], [200 x i8] }
@.str = [2 x i8] c"0\00"
@.str.1 = [21 x i8] c"%s/manifests/init.pp\00"
@.str.2 = [2 x i8] c"r\00"
@.str.4 = [22 x i8] c"reading manifest: %s\0A\00"
@.str.5 = [7 x i8] c"file {\00"
@.str.6 = [19 x i8] c"found file ... %s\0A\00"
@.str.7 = [2 x i8] c"}\00"
@.str.8 = [7 x i8] c"ensure\00"
@.str.9 = [5 x i8] c"path\00"
@.str.10 = [6 x i8] c"owner\00"
@.str.11 = [6 x i8] c"group\00"
@.str.12 = [5 x i8] c"mode\00"
@.str.14 = [17 x i8] c"creating ... %s\0A\00"
@.str.15 = [27 x i8] c"changing file mode to: %s\0A\00"
@str = [17 x i8] c"closing manifest\00"
@str.16 = [27 x i8] c"Error: can't read manifest\00"
define i32 @readmanifests(i32 %0, i32 %1, i8* %2) {
%4 = alloca [100 x %struct.data]
%5 = alloca [1024 x i8]
%6 = alloca [512 x i8]
%7 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 0, i32 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 100, i32 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 100, i32 1, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 100, i32 2, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 100, i32 3, i64 0
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 100, i32 4, i64 0
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %20, %3
%21 = phi i64 [ 0, %3 ], [ %29, %20 ]
%22 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %21, i32 0, i64 0
%23 = or i64 %21, 1
%24 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %23, i32 0, i64 0
%25 = or i64 %21, 2
%26 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %25, i32 0, i64 0
%27 = or i64 %21, 3
%28 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %27, i32 0, i64 0
%29 = add nuw nsw i64 %21, 4
%30 = icmp eq i64 %29, 100
br i1 %30, label %31, label %20
31: ; preds = %20
%32 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%33 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.16, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %31
%39 = icmp eq i32 %1, 0
br i1 %39, label %40, label %42
40: ; preds = %38
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %9)
br label %42
42: ; preds = %40, %38
br label %43
43: ; preds = %85, %42
%44 = phi i32 [ 0, %42 ], [ %57, %85 ]
br label %45
45: ; preds = %43, %53
br label %46
46: ; preds = %45, %49
%47 = call i32 @feof(i32* %33)
%48 = icmp eq i32 %47, 1
br i1 %48, label %121, label %49
49: ; preds = %46
%50 = call i32 @fgets(i8* %8, i32 1024, i32* %33)
%51 = load i8, i8* %8
%52 = icmp eq i8 %51, 35
br i1 %52, label %46, label %53
53: ; preds = %49
%54 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %45, label %56
56: ; preds = %53
%57 = add nuw nsw i32 %44, 1
br label %58
58: ; preds = %62, %56
%59 = phi i64 [ %63, %62 ], [ 0, %56 ]
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %59
%61 = load i8, i8* %60
switch i8 %61, label %62 [
i8 34, label %64
i8 39, label %64
]
62: ; preds = %58
%63 = add nuw i64 %59, 1
br label %58
64: ; preds = %58, %58
%65 = zext i32 %57 to i64
%66 = and i64 %59, 4294967295
br label %67
67: ; preds = %73, %64
%68 = phi i64 [ %70, %73 ], [ %66, %64 ]
%69 = phi i64 [ %75, %73 ], [ 0, %64 ]
%70 = add nuw nsw i64 %68, 1
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %70
%72 = load i8, i8* %71
switch i8 %72, label %73 [
i8 34, label %76
i8 39, label %76
]
73: ; preds = %67
%74 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 0, i64 %69
store i8 %72, i8* %74
%75 = add nuw i64 %69, 1
br label %67
76: ; preds = %67, %67
%77 = and i64 %69, 4294967295
%78 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 0, i64 %77
store i8 0, i8* %78
br i1 %39, label %79, label %82
79: ; preds = %76
%80 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 0, i64 0
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %80)
br label %82
82: ; preds = %79, %76
%83 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %86, label %85
85: ; preds = %118, %82
br label %43
86: ; preds = %82
%87 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 1, i64 0
%88 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 2, i64 0
%89 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 3, i64 0
%90 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 4, i64 0
%91 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %65, i32 5, i64 0
br label %92
92: ; preds = %86, %118
%93 = call i32 @fgets(i8* %8, i32 1024, i32* %33)
%94 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %98, label %96
96: ; preds = %92
%97 = call i32 @manifest_getentry(i8* %8, i8* %87)
br label %98
98: ; preds = %96, %92
%99 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%100 = icmp eq i64 %99, 0
br i1 %100, label %103, label %101
101: ; preds = %98
%102 = call i32 @manifest_getentry(i8* %8, i8* %88)
br label %103
103: ; preds = %101, %98
%104 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%105 = icmp eq i64 %104, 0
br i1 %105, label %108, label %106
106: ; preds = %103
%107 = call i32 @manifest_getentry(i8* %8, i8* %89)
br label %108
108: ; preds = %106, %103
%109 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%110 = icmp eq i64 %109, 0
br i1 %110, label %113, label %111
111: ; preds = %108
%112 = call i32 @manifest_getentry(i8* %8, i8* %90)
br label %113
113: ; preds = %111, %108
%114 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%115 = icmp eq i64 %114, 0
br i1 %115, label %118, label %116
116: ; preds = %113
%117 = call i32 @manifest_getentry(i8* %8, i8* %91)
br label %118
118: ; preds = %116, %113
%119 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%120 = icmp eq i64 %119, 0
br i1 %120, label %92, label %85
121: ; preds = %46
br i1 %39, label %122, label %124
122: ; preds = %121
%123 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %124
124: ; preds = %122, %121
%125 = icmp eq i32 %44, 0
br i1 %125, label %163, label %126
126: ; preds = %124
%127 = icmp eq i32 %0, 0
%128 = add nuw i32 %44, 1
%129 = zext i32 %128 to i64
br label %130
130: ; preds = %126, %160
%131 = phi i64 [ 1, %126 ], [ %161, %160 ]
br i1 %127, label %132, label %135
132: ; preds = %130
%133 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 0, i64 0
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %133)
br label %135
135: ; preds = %132, %130
%136 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 0, i64 0
%137 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 2, i64 0
%138 = call i32 @parsetemplate(i32 %1, i8* %2, i8* %136, i8* %137)
%139 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 3, i64 0
%140 = call i64 @strcmp(i8* %139, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%141 = icmp eq i64 %140, 0
br i1 %141, label %142, label %146
142: ; preds = %135
%143 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 4, i64 0
%144 = call i64 @strcmp(i8* %143, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%145 = icmp eq i64 %144, 0
br i1 %145, label %149, label %146
146: ; preds = %142, %135
%147 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 4, i64 0
%148 = call i32 @file_chown(i32 %1, i8* %137, i8* %139, i8* %147)
br label %149
149: ; preds = %146, %142
br i1 %39, label %150, label %153
150: ; preds = %149
%151 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 5, i64 0
%152 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i8* %151)
br label %153
153: ; preds = %150, %149
%154 = getelementptr inbounds [100 x %struct.data], [100 x %struct.data]* %4, i64 0, i64 %131, i32 5, i64 0
%155 = call i64 @strcmp(i8* %154, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%156 = icmp eq i64 %155, 0
br i1 %156, label %160, label %157
157: ; preds = %153
%158 = call i32 @strtol(i8* %154, i32 0, i32 8)
%159 = call i32 @chmod(i8* %137, i32 %158)
br label %160
160: ; preds = %153, %157
%161 = add nuw nsw i64 %131, 1
%162 = icmp eq i64 %161, %129
br i1 %162, label %163, label %130
163: ; preds = %160, %124
%164 = call i32 @fclose(i32* %33)
ret i32 0
}