#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*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int BUFSIZ;
scalar_t__ EOF;
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fcopy(char *, char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fputs(char *, int /*<<< orphan*/ *);
int remove(char *);
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
int strlen(char const *);
int /*<<< orphan*/ strncat(char *, char const *, int);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
char *strstr(char *, char const *);
int grub_add_nouveau_nomodeset() {
  FILE *fp, *fpnew;
  char buffer[BUFSIZ];
  char bufnew[BUFSIZ + 128];
  const char *nouveau_modeset_zero = "nouveau.modeset=0";
  const char *grub_cmdline_linux_default = "GRUB_CMDLINE_LINUX_DEFAULT=\"";
  char *pos;
  size_t l, l1;
  int ret;
  extern int nouveau_nomodeset_already_installed;
  l = strlen(grub_cmdline_linux_default);
  l1 = strlen(nouveau_modeset_zero);
  if ((fcopy("/etc/default/grub", "/etc/default/grub.bak.nvidiaprime")) != 0) {
    fprintf(stderr,
            "Can't copy /etc/default/grub to "
            "/etc/default/grub.temp.nvidiaprime: %s (error: %d)\n",
            strerror(errno), errno);
    return (1);
  }
  if ((fp = fopen("/etc/default/grub.bak.nvidiaprime", "r")) == NULL) {
    fprintf(
        stderr,
        "Can't open file /etc/default/grub.bak.nvidiaprime: %s (error %d)\n",
        strerror(errno), errno);
    return (1);
  }
  if ((fpnew = fopen("/etc/default/grub.temp.nvidiaprime", "w")) == NULL) {
    fprintf(stderr, "Can't open file /etc/default/grub.temp.nvidiaprime");
    fclose(fp);
    return (1);
  }
  while (fgets(buffer, sizeof(buffer), fp) != NULL) {
    *(bufnew) = '\0';
    if ((pos = strstr(buffer, grub_cmdline_linux_default))) {
      if (strstr(pos + l, nouveau_modeset_zero)) {
        if ((fputs(buffer, fpnew)) == EOF) {
          fprintf(stderr,
                  "Can't write on file: /etc/default/grub.temp.nvidiaprime: %s "
                  "(error %d)\n",
                  strerror(errno), errno);
          break;
        }
        nouveau_nomodeset_already_installed = 1;
        fprintf(stderr, "/etc/default/grub already contains nouveau.modeset=0 "
                        "option, skipping...\n");
      } else {
        nouveau_nomodeset_already_installed = 0;
        if (l <= BUFSIZ) {
          strncpy(bufnew, buffer, l);
          *(bufnew + l) = '\0';
        }
        if (*(buffer + l) == ' ') {
          strncat(bufnew, " ", 1);
          strncat(bufnew, nouveau_modeset_zero, l1);
          strncat(bufnew, buffer + l, strlen(buffer + l));
        } else {
          strncat(bufnew, nouveau_modeset_zero, l1);
          strncat(bufnew, " ", 1);
          strncat(bufnew, buffer + l, strlen(buffer + l));
        }
      }
      if ((fputs(bufnew, fpnew)) == EOF) {
        fprintf(stderr,
                "Can't write on file: /etc/default/grub.temp.nvidiaprime: %s "
                "(error %d)\n",
                strerror(errno), errno);
        break;
      }
    } else {
      if ((fputs(buffer, fpnew)) == EOF) {
        fprintf(stderr,
                "Can't write on file: /etc/default/grub.temp.nvidiaprime: %s "
                "(error %d)\n",
                strerror(errno), errno);
        break;
      }
    }
  }
  fclose(fp);
  fclose(fpnew);
  if (!nouveau_nomodeset_already_installed) {
    if ((rename("/etc/default/grub.temp.nvidiaprime", "/etc/default/grub")) !=
        0) {
      fprintf(stderr,
              "Can't rename /etc/default/grub.temp.nvidiaprime to "
              "/etc/default/grub: %s (error %d)\n",
              strerror(errno), errno);
      return (1);
    }
  } else {
    if ((ret = remove("/etc/default/grub.temp.nvidiaprime")) != 0) {
      fprintf(stderr,
              "Warning: Can't remove file /etc/default/grub.temp.nvidiaprime: "
              "%s (%d)\n",
              strerror(errno), errno);
      return (1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<grub_add_nouveau_nomodeset>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0x2de6(%rip),%rax
mov    (%rax),%ecx
mov    %rcx,-0x78(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x70(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    (%rax),%eax
sub    $0xffffff80,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    0xdcd(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xdd4(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <strlen@plt>
cltq
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <strlen@plt>
cltq
mov    %rax,-0x58(%rbp)
lea    0xdc8(%rip),%rdi
lea    0xdd3(%rip),%rsi
call   10b0 <fcopy@plt>
cmp    $0x0,%rax
je     12c7 <grub_add_nouveau_nomodeset+0xf7>
mov    0x2d4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    %rax,%rdx
mov    0x2d1c(%rip),%rax
mov    (%rax),%ecx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    1753 <grub_add_nouveau_nomodeset+0x583>
lea    0xd73(%rip),%rdi
lea    0xde2(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1332 <grub_add_nouveau_nomodeset+0x162>
mov    0x2ce1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x80(%rbp),%edi
mov    %rax,%rdx
mov    0x2cb1(%rip),%rax
mov    (%rax),%ecx
lea    0xda1(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    1753 <grub_add_nouveau_nomodeset+0x583>
lea    0xdd4(%rip),%rdi
lea    0xdbb(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1386 <grub_add_nouveau_nomodeset+0x1b6>
mov    0x2c76(%rip),%rax
mov    (%rax),%edi
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    1753 <grub_add_nouveau_nomodeset+0x583>
jmp    138b <grub_add_nouveau_nomodeset+0x1bb>
mov    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     1644 <grub_add_nouveau_nomodeset+0x474>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x40(%rbp),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     15db <grub_add_nouveau_nomodeset+0x40b>
mov    -0x48(%rbp),%rdi
add    -0x50(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     146d <grub_add_nouveau_nomodeset+0x29d>
mov    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <fputs@plt>
mov    0x2be7(%rip),%rcx
cmp    (%rcx),%rax
jne    1444 <grub_add_nouveau_nomodeset+0x274>
mov    0x2bc7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    %rax,%rdx
mov    0x2b91(%rip),%rax
mov    (%rax),%ecx
lea    0xcf8(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1644 <grub_add_nouveau_nomodeset+0x474>
mov    0x2b9d(%rip),%rax
movl   $0x1,(%rax)
mov    0x2b78(%rip),%rax
mov    (%rax),%edi
lea    0xd17(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1577 <grub_add_nouveau_nomodeset+0x3a7>
mov    0x2b74(%rip),%rax
movl   $0x0,(%rax)
mov    -0x50(%rbp),%rax
mov    0x2b43(%rip),%rcx
movslq (%rcx),%rcx
cmp    %rcx,%rax
ja     14ae <grub_add_nouveau_nomodeset+0x2de>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x50(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x68(%rbp),%rax
mov    -0x50(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x70(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    151d <grub_add_nouveau_nomodeset+0x34d>
mov    -0x68(%rbp),%rdi
lea    0xcf4(%rip),%rsi
mov    $0x1,%edx
call   1080 <strncat@plt>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x58(%rbp),%rax
mov    %eax,%edx
call   1080 <strncat@plt>
mov    -0x70(%rbp),%rdi
mov    %rdi,%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x90(%rbp)
add    -0x50(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    -0x90(%rbp),%rsi
mov    %eax,%edx
call   1080 <strncat@plt>
jmp    1572 <grub_add_nouveau_nomodeset+0x3a2>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x58(%rbp),%rax
mov    %eax,%edx
call   1080 <strncat@plt>
mov    -0x68(%rbp),%rdi
lea    0xc87(%rip),%rsi
mov    $0x1,%edx
call   1080 <strncat@plt>
mov    -0x70(%rbp),%rdi
mov    %rdi,%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x98(%rbp)
add    -0x50(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
call   1080 <strncat@plt>
jmp    1577 <grub_add_nouveau_nomodeset+0x3a7>
mov    -0x68(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <fputs@plt>
mov    0x2a55(%rip),%rcx
cmp    (%rcx),%rax
jne    15d6 <grub_add_nouveau_nomodeset+0x406>
mov    0x2a35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2a16(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x9c(%rbp),%edi
mov    %rax,%rdx
mov    0x29ff(%rip),%rax
mov    (%rax),%ecx
lea    0xb66(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1644 <grub_add_nouveau_nomodeset+0x474>
jmp    163f <grub_add_nouveau_nomodeset+0x46f>
mov    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <fputs@plt>
mov    0x29f1(%rip),%rcx
cmp    (%rcx),%rax
jne    163a <grub_add_nouveau_nomodeset+0x46a>
mov    0x29d1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa0(%rbp)
mov    0x29b2(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xa0(%rbp),%edi
mov    %rax,%rdx
mov    0x299b(%rip),%rax
mov    (%rax),%ecx
lea    0xb02(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1644 <grub_add_nouveau_nomodeset+0x474>
jmp    163f <grub_add_nouveau_nomodeset+0x46f>
jmp    138b <grub_add_nouveau_nomodeset+0x1bb>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x298b(%rip),%rax
cmpl   $0x0,(%rax)
jne    16d8 <grub_add_nouveau_nomodeset+0x508>
lea    0xaa0(%rip),%rdi
lea    0x9bb(%rip),%rsi
call   10d0 <rename@plt>
cmp    $0x0,%rax
je     16d3 <grub_add_nouveau_nomodeset+0x503>
mov    0x2946(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
mov    0x2927(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xa4(%rbp),%edi
mov    %rax,%rdx
mov    0x2910(%rip),%rax
mov    (%rax),%ecx
lea    0xb0b(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    1753 <grub_add_nouveau_nomodeset+0x583>
jmp    1745 <grub_add_nouveau_nomodeset+0x575>
lea    0xa2e(%rip),%rdi
call   1040 <remove@plt>
mov    %eax,-0x5c(%rbp)
cmp    $0x0,%eax
je     1740 <grub_add_nouveau_nomodeset+0x570>
mov    0x28d9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    0x28ba(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xa8(%rbp),%edi
mov    %rax,%rdx
mov    0x28a3(%rip),%rax
mov    (%rax),%ecx
lea    0xaf3(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    1753 <grub_add_nouveau_nomodeset+0x583>
jmp    1745 <grub_add_nouveau_nomodeset+0x575>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grub_add_nouveau_nomodeset>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2de0(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%r15
mov    %r14,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    0x80(%r14),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xdf4(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%r13d
lea    0xdd3(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
lea    0xdf4(%rip),%rdi
lea    0xdff(%rip),%rsi
call   10b0 <fcopy@plt>
test   %rax,%rax
je     128e <grub_add_nouveau_nomodeset+0xbe>
mov    0x2d7d(%rip),%rax
mov    (%rax),%ebx
mov    0x2d64(%rip),%r14
mov    (%r14),%edi
call   10e0 <strerror@plt>
mov    (%r14),%ecx
lea    0xdf5(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebx,-0x30(%rbp)
lea    0xda9(%rip),%rdi
lea    0xe18(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x38(%rbp)
test   %rax,%rax
je     1477 <grub_add_nouveau_nomodeset+0x2a7>
mov    %r13d,-0x2c(%rbp)
lea    0xe51(%rip),%rdi
lea    0xe38(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     149e <grub_add_nouveau_nomodeset+0x2ce>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14d,%esi
mov    -0x38(%rbp),%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     14f3 <grub_add_nouveau_nomodeset+0x323>
movslq -0x2c(%rbp),%rax
mov    %rax,-0x48(%rbp)
add    %r15,%rax
mov    %rax,-0x50(%rbp)
lea    0xd10(%rip),%r13
mov    %rbx,-0x40(%rbp)
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,(%r12)
mov    %r15,%rdi
mov    %r13,%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
je     1390 <grub_add_nouveau_nomodeset+0x1c0>
add    -0x48(%rbp),%rax
mov    %rax,%rdi
lea    0xccd(%rip),%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
je     13a0 <grub_add_nouveau_nomodeset+0x1d0>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <fputs@plt>
mov    0x2c91(%rip),%rcx
cmp    (%rcx),%rax
je     14c3 <grub_add_nouveau_nomodeset+0x2f3>
mov    0x2c89(%rip),%rax
movl   $0x1,(%rax)
mov    0x2c64(%rip),%rax
mov    (%rax),%edi
lea    0xe03(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    1446 <grub_add_nouveau_nomodeset+0x276>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
jmp    1449 <grub_add_nouveau_nomodeset+0x279>
nopl   0x0(%rax,%rax,1)
mov    0x2c41(%rip),%rax
movl   $0x0,(%rax)
mov    0x2c14(%rip),%rax
mov    -0x2c(%rbp),%ecx
cmp    (%rax),%ecx
ja     13d2 <grub_add_nouveau_nomodeset+0x202>
mov    %r12,%rdi
mov    %r15,%rsi
mov    -0x48(%rbp),%rbx
mov    %rbx,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%r12,%rbx,1)
mov    -0x50(%rbp),%r13
cmpb   $0x20,0x0(%r13)
jne    1400 <grub_add_nouveau_nomodeset+0x230>
mov    %r12,%rdi
lea    0xddb(%rip),%rsi
mov    $0x1,%edx
call   1080 <strncat@plt>
mov    %r12,%rdi
lea    0xc05(%rip),%rsi
mov    -0x30(%rbp),%edx
jmp    1421 <grub_add_nouveau_nomodeset+0x251>
mov    %r12,%rdi
lea    0xbf6(%rip),%rsi
mov    -0x30(%rbp),%edx
call   1080 <strncat@plt>
mov    %r12,%rdi
lea    0xda6(%rip),%rsi
mov    $0x1,%edx
call   1080 <strncat@plt>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1080 <strncat@plt>
mov    -0x40(%rbp),%rbx
lea    0xbcc(%rip),%r13
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <fputs@plt>
mov    0x2b88(%rip),%rcx
cmp    (%rcx),%rax
je     14c3 <grub_add_nouveau_nomodeset+0x2f3>
mov    %r15,%rdi
mov    %r14d,%esi
mov    -0x38(%rbp),%rdx
call   1090 <fgets@plt>
test   %rax,%rax
jne    1310 <grub_add_nouveau_nomodeset+0x140>
jmp    14f3 <grub_add_nouveau_nomodeset+0x323>
mov    0x2b52(%rip),%rax
mov    (%rax),%ebx
mov    0x2b39(%rip),%r14
mov    (%r14),%edi
call   10e0 <strerror@plt>
mov    (%r14),%ecx
lea    0xc20(%rip),%rsi
jmp    126e <grub_add_nouveau_nomodeset+0x9e>
mov    0x2b2b(%rip),%rax
mov    (%rax),%edi
lea    0xc4f(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
jmp    127a <grub_add_nouveau_nomodeset+0xaa>
mov    0x2b06(%rip),%rax
mov    (%rax),%r15d
mov    0x2aec(%rip),%r14
mov    (%r14),%edi
call   10e0 <strerror@plt>
mov    (%r14),%ecx
lea    0xc4a(%rip),%rsi
mov    %r15d,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x2add(%rip),%rax
cmpl   $0x0,(%rax)
je     1547 <grub_add_nouveau_nomodeset+0x377>
lea    0xbf6(%rip),%rdi
call   1040 <remove@plt>
test   %eax,%eax
je     1586 <grub_add_nouveau_nomodeset+0x3b6>
mov    0x2aa9(%rip),%rax
mov    (%rax),%ebx
mov    0x2a90(%rip),%r14
mov    (%r14),%edi
call   10e0 <strerror@plt>
mov    (%r14),%ecx
lea    0xcd7(%rip),%rsi
jmp    126e <grub_add_nouveau_nomodeset+0x9e>
lea    0xbbf(%rip),%rdi
lea    0xada(%rip),%rsi
call   10d0 <rename@plt>
test   %rax,%rax
je     1586 <grub_add_nouveau_nomodeset+0x3b6>
mov    0x2a6a(%rip),%rax
mov    (%rax),%ebx
mov    0x2a51(%rip),%r14
mov    (%r14),%edi
call   10e0 <strerror@plt>
mov    (%r14),%ecx
lea    0xc43(%rip),%rsi
jmp    126e <grub_add_nouveau_nomodeset+0x9e>
xor    %eax,%eax
jmp    127f <grub_add_nouveau_nomodeset+0xaf>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [18 x i8] c"nouveau.modeset=0\00"
@.str.1 = [29 x i8] c"GRUB_CMDLINE_LINUX_DEFAULT=\22\00"
@.str.2 = [18 x i8] c"/etc/default/grub\00"
@.str.3 = [34 x i8] c"/etc/default/grub.bak.nvidiaprime\00"
@stderr = global i32 0
@.str.4 = [84 x i8] c"Can't copy /etc/default/grub to /etc/default/grub.temp.nvidiaprime: %s (error: %d)\0A\00"
@errno = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [66 x i8] c"Can't open file /etc/default/grub.bak.nvidiaprime: %s (error %d)\0A\00"
@.str.7 = [35 x i8] c"/etc/default/grub.temp.nvidiaprime\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [51 x i8] c"Can't open file /etc/default/grub.temp.nvidiaprime\00"
@EOF = global i64 0
@.str.10 = [72 x i8] c"Can't write on file: /etc/default/grub.temp.nvidiaprime: %s (error %d)\0A\00"
@nouveau_nomodeset_already_installed = external global i32
@.str.11 = [74 x i8] c"/etc/default/grub already contains nouveau.modeset=0 option, skipping...\0A\00"
@.str.12 = [2 x i8] c" \00"
@.str.13 = [85 x i8] c"Can't rename /etc/default/grub.temp.nvidiaprime to /etc/default/grub: %s (error %d)\0A\00"
@.str.14 = [72 x i8] c"Warning: Can't remove file /etc/default/grub.temp.nvidiaprime: %s (%d)\0A\00"
define i32 @grub_add_nouveau_nomodeset() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = load i32, i32* @BUFSIZ
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %4
%17 = alloca i8, i64 %15
store i64 %15, i64* %5
%18 = load i32, i32* @BUFSIZ
%19 = add nsw i32 %18, 128
%20 = zext i32 %19 to i64
%21 = alloca i8, i64 %20
store i64 %20, i64* %6
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8** %8
%22 = load i8*, i8** %8
%23 = call i32 @strlen(i8* %22)
%24 = sext i32 %23 to i64
store i64 %24, i64* %10
%25 = load i8*, i8** %7
%26 = call i32 @strlen(i8* %25)
%27 = sext i32 %26 to i64
store i64 %27, i64* %11
%28 = call i64 @fcopy(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %0
%31 = load i32, i32* @stderr
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = load i32, i32* @errno
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.4, i64 0, i64 0), i8* %33, i32 %34)
store i32 1, i32* %1
store i32 1, i32* %13
br label %178
36: ; preds = %0
%37 = call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %37, i32** %2
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %45
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = load i32, i32* @errno
%42 = call i8* @strerror(i32 %41)
%43 = load i32, i32* @errno
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), i8* %42, i32 %43)
store i32 1, i32* %1
store i32 1, i32* %13
br label %178
45: ; preds = %36
%46 = call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %46, i32** %3
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.9, i64 0, i64 0))
%51 = load i32*, i32** %2
%52 = call i32 @fclose(i32* %51)
store i32 1, i32* %1
store i32 1, i32* %13
br label %178
53: ; preds = %45
br label %54
54: ; preds = %149, %53
%55 = trunc i64 %15 to i32
%56 = load i32*, i32** %2
%57 = call i32* @fgets(i8* %17, i32 %55, i32* %56)
%58 = icmp ne i32* %57, null
br i1 %58, label %59, label %150
59: ; preds = %54
store i8 0, i8* %21
%60 = load i8*, i8** %8
%61 = call i8* @strstr(i8* %17, i8* %60)
store i8* %61, i8** %9
%62 = icmp ne i8* %61, null
br i1 %62, label %63, label %137
63: ; preds = %59
%64 = load i8*, i8** %9
%65 = load i64, i64* %10
%66 = getelementptr inbounds i8, i8* %64, i64 %65
%67 = load i8*, i8** %7
%68 = call i8* @strstr(i8* %66, i8* %67)
%69 = icmp ne i8* %68, null
br i1 %69, label %70, label %84
70: ; preds = %63
%71 = load i32*, i32** %3
%72 = call i64 @fputs(i8* %17, i32* %71)
%73 = load i64, i64* @EOF
%74 = icmp eq i64 %72, %73
br i1 %74, label %75, label %81
75: ; preds = %70
%76 = load i32, i32* @stderr
%77 = load i32, i32* @errno
%78 = call i8* @strerror(i32 %77)
%79 = load i32, i32* @errno
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.10, i64 0, i64 0), i8* %78, i32 %79)
br label %150
81: ; preds = %70
store i32 1, i32* @nouveau_nomodeset_already_installed
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.11, i64 0, i64 0))
br label %125
84: ; preds = %63
store i32 0, i32* @nouveau_nomodeset_already_installed
%85 = load i64, i64* %10
%86 = load i32, i32* @BUFSIZ
%87 = sext i32 %86 to i64
%88 = icmp ule i64 %85, %87
br i1 %88, label %89, label %94
89: ; preds = %84
%90 = load i64, i64* %10
%91 = call i32 @strncpy(i8* %21, i8* %17, i64 %90)
%92 = load i64, i64* %10
%93 = getelementptr inbounds i8, i8* %21, i64 %92
store i8 0, i8* %93
br label %94
94: ; preds = %89, %84
%95 = load i64, i64* %10
%96 = getelementptr inbounds i8, i8* %17, i64 %95
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 32
br i1 %99, label %100, label %112
100: ; preds = %94
%101 = call i32 @strncat(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 1)
%102 = load i8*, i8** %7
%103 = load i64, i64* %11
%104 = trunc i64 %103 to i32
%105 = call i32 @strncat(i8* %21, i8* %102, i32 %104)
%106 = load i64, i64* %10
%107 = getelementptr inbounds i8, i8* %17, i64 %106
%108 = load i64, i64* %10
%109 = getelementptr inbounds i8, i8* %17, i64 %108
%110 = call i32 @strlen(i8* %109)
%111 = call i32 @strncat(i8* %21, i8* %107, i32 %110)
br label %124
112: ; preds = %94
%113 = load i8*, i8** %7
%114 = load i64, i64* %11
%115 = trunc i64 %114 to i32
%116 = call i32 @strncat(i8* %21, i8* %113, i32 %115)
%117 = call i32 @strncat(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 1)
%118 = load i64, i64* %10
%119 = getelementptr inbounds i8, i8* %17, i64 %118
%120 = load i64, i64* %10
%121 = getelementptr inbounds i8, i8* %17, i64 %120
%122 = call i32 @strlen(i8* %121)
%123 = call i32 @strncat(i8* %21, i8* %119, i32 %122)
br label %124
124: ; preds = %112, %100
br label %125
125: ; preds = %124, %81
%126 = load i32*, i32** %3
%127 = call i64 @fputs(i8* %21, i32* %126)
%128 = load i64, i64* @EOF
%129 = icmp eq i64 %127, %128
br i1 %129, label %130, label %136
130: ; preds = %125
%131 = load i32, i32* @stderr
%132 = load i32, i32* @errno
%133 = call i8* @strerror(i32 %132)
%134 = load i32, i32* @errno
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %131, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.10, i64 0, i64 0), i8* %133, i32 %134)
br label %150
136: ; preds = %125
br label %149
137: ; preds = %59
%138 = load i32*, i32** %3
%139 = call i64 @fputs(i8* %17, i32* %138)
%140 = load i64, i64* @EOF
%141 = icmp eq i64 %139, %140
br i1 %141, label %142, label %148
142: ; preds = %137
%143 = load i32, i32* @stderr
%144 = load i32, i32* @errno
%145 = call i8* @strerror(i32 %144)
%146 = load i32, i32* @errno
%147 = call i32 (i32, i8*, ...) @fprintf(i32 %143, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.10, i64 0, i64 0), i8* %145, i32 %146)
br label %150
148: ; preds = %137
br label %149
149: ; preds = %148, %136
br label %54
150: ; preds = %142, %130, %75, %54
%151 = load i32*, i32** %2
%152 = call i32 @fclose(i32* %151)
%153 = load i32*, i32** %3
%154 = call i32 @fclose(i32* %153)
%155 = load i32, i32* @nouveau_nomodeset_already_installed
%156 = icmp ne i32 %155, 0
br i1 %156, label %167, label %157
157: ; preds = %150
%158 = call i64 @rename(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%159 = icmp ne i64 %158, 0
br i1 %159, label %160, label %166
160: ; preds = %157
%161 = load i32, i32* @stderr
%162 = load i32, i32* @errno
%163 = call i8* @strerror(i32 %162)
%164 = load i32, i32* @errno
%165 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.13, i64 0, i64 0), i8* %163, i32 %164)
store i32 1, i32* %1
store i32 1, i32* %13
br label %178
166: ; preds = %157
br label %177
167: ; preds = %150
%168 = call i32 @remove(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
store i32 %168, i32* %12
%169 = icmp ne i32 %168, 0
br i1 %169, label %170, label %176
170: ; preds = %167
%171 = load i32, i32* @stderr
%172 = load i32, i32* @errno
%173 = call i8* @strerror(i32 %172)
%174 = load i32, i32* @errno
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %171, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.14, i64 0, i64 0), i8* %173, i32 %174)
store i32 1, i32* %1
store i32 1, i32* %13
br label %178
176: ; preds = %167
br label %177
177: ; preds = %176, %166
store i32 0, i32* %1
store i32 1, i32* %13
br label %178
178: ; preds = %177, %170, %160, %48, %39, %30
%179 = load i8*, i8** %4
%180 = load i32, i32* %1
ret i32 %180
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [18 x i8] c"nouveau.modeset=0\00"
@.str.1 = [29 x i8] c"GRUB_CMDLINE_LINUX_DEFAULT=\22\00"
@.str.2 = [18 x i8] c"/etc/default/grub\00"
@.str.3 = [34 x i8] c"/etc/default/grub.bak.nvidiaprime\00"
@stderr = global i32 0
@.str.4 = [84 x i8] c"Can't copy /etc/default/grub to /etc/default/grub.temp.nvidiaprime: %s (error: %d)\0A\00"
@errno = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [66 x i8] c"Can't open file /etc/default/grub.bak.nvidiaprime: %s (error %d)\0A\00"
@.str.7 = [35 x i8] c"/etc/default/grub.temp.nvidiaprime\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [51 x i8] c"Can't open file /etc/default/grub.temp.nvidiaprime\00"
@EOF = global i64 0
@.str.10 = [72 x i8] c"Can't write on file: /etc/default/grub.temp.nvidiaprime: %s (error %d)\0A\00"
@nouveau_nomodeset_already_installed = external global i32
@.str.11 = [74 x i8] c"/etc/default/grub already contains nouveau.modeset=0 option, skipping...\0A\00"
@.str.12 = [2 x i8] c" \00"
@.str.13 = [85 x i8] c"Can't rename /etc/default/grub.temp.nvidiaprime to /etc/default/grub: %s (error %d)\0A\00"
@.str.14 = [72 x i8] c"Warning: Can't remove file /etc/default/grub.temp.nvidiaprime: %s (%d)\0A\00"
define i32 @grub_add_nouveau_nomodeset() {
%1 = load i32, i32* @BUFSIZ
%2 = zext i32 %1 to i64
%3 = alloca i8, i64 %2
%4 = add nsw i32 %1, 128
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%8 = sext i32 %7 to i64
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = tail call i64 @fcopy(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %0
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = tail call i8* @strerror(i32 %14)
%16 = load i32, i32* @errno
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.4, i64 0, i64 0), i8* %15, i32 %16)
br label %112
18: ; preds = %0
%19 = tail call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = load i32, i32* @errno
%24 = tail call i8* @strerror(i32 %23)
%25 = load i32, i32* @errno
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), i8* %24, i32 %25)
br label %112
27: ; preds = %18
%28 = tail call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %36, label %30
30: ; preds = %27
%31 = call i32* @fgets(i8* %3, i32 %1, i32* %19)
%32 = icmp eq i32* %31, null
br i1 %32, label %89, label %33
33: ; preds = %30
%34 = getelementptr inbounds i8, i8* %6, i64 %8
%35 = getelementptr inbounds i8, i8* %3, i64 %8
br label %40
36: ; preds = %27
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.9, i64 0, i64 0))
%39 = tail call i32 @fclose(i32* %19)
br label %112
40: ; preds = %33, %80
store i8 0, i8* %6
%41 = call i8* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp eq i8* %41, null
br i1 %42, label %76, label %43
43: ; preds = %40
%44 = getelementptr inbounds i8, i8* %41, i64 %8
%45 = call i8* @strstr(i8* %44, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%46 = icmp eq i8* %45, null
br i1 %46, label %54, label %47
47: ; preds = %43
%48 = call i64 @fputs(i8* %3, i32* %28)
%49 = load i64, i64* @EOF
%50 = icmp eq i64 %48, %49
br i1 %50, label %83, label %51
51: ; preds = %47
store i32 1, i32* @nouveau_nomodeset_already_installed
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.11, i64 0, i64 0))
br label %72
54: ; preds = %43
store i32 0, i32* @nouveau_nomodeset_already_installed
%55 = load i32, i32* @BUFSIZ
%56 = icmp ugt i32 %7, %55
br i1 %56, label %59, label %57
57: ; preds = %54
%58 = call i32 @strncpy(i8* %6, i8* %3, i64 %8)
store i8 0, i8* %34
br label %59
59: ; preds = %57, %54
%60 = load i8, i8* %35
%61 = icmp eq i8 %60, 32
br i1 %61, label %62, label %67
62: ; preds = %59
%63 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 1)
%64 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %9)
%65 = call i32 @strlen(i8* %35)
%66 = call i32 @strncat(i8* %6, i8* %35, i32 %65)
br label %72
67: ; preds = %59
%68 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %9)
%69 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 1)
%70 = call i32 @strlen(i8* %35)
%71 = call i32 @strncat(i8* %6, i8* %35, i32 %70)
br label %72
72: ; preds = %62, %67, %51
%73 = call i64 @fputs(i8* %6, i32* %28)
%74 = load i64, i64* @EOF
%75 = icmp eq i64 %73, %74
br i1 %75, label %83, label %80
76: ; preds = %40
%77 = call i64 @fputs(i8* %3, i32* %28)
%78 = load i64, i64* @EOF
%79 = icmp eq i64 %77, %78
br i1 %79, label %83, label %80
80: ; preds = %76, %72
%81 = call i32* @fgets(i8* %3, i32 %1, i32* %19)
%82 = icmp eq i32* %81, null
br i1 %82, label %89, label %40
83: ; preds = %76, %72, %47
%84 = load i32, i32* @stderr
%85 = load i32, i32* @errno
%86 = call i8* @strerror(i32 %85)
%87 = load i32, i32* @errno
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.10, i64 0, i64 0), i8* %86, i32 %87)
br label %89
89: ; preds = %80, %83, %30
%90 = call i32 @fclose(i32* %19)
%91 = call i32 @fclose(i32* %28)
%92 = load i32, i32* @nouveau_nomodeset_already_installed
%93 = icmp eq i32 %92, 0
br i1 %93, label %94, label %103
94: ; preds = %89
%95 = call i64 @rename(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%96 = icmp eq i64 %95, 0
br i1 %96, label %112, label %97
97: ; preds = %94
%98 = load i32, i32* @stderr
%99 = load i32, i32* @errno
%100 = call i8* @strerror(i32 %99)
%101 = load i32, i32* @errno
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.13, i64 0, i64 0), i8* %100, i32 %101)
br label %112
103: ; preds = %89
%104 = call i32 @remove(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
%105 = icmp eq i32 %104, 0
br i1 %105, label %112, label %106
106: ; preds = %103
%107 = load i32, i32* @stderr
%108 = load i32, i32* @errno
%109 = call i8* @strerror(i32 %108)
%110 = load i32, i32* @errno
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.14, i64 0, i64 0), i8* %109, i32 %110)
br label %112
112: ; preds = %94, %103, %106, %97, %36, %21, %12
%113 = phi i32 [ 1, %12 ], [ 1, %21 ], [ 1, %36 ], [ 1, %106 ], [ 1, %97 ], [ 0, %103 ], [ 0, %94 ]
ret i32 %113
}