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

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ getpid();
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strtol(char *, int /*<<< orphan*/ *, int);
int system(char *);
int /*<<< orphan*/ usleep(int);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  FILE *pid_file = fopen("/tmp/blink.pid", "w");
  do {
    if (!(pid_file != NULL)) {
      fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              44, "pid_file != NULL", strerror(errno));
      abort();
    }
  } while (0);
  fprintf(pid_file, "%ld\n", (long)getpid());
  fclose(pid_file);
  int ton;
  int toff;
  if (argc > 2) {
    ton = strtol(argv[1], NULL, 10);
    toff = strtol(argv[2], NULL, 10);
  } else {
    ton = 1000000;
    toff = ton;
  }
  int exp_fd = open("/sys/class/gpio/export", O_WRONLY);
  do {
    if (!(exp_fd != -1)) {
      fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              62, "exp_fd != -1", strerror(errno));
      abort();
    }
  } while (0);
  int wlen = write(exp_fd, "415", 4);
  do {
    if (!(wlen == 4)) {
      fprintf(stderr, "%s:%d, Warning, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              64, "wlen == 4", strerror(errno));
    }
  } while (0);
  close(exp_fd);
  int dir_fd = open("/sys/class/gpio/gpio415/direction", O_RDWR);
  do {
    if (!(dir_fd != -1)) {
      fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              67, "dir_fd != -1", strerror(errno));
      abort();
    }
  } while (0);
  wlen = write(dir_fd, "in", 3);
  do {
    if (!(wlen == 3)) {
      fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              68, "wlen == 3", strerror(errno));
      abort();
    }
  } while (0);
  close(dir_fd);
  int led = 0;
  char readbuf[99] = "";
  do {
    if (led) {
      int status = system("/usr/sbin/i2cset -f -y 0 0x34 0x93 0x1");
      do {
        if (!(status == 0)) {
          fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/fordsfords/blink/refs/"
                  "heads/master/blink.c",
                  75, "status == 0", strerror(errno));
          abort();
        }
      } while (0);
    } else {
      int status = system("/usr/sbin/i2cset -f -y 0 0x34 0x93 0x0");
      do {
        if (!(status == 0)) {
          fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/fordsfords/blink/refs/"
                  "heads/master/blink.c",
                  77, "status == 0", strerror(errno));
          abort();
        }
      } while (0);
    }
    led = !led;
    int val_fd = open("/sys/class/gpio/gpio415/value", O_RDWR);
    do {
      if (!(val_fd != -1)) {
        fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/"
                "master/blink.c",
                81, "val_fd != -1", strerror(errno));
        abort();
      }
    } while (0);
    int rlen = read(val_fd, readbuf, sizeof(readbuf));
    do {
      if (!(rlen > 0)) {
        fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/"
                "master/blink.c",
                82, "rlen > 0", strerror(errno));
        abort();
      }
    } while (0);
    close(val_fd);
    if (led) {
      usleep(toff);
    } else {
      usleep(ton);
    }
  } while (readbuf[0] == '1');
  exp_fd = open("/sys/class/gpio/unexport", O_WRONLY);
  do {
    if (!(exp_fd != -1)) {
      fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              91, "exp_fd != -1", strerror(errno));
      abort();
    }
  } while (0);
  wlen = write(exp_fd, "415", 4);
  do {
    if (!(wlen == 4)) {
      fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              92, "wlen == 4", strerror(errno));
      abort();
    }
  } while (0);
  close(exp_fd);
  int status = system("/sbin/shutdown now");
  do {
    if (!(status == 0)) {
      fprintf(stderr, "%s:%d, Error, expected '%s' to be true (%s)\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/"
              "blink.c",
              95, "status == 0", strerror(errno));
      abort();
    }
  } while (0);
  sleep(5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xdf0(%rip),%rdi
lea    0x1015(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1279 <main+0x89>
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb8(%rbp)
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xb8(%rbp),%edi
mov    %rax,%r9
lea    0xdb7(%rip),%rsi
lea    0xddd(%rip),%rdx
mov    $0x2c,%ecx
lea    0xe56(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    127e <main+0x8e>
mov    -0x18(%rbp),%rax
mov    %eax,-0xbc(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0xbc(%rbp),%edi
mov    %rax,%rdx
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
cmpl   $0x2,-0x8(%rbp)
jle    12f0 <main+0x100>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10c0 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10c0 <strtol@plt>
mov    %eax,-0x20(%rbp)
jmp    12fd <main+0x10d>
movl   $0xf4240,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%esi
lea    0xdca(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    136d <main+0x17d>
mov    0x2cb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc0(%rbp)
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xc0(%rbp),%edi
mov    %rax,%r9
lea    0xcc3(%rip),%rsi
lea    0xce9(%rip),%rdx
mov    $0x3e,%ecx
lea    0xd8f(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1372 <main+0x182>
mov    -0x24(%rbp),%edi
lea    0xd7f(%rip),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
je     13da <main+0x1ea>
mov    0x2c3e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
mov    0x2c27(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xc4(%rbp),%edi
mov    %rax,%r9
lea    0xd3f(%rip),%rsi
lea    0xc75(%rip),%rdx
mov    $0x40,%ecx
lea    0xd5b(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    13df <main+0x1ef>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    0x2bfa(%rip),%rax
mov    (%rax),%esi
lea    0xd41(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    1457 <main+0x267>
mov    0x2bc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc8(%rbp)
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xc8(%rbp),%edi
mov    %rax,%r9
lea    0xbd9(%rip),%rsi
lea    0xbff(%rip),%rdx
mov    $0x43,%ecx
lea    0xd11(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    145c <main+0x26c>
mov    -0x2c(%rbp),%edi
lea    0xd01(%rip),%rsi
mov    $0x3,%edx
call   1040 <write@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
je     14cb <main+0x2db>
mov    0x2b54(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xcc(%rbp)
mov    0x2b3d(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xcc(%rbp),%edi
mov    %rax,%r9
lea    0xb65(%rip),%rsi
lea    0xb8b(%rip),%rdx
mov    $0x44,%ecx
lea    0xcad(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    14d0 <main+0x2e0>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x30(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1080 <memset@plt>
cmpl   $0x0,-0x30(%rbp)
je     1573 <main+0x383>
lea    0xc71(%rip),%rdi
call   1070 <system@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0x0,-0xa4(%rbp)
je     1569 <main+0x379>
mov    0x2ab6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd0(%rbp)
mov    0x2a9f(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xd0(%rbp),%edi
mov    %rax,%r9
lea    0xac7(%rip),%rsi
lea    0xaed(%rip),%rdx
mov    $0x4b,%ecx
lea    0xc40(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    156e <main+0x37e>
jmp    15ea <main+0x3fa>
lea    0xc2d(%rip),%rdi
call   1070 <system@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
je     15e0 <main+0x3f0>
mov    0x2a3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd4(%rbp)
mov    0x2a28(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xd4(%rbp),%edi
mov    %rax,%r9
lea    0xa50(%rip),%rsi
lea    0xa76(%rip),%rdx
mov    $0x4d,%ecx
lea    0xbc9(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    15e5 <main+0x3f5>
jmp    15ea <main+0x3fa>
cmpl   $0x0,-0x30(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x30(%rbp)
mov    0x29e6(%rip),%rax
mov    (%rax),%esi
lea    0xbc3(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,-0xac(%rbp)
cmpl   $0xffffffff,-0xac(%rbp)
jne    1671 <main+0x481>
mov    0x29ae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd8(%rbp)
mov    0x2997(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xd8(%rbp),%edi
mov    %rax,%r9
lea    0x9bf(%rip),%rsi
lea    0x9e5(%rip),%rdx
mov    $0x51,%ecx
lea    0xb89(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1676 <main+0x486>
mov    -0xac(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x63,%edx
call   10a0 <read@plt>
mov    %eax,-0xb0(%rbp)
cmpl   $0x0,-0xb0(%rbp)
jg     16ee <main+0x4fe>
mov    0x2931(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xdc(%rbp)
mov    0x291a(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xdc(%rbp),%edi
mov    %rax,%r9
lea    0x942(%rip),%rsi
lea    0x968(%rip),%rdx
mov    $0x52,%ecx
lea    0xb19(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    16f3 <main+0x503>
mov    -0xac(%rbp),%edi
call   1090 <close@plt>
cmpl   $0x0,-0x30(%rbp)
je     1715 <main+0x525>
mov    -0x20(%rbp),%edi
call   1110 <usleep@plt>
jmp    171d <main+0x52d>
mov    -0x1c(%rbp),%edi
call   1110 <usleep@plt>
jmp    1722 <main+0x532>
movsbl -0xa0(%rbp),%eax
cmp    $0x31,%eax
je     14f2 <main+0x302>
mov    0x2887(%rip),%rax
mov    (%rax),%esi
lea    0xac0(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    17a2 <main+0x5b2>
mov    0x287d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe0(%rbp)
mov    0x2866(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xe0(%rbp),%edi
mov    %rax,%r9
lea    0x88e(%rip),%rsi
lea    0x8b4(%rip),%rdx
mov    $0x5b,%ecx
lea    0x95a(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    17a7 <main+0x5b7>
mov    -0x24(%rbp),%edi
lea    0x94a(%rip),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
je     1816 <main+0x626>
mov    0x2809(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe4(%rbp)
mov    0x27f2(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xe4(%rbp),%edi
mov    %rax,%r9
lea    0x81a(%rip),%rsi
lea    0x840(%rip),%rdx
mov    $0x5c,%ecx
lea    0x926(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    181b <main+0x62b>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
lea    0x9f1(%rip),%rdi
call   1070 <system@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0xb4(%rbp)
je     1890 <main+0x6a0>
mov    0x278f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe8(%rbp)
mov    0x2778(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xe8(%rbp),%edi
mov    %rax,%r9
lea    0x7a0(%rip),%rsi
lea    0x7c6(%rip),%rdx
mov    $0x5f,%ecx
lea    0x919(%rip),%r8
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1895 <main+0x6a5>
mov    $0x5,%edi
call   1100 <sleep@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xe06(%rip),%rdi
lea    0x102b(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     155d <main+0x37d>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xeb2(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    $0xf4240,%r12d
movl   $0xf4240,0xc(%rsp)
cmp    $0x3,%ebp
jl     126e <main+0x8e>
mov    0x8(%r14),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
mov    %eax,0xc(%rsp)
mov    0x10(%r14),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
mov    %eax,%r12d
mov    0x2d4b(%rip),%rax
mov    (%rax),%esi
lea    0xe59(%rip),%rdi
call   10c0 <open@plt>
cmp    $0xffffffff,%eax
je     1592 <main+0x3b2>
mov    %eax,%ebx
lea    0xe66(%rip),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1040 <write@plt>
cmp    $0x4,%eax
je     12e3 <main+0x103>
mov    0x2d2b(%rip),%rax
mov    (%rax),%ebp
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xe3b(%rip),%rsi
lea    0xd71(%rip),%rdx
lea    0xe5c(%rip),%r8
mov    %ebp,%edi
mov    $0x40,%ecx
mov    %rax,%r9
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %ebx,%edi
call   1080 <close@plt>
mov    0x2cf7(%rip),%rax
mov    (%rax),%esi
lea    0xe3e(%rip),%rdi
call   10c0 <open@plt>
cmp    $0xffffffff,%eax
je     15c7 <main+0x3e7>
mov    %eax,%ebx
lea    0xe56(%rip),%rsi
mov    %eax,%edi
mov    $0x3,%edx
call   1040 <write@plt>
cmp    $0x3,%eax
jne    15ff <main+0x41f>
mov    %ebx,%edi
call   1080 <close@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x6f(%rsp)
xor    %r15d,%r15d
lea    0xe6e(%rip),%rbx
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
test   %r15d,%r15d
je     1390 <main+0x1b0>
lea    0xdf8(%rip),%rdi
call   1070 <system@plt>
test   %eax,%eax
je     13a4 <main+0x1c4>
jmp    14e4 <main+0x304>
nopw   0x0(%rax,%rax,1)
lea    0xe10(%rip),%rdi
call   1070 <system@plt>
test   %eax,%eax
jne    1519 <main+0x339>
mov    0x2c3d(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10c0 <open@plt>
cmp    $0xffffffff,%eax
je     1477 <main+0x297>
mov    %eax,%r14d
mov    %eax,%edi
mov    %rbp,%rsi
mov    $0x63,%edx
call   1090 <read@plt>
test   %eax,%eax
jle    14af <main+0x2cf>
mov    %r15d,%r13d
xor    $0x1,%r13d
mov    %r14d,%edi
call   1080 <close@plt>
test   %r15d,%r15d
mov    0xc(%rsp),%edi
cmove  %r12d,%edi
call   1100 <usleep@plt>
cmpb   $0x31,0x10(%rsp)
mov    %r13d,%r15d
je     1370 <main+0x190>
mov    0x2bb4(%rip),%rax
mov    (%rax),%esi
lea    0xded(%rip),%rdi
call   10c0 <open@plt>
cmp    $0xffffffff,%eax
je     1637 <main+0x457>
mov    %eax,%ebx
lea    0xccf(%rip),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1040 <write@plt>
cmp    $0x4,%eax
jne    166f <main+0x48f>
mov    %ebx,%edi
call   1080 <close@plt>
lea    0xdcc(%rip),%rdi
call   1070 <system@plt>
test   %eax,%eax
jne    16a7 <main+0x4c7>
mov    $0x5,%edi
call   10f0 <sleep@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b5a(%rip),%rax
mov    (%rax),%ebx
mov    0x2b49(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xb7a(%rip),%rsi
lea    0xba0(%rip),%rdx
lea    0xd49(%rip),%r8
mov    %ebx,%edi
mov    $0x51,%ecx
jmp    154c <main+0x36c>
mov    0x2b22(%rip),%rax
mov    (%rax),%ebx
mov    0x2b11(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xb42(%rip),%rsi
lea    0xb68(%rip),%rdx
lea    0xd1e(%rip),%r8
mov    %ebx,%edi
mov    $0x52,%ecx
jmp    154c <main+0x36c>
mov    0x2aed(%rip),%rax
mov    (%rax),%ebx
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xb0d(%rip),%rsi
lea    0xb33(%rip),%rdx
lea    0xc8b(%rip),%r8
mov    %ebx,%edi
mov    $0x4b,%ecx
jmp    154c <main+0x36c>
mov    0x2ab8(%rip),%rax
mov    (%rax),%ebx
mov    0x2aa7(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xad8(%rip),%rsi
lea    0xafe(%rip),%rdx
lea    0xc56(%rip),%r8
mov    %ebx,%edi
mov    $0x4d,%ecx
mov    %rax,%r9
xor    %eax,%eax
call   10a0 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>
mov    0x2a74(%rip),%rax
mov    (%rax),%ebx
mov    0x2a63(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xa94(%rip),%rsi
lea    0xaba(%rip),%rdx
lea    0xb38(%rip),%r8
mov    %ebx,%edi
mov    $0x2c,%ecx
jmp    154c <main+0x36c>
mov    0x2a3f(%rip),%rax
mov    (%rax),%ebx
mov    0x2a2e(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xa5f(%rip),%rsi
lea    0xa85(%rip),%rdx
lea    0xb30(%rip),%r8
mov    %ebx,%edi
mov    $0x3e,%ecx
jmp    154c <main+0x36c>
mov    0x2a0a(%rip),%rax
mov    (%rax),%ebx
mov    0x29f9(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xa2a(%rip),%rsi
lea    0xa50(%rip),%rdx
lea    0xb67(%rip),%r8
mov    %ebx,%edi
mov    $0x43,%ecx
jmp    154c <main+0x36c>
mov    0x29d2(%rip),%rax
mov    (%rax),%ebx
mov    0x29c1(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0x9f2(%rip),%rsi
lea    0xa18(%rip),%rdx
lea    0xb3f(%rip),%r8
mov    %ebx,%edi
mov    $0x44,%ecx
jmp    154c <main+0x36c>
mov    0x299a(%rip),%rax
mov    (%rax),%ebx
mov    0x2989(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0x9ba(%rip),%rsi
lea    0x9e0(%rip),%rdx
lea    0xa8b(%rip),%r8
mov    %ebx,%edi
mov    $0x5b,%ecx
jmp    154c <main+0x36c>
mov    0x2962(%rip),%rax
mov    (%rax),%ebx
mov    0x2951(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0x982(%rip),%rsi
lea    0x9a8(%rip),%rdx
lea    0xa93(%rip),%r8
mov    %ebx,%edi
mov    $0x5c,%ecx
jmp    154c <main+0x36c>
mov    0x292a(%rip),%rax
mov    (%rax),%ebx
mov    0x2919(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0x94a(%rip),%rsi
lea    0x970(%rip),%rdx
lea    0xac8(%rip),%r8
mov    %ebx,%edi
mov    $0x5f,%ecx
jmp    154c <main+0x36c>

LLVM IR (-O0):
@.str = [15 x i8] c"/tmp/blink.pid\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [45 x i8] c"%s:%d, Error, expected '%s' to be true (%s)\0A\00"
@.str.3 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/blink.c\00"
@.str.4 = [17 x i8] c"pid_file != NULL\00"
@errno = global i32 0
@.str.5 = [5 x i8] c"%ld\0A\00"
@.str.6 = [23 x i8] c"/sys/class/gpio/export\00"
@O_WRONLY = global i32 0
@.str.7 = [13 x i8] c"exp_fd != -1\00"
@.str.8 = [4 x i8] c"415\00"
@.str.9 = [47 x i8] c"%s:%d, Warning, expected '%s' to be true (%s)\0A\00"
@.str.10 = [10 x i8] c"wlen == 4\00"
@.str.11 = [34 x i8] c"/sys/class/gpio/gpio415/direction\00"
@O_RDWR = global i32 0
@.str.12 = [13 x i8] c"dir_fd != -1\00"
@.str.13 = [3 x i8] c"in\00"
@.str.14 = [10 x i8] c"wlen == 3\00"
@.str.15 = [39 x i8] c"/usr/sbin/i2cset -f -y 0 0x34 0x93 0x1\00"
@.str.16 = [12 x i8] c"status == 0\00"
@.str.17 = [39 x i8] c"/usr/sbin/i2cset -f -y 0 0x34 0x93 0x0\00"
@.str.18 = [30 x i8] c"/sys/class/gpio/gpio415/value\00"
@.str.19 = [13 x i8] c"val_fd != -1\00"
@.str.20 = [9 x i8] c"rlen > 0\00"
@.str.21 = [25 x i8] c"/sys/class/gpio/unexport\00"
@.str.22 = [19 x i8] c"/sbin/shutdown now\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [99 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
br label %20
20: ; preds = %2
%21 = load i32*, i32** %6
%22 = icmp ne i32* %21, null
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = load i32, i32* @errno
%26 = call i8* @strerror(i32 %25)
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %20
br label %30
30: ; preds = %29
%31 = load i32*, i32** %6
%32 = ptrtoint i32* %31 to i32
%33 = call i64 (...) @getpid()
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 %33)
%35 = load i32*, i32** %6
%36 = call i32 @fclose(i32* %35)
%37 = load i32, i32* %4
%38 = icmp sgt i32 %37, 2
br i1 %38, label %39, label %48
39: ; preds = %30
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @strtol(i8* %42, i32* null, i32 10)
store i32 %43, i32* %7
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @strtol(i8* %46, i32* null, i32 10)
store i32 %47, i32* %8
br label %50
48: ; preds = %30
store i32 1000000, i32* %7
%49 = load i32, i32* %7
store i32 %49, i32* %8
br label %50
50: ; preds = %48, %39
%51 = load i32, i32* @O_WRONLY
%52 = call i32 @open(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %51)
store i32 %52, i32* %9
br label %53
53: ; preds = %50
%54 = load i32, i32* %9
%55 = icmp ne i32 %54, -1
br i1 %55, label %62, label %56
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = load i32, i32* @errno
%59 = call i8* @strerror(i32 %58)
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 62, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %59)
%61 = call i32 (...) @abort()
unreachable
62: ; preds = %53
br label %63
63: ; preds = %62
%64 = load i32, i32* %9
%65 = call i32 @write(i32 %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 4)
store i32 %65, i32* %10
br label %66
66: ; preds = %63
%67 = load i32, i32* %10
%68 = icmp eq i32 %67, 4
br i1 %68, label %74, label %69
69: ; preds = %66
%70 = load i32, i32* @stderr
%71 = load i32, i32* @errno
%72 = call i8* @strerror(i32 %71)
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %72)
br label %74
74: ; preds = %69, %66
br label %75
75: ; preds = %74
%76 = load i32, i32* %9
%77 = call i32 @close(i32 %76)
%78 = load i32, i32* @O_RDWR
%79 = call i32 @open(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i32 %78)
store i32 %79, i32* %11
br label %80
80: ; preds = %75
%81 = load i32, i32* %11
%82 = icmp ne i32 %81, -1
br i1 %82, label %89, label %83
83: ; preds = %80
%84 = load i32, i32* @stderr
%85 = load i32, i32* @errno
%86 = call i8* @strerror(i32 %85)
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 67, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8* %86)
%88 = call i32 (...) @abort()
unreachable
89: ; preds = %80
br label %90
90: ; preds = %89
%91 = load i32, i32* %11
%92 = call i32 @write(i32 %91, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 3)
store i32 %92, i32* %10
br label %93
93: ; preds = %90
%94 = load i32, i32* %10
%95 = icmp eq i32 %94, 3
br i1 %95, label %102, label %96
96: ; preds = %93
%97 = load i32, i32* @stderr
%98 = load i32, i32* @errno
%99 = call i8* @strerror(i32 %98)
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 68, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0), i8* %99)
%101 = call i32 (...) @abort()
unreachable
102: ; preds = %93
br label %103
103: ; preds = %102
%104 = load i32, i32* %11
%105 = call i32 @close(i32 %104)
store i32 0, i32* %12
%106 = bitcast [99 x i8]* %13 to i8*
br label %107
107: ; preds = %179, %103
%108 = load i32, i32* %12
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %123
110: ; preds = %107
%111 = call i32 @system(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
store i32 %111, i32* %14
br label %112
112: ; preds = %110
%113 = load i32, i32* %14
%114 = icmp eq i32 %113, 0
br i1 %114, label %121, label %115
115: ; preds = %112
%116 = load i32, i32* @stderr
%117 = load i32, i32* @errno
%118 = call i8* @strerror(i32 %117)
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 75, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %118)
%120 = call i32 (...) @abort()
unreachable
121: ; preds = %112
br label %122
122: ; preds = %121
br label %136
123: ; preds = %107
%124 = call i32 @system(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0))
store i32 %124, i32* %15
br label %125
125: ; preds = %123
%126 = load i32, i32* %15
%127 = icmp eq i32 %126, 0
br i1 %127, label %134, label %128
128: ; preds = %125
%129 = load i32, i32* @stderr
%130 = load i32, i32* @errno
%131 = call i8* @strerror(i32 %130)
%132 = call i32 (i32, i8*, ...) @fprintf(i32 %129, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 77, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %131)
%133 = call i32 (...) @abort()
unreachable
134: ; preds = %125
br label %135
135: ; preds = %134
br label %136
136: ; preds = %135, %122
%137 = load i32, i32* %12
%138 = icmp ne i32 %137, 0
%139 = xor i1 %138, true
%140 = zext i1 %139 to i32
store i32 %140, i32* %12
%141 = load i32, i32* @O_RDWR
%142 = call i32 @open(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0), i32 %141)
store i32 %142, i32* %16
br label %143
143: ; preds = %136
%144 = load i32, i32* %16
%145 = icmp ne i32 %144, -1
br i1 %145, label %152, label %146
146: ; preds = %143
%147 = load i32, i32* @stderr
%148 = load i32, i32* @errno
%149 = call i8* @strerror(i32 %148)
%150 = call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i8* %149)
%151 = call i32 (...) @abort()
unreachable
152: ; preds = %143
br label %153
153: ; preds = %152
%154 = load i32, i32* %16
%155 = getelementptr inbounds [99 x i8], [99 x i8]* %13, i64 0, i64 0
%156 = call i32 @read(i32 %154, i8* %155, i32 99)
store i32 %156, i32* %17
br label %157
157: ; preds = %153
%158 = load i32, i32* %17
%159 = icmp sgt i32 %158, 0
br i1 %159, label %166, label %160
160: ; preds = %157
%161 = load i32, i32* @stderr
%162 = load i32, i32* @errno
%163 = call i8* @strerror(i32 %162)
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 82, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0), i8* %163)
%165 = call i32 (...) @abort()
unreachable
166: ; preds = %157
br label %167
167: ; preds = %166
%168 = load i32, i32* %16
%169 = call i32 @close(i32 %168)
%170 = load i32, i32* %12
%171 = icmp ne i32 %170, 0
br i1 %171, label %172, label %175
172: ; preds = %167
%173 = load i32, i32* %8
%174 = call i32 @usleep(i32 %173)
br label %178
175: ; preds = %167
%176 = load i32, i32* %7
%177 = call i32 @usleep(i32 %176)
br label %178
178: ; preds = %175, %172
br label %179
179: ; preds = %178
%180 = getelementptr inbounds [99 x i8], [99 x i8]* %13, i64 0, i64 0
%181 = load i8, i8* %180
%182 = sext i8 %181 to i32
%183 = icmp eq i32 %182, 49
br i1 %183, label %107, label %184
184: ; preds = %179
%185 = load i32, i32* @O_WRONLY
%186 = call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0), i32 %185)
store i32 %186, i32* %9
br label %187
187: ; preds = %184
%188 = load i32, i32* %9
%189 = icmp ne i32 %188, -1
br i1 %189, label %196, label %190
190: ; preds = %187
%191 = load i32, i32* @stderr
%192 = load i32, i32* @errno
%193 = call i8* @strerror(i32 %192)
%194 = call i32 (i32, i8*, ...) @fprintf(i32 %191, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 91, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %193)
%195 = call i32 (...) @abort()
unreachable
196: ; preds = %187
br label %197
197: ; preds = %196
%198 = load i32, i32* %9
%199 = call i32 @write(i32 %198, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 4)
store i32 %199, i32* %10
br label %200
200: ; preds = %197
%201 = load i32, i32* %10
%202 = icmp eq i32 %201, 4
br i1 %202, label %209, label %203
203: ; preds = %200
%204 = load i32, i32* @stderr
%205 = load i32, i32* @errno
%206 = call i8* @strerror(i32 %205)
%207 = call i32 (i32, i8*, ...) @fprintf(i32 %204, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 92, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %206)
%208 = call i32 (...) @abort()
unreachable
209: ; preds = %200
br label %210
210: ; preds = %209
%211 = load i32, i32* %9
%212 = call i32 @close(i32 %211)
%213 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.22, i64 0, i64 0))
store i32 %213, i32* %18
br label %214
214: ; preds = %210
%215 = load i32, i32* %18
%216 = icmp eq i32 %215, 0
br i1 %216, label %223, label %217
217: ; preds = %214
%218 = load i32, i32* @stderr
%219 = load i32, i32* @errno
%220 = call i8* @strerror(i32 %219)
%221 = call i32 (i32, i8*, ...) @fprintf(i32 %218, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %220)
%222 = call i32 (...) @abort()
unreachable
223: ; preds = %214
br label %224
224: ; preds = %223
%225 = call i32 @sleep(i32 5)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"/tmp/blink.pid\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [45 x i8] c"%s:%d, Error, expected '%s' to be true (%s)\0A\00"
@.str.3 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fordsfords/blink/refs/heads/master/blink.c\00"
@.str.4 = [17 x i8] c"pid_file != NULL\00"
@errno = global i32 0
@.str.5 = [5 x i8] c"%ld\0A\00"
@.str.6 = [23 x i8] c"/sys/class/gpio/export\00"
@O_WRONLY = global i32 0
@.str.7 = [13 x i8] c"exp_fd != -1\00"
@.str.8 = [4 x i8] c"415\00"
@.str.9 = [47 x i8] c"%s:%d, Warning, expected '%s' to be true (%s)\0A\00"
@.str.10 = [10 x i8] c"wlen == 4\00"
@.str.11 = [34 x i8] c"/sys/class/gpio/gpio415/direction\00"
@O_RDWR = global i32 0
@.str.12 = [13 x i8] c"dir_fd != -1\00"
@.str.13 = [3 x i8] c"in\00"
@.str.14 = [10 x i8] c"wlen == 3\00"
@.str.15 = [39 x i8] c"/usr/sbin/i2cset -f -y 0 0x34 0x93 0x1\00"
@.str.16 = [12 x i8] c"status == 0\00"
@.str.17 = [39 x i8] c"/usr/sbin/i2cset -f -y 0 0x34 0x93 0x0\00"
@.str.18 = [30 x i8] c"/sys/class/gpio/gpio415/value\00"
@.str.19 = [13 x i8] c"val_fd != -1\00"
@.str.20 = [9 x i8] c"rlen > 0\00"
@.str.21 = [25 x i8] c"/sys/class/gpio/unexport\00"
@.str.22 = [19 x i8] c"/sbin/shutdown now\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [99 x i8]
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %2
%13 = ptrtoint i32* %4 to i64
%14 = trunc i64 %13 to i32
%15 = tail call i64 (...) @getpid()
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 %15)
%17 = tail call i32 @fclose(i32* %4)
%18 = icmp sgt i32 %0, 2
br i1 %18, label %19, label %26
19: ; preds = %12
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32 @strtol(i8* nocapture %21, i32* null, i32 10)
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = tail call i32 @strtol(i8* nocapture %24, i32* null, i32 10)
br label %26
26: ; preds = %12, %19
%27 = phi i32 [ %25, %19 ], [ 1000000, %12 ]
%28 = phi i32 [ %22, %19 ], [ 1000000, %12 ]
%29 = load i32, i32* @O_WRONLY
%30 = tail call i32 @open(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %29)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %38
32: ; preds = %26
%33 = load i32, i32* @stderr
%34 = load i32, i32* @errno
%35 = tail call i8* @strerror(i32 %34)
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 62, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %35)
%37 = tail call i32 (...) @abort()
unreachable
38: ; preds = %26
%39 = tail call i32 @write(i32 %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 4)
%40 = icmp eq i32 %39, 4
br i1 %40, label %46, label %41
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = load i32, i32* @errno
%44 = tail call i8* @strerror(i32 %43)
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %41, %38
%47 = tail call i32 @close(i32 %30)
%48 = load i32, i32* @O_RDWR
%49 = tail call i32 @open(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i32 %48)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %57
51: ; preds = %46
%52 = load i32, i32* @stderr
%53 = load i32, i32* @errno
%54 = tail call i8* @strerror(i32 %53)
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 67, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8* %54)
%56 = tail call i32 (...) @abort()
unreachable
57: ; preds = %46
%58 = tail call i32 @write(i32 %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 3)
%59 = icmp eq i32 %58, 3
br i1 %59, label %66, label %60
60: ; preds = %57
%61 = load i32, i32* @stderr
%62 = load i32, i32* @errno
%63 = tail call i8* @strerror(i32 %62)
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 68, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0), i8* %63)
%65 = tail call i32 (...) @abort()
unreachable
66: ; preds = %57
%67 = tail call i32 @close(i32 %49)
%68 = getelementptr inbounds [99 x i8], [99 x i8]* %3, i64 0, i64 0
br label %69
69: ; preds = %110, %66
%70 = phi i32 [ 0, %66 ], [ %91, %110 ]
%71 = icmp eq i32 %70, 0
br i1 %71, label %81, label %72
72: ; preds = %69
%73 = tail call i32 @system(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
%74 = icmp eq i32 %73, 0
br i1 %74, label %90, label %75
75: ; preds = %72
%76 = load i32, i32* @stderr
%77 = load i32, i32* @errno
%78 = tail call i8* @strerror(i32 %77)
%79 = tail call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 75, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %78)
%80 = tail call i32 (...) @abort()
unreachable
81: ; preds = %69
%82 = tail call i32 @system(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0))
%83 = icmp eq i32 %82, 0
br i1 %83, label %90, label %84
84: ; preds = %81
%85 = load i32, i32* @stderr
%86 = load i32, i32* @errno
%87 = tail call i8* @strerror(i32 %86)
%88 = tail call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 77, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %87)
%89 = tail call i32 (...) @abort()
unreachable
90: ; preds = %81, %72
%91 = xor i32 %70, 1
%92 = load i32, i32* @O_RDWR
%93 = tail call i32 @open(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0), i32 %92)
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %101
95: ; preds = %90
%96 = load i32, i32* @stderr
%97 = load i32, i32* @errno
%98 = tail call i8* @strerror(i32 %97)
%99 = tail call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i8* %98)
%100 = tail call i32 (...) @abort()
unreachable
101: ; preds = %90
%102 = call i32 @read(i32 %93, i8* %68, i32 99)
%103 = icmp sgt i32 %102, 0
br i1 %103, label %110, label %104
104: ; preds = %101
%105 = load i32, i32* @stderr
%106 = load i32, i32* @errno
%107 = tail call i8* @strerror(i32 %106)
%108 = tail call i32 (i32, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 82, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0), i8* %107)
%109 = tail call i32 (...) @abort()
unreachable
110: ; preds = %101
%111 = tail call i32 @close(i32 %93)
%112 = select i1 %71, i32 %27, i32 %28
%113 = tail call i32 @usleep(i32 %112)
%114 = load i8, i8* %68
%115 = icmp eq i8 %114, 49
br i1 %115, label %69, label %116
116: ; preds = %110
%117 = load i32, i32* @O_WRONLY
%118 = tail call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0), i32 %117)
%119 = icmp eq i32 %118, -1
br i1 %119, label %120, label %126
120: ; preds = %116
%121 = load i32, i32* @stderr
%122 = load i32, i32* @errno
%123 = tail call i8* @strerror(i32 %122)
%124 = tail call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 91, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %123)
%125 = tail call i32 (...) @abort()
unreachable
126: ; preds = %116
%127 = tail call i32 @write(i32 %118, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 4)
%128 = icmp eq i32 %127, 4
br i1 %128, label %135, label %129
129: ; preds = %126
%130 = load i32, i32* @stderr
%131 = load i32, i32* @errno
%132 = tail call i8* @strerror(i32 %131)
%133 = tail call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 92, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %132)
%134 = tail call i32 (...) @abort()
unreachable
135: ; preds = %126
%136 = tail call i32 @close(i32 %118)
%137 = tail call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.22, i64 0, i64 0))
%138 = icmp eq i32 %137, 0
br i1 %138, label %145, label %139
139: ; preds = %135
%140 = load i32, i32* @stderr
%141 = load i32, i32* @errno
%142 = tail call i8* @strerror(i32 %141)
%143 = tail call i32 (i32, i8*, ...) @fprintf(i32 %140, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.3, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %142)
%144 = tail call i32 (...) @abort()
unreachable
145: ; preds = %135
%146 = tail call i32 @sleep(i32 5)
ret i32 0
}