#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*/ tio;
struct termios {
  int c_cflag;
  int c_ispeed;
  int c_ospeed;
  scalar_t__ c_oflag;
  int /*<<< orphan*/ c_iflag;
};
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
int B4800;
int CLOCAL;
int CREAD;
int CS8;
int /*<<< orphan*/ IGNPAR;
int /*<<< orphan*/ O_CREAT;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ *SEM_FAILED;
int /*<<< orphan*/ TCIFLUSH;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ bzero(struct termios *, int);
int /*<<< orphan*/ close(int);
scalar_t__ createEverFlourishString(char *, char *, char *);
scalar_t__ createIkeaString(char *, char *, char *, char *, char *);
scalar_t__ createNexaString(char *, char *, char *, char *, int);
scalar_t__ createRisingSunString(char *, char *, char *, char *);
scalar_t__ createSartanoString(char *, char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printUsage();
int /*<<< orphan*/ printVersion();
int /*<<< orphan*/ sem_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ *sem_open(char *, int /*<<< orphan*/, int, int);
scalar_t__ sem_post(int /*<<< orphan*/ *);
int /*<<< orphan*/ sem_unlink(char *);
scalar_t__ sem_wait(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
scalar_t__ write(int, char *, scalar_t__);
int main(int argc, char **argv) {
  struct termios tio;
  int fd = -1;
  sem_t *portMutex;
  char SEM_NAME[] = "RFCMD_SEM";
  char txStr[100];
  if ((argc == 6) && (strcmp(*(argv + 2), "NEXA") == 0)) {
    if (createNexaString(*(argv + 3), *(argv + 4), *(argv + 5), txStr, 0) ==
        0) {
      printUsage();
      exit(1);
    }
  } else if ((argc == 6) && (strcmp(*(argv + 2), "WAVEMAN") == 0)) {
    if (createNexaString(*(argv + 3), *(argv + 4), *(argv + 5), txStr, 1) ==
        0) {
      printUsage();
      exit(1);
    }
  } else if ((argc == 5) && (strcmp(*(argv + 2), "SARTANO") == 0)) {
    if (createSartanoString(*(argv + 3), *(argv + 4), txStr) == 0) {
      printUsage();
      exit(1);
    }
  } else if ((argc == 7) && (strcmp(*(argv + 2), "IKEA") == 0)) {
    if (createIkeaString(*(argv + 3), *(argv + 4), *(argv + 5), *(argv + 6),
                         txStr) == 0) {
      printUsage();
      exit(1);
    }
  } else if ((argc == 6) && (strcmp(*(argv + 2), "RISINGSUN") == 0)) {
    if (createRisingSunString(*(argv + 3), *(argv + 4), *(argv + 5), txStr) ==
        0) {
      printUsage();
      exit(1);
    }
  } else if ((argc == 5) && (strcmp(*(argv + 2), "EVERFLOURISH") == 0)) {
    if (createEverFlourishString(*(argv + 3), *(argv + 4), txStr) == 0) {
      printUsage();
      exit(1);
    }
  } else if ((argc >= 2) && (strcmp(*(argv + 1), "--version") == 0)) {
    printVersion();
    exit(1);
  } else {
    printUsage();
    exit(1);
  }
  if (strlen(txStr) > 0) {
    portMutex = sem_open(SEM_NAME, O_CREAT, 0644, 1);
    if (portMutex == SEM_FAILED) {
      fprintf(stderr, "%s - Error creating port semaphore\n", "rfcmd");
      perror("Semaphore open error");
      sem_unlink(SEM_NAME);
      exit(1);
    }
    if (sem_wait(portMutex) != 0) {
      fprintf(stderr, "%s - Error aquiring port semaphore\n", "rfcmd");
      sem_unlink(SEM_NAME);
      sem_close(portMutex);
      exit(1);
    }
    if (strcmp(*(argv + 1), "LIBUSB") != 0) {
      if (0 > (fd = open(*(argv + 1), O_RDWR))) {
        fprintf(stderr, "%s - Error opening %s\n", "rfcmd", *(argv + 1));
        if (sem_post(portMutex) != 0) {
          fprintf(stderr, "%s - Error releasing port semaphore\n", "rfcmd");
        }
        sem_unlink(SEM_NAME);
        sem_close(portMutex);
        exit(1);
      }
      bzero(&tio, sizeof(tio));
      tio.c_cflag = B4800 | CS8 | CLOCAL | CREAD;
      tio.c_iflag = IGNPAR;
      tio.c_oflag = 0;
      tio.c_ispeed = 4800;
      tio.c_ospeed = 4800;
      tcflush(fd, TCIFLUSH);
      tcsetattr(fd, TCSANOW, &tio);
      if (write(fd, txStr, strlen(txStr)) < 0) {
        perror("Error writing to rf device");
      }
      sleep(1);
      close(fd);
    } else {
      fprintf(stderr,
              "%s - Support for libftdi is not compiled in, please recompile "
              "rfcmd with support for libftdi\n",
              "rfcmd");
    }
    if (sem_post(portMutex) != 0) {
      fprintf(stderr, "%s - Error releasing port semaphore\n", "rfcmd");
      sem_unlink(SEM_NAME);
      sem_close(portMutex);
      exit(1);
    } else {
      sem_unlink(SEM_NAME);
      sem_close(portMutex);
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x34(%rbp)
mov    0xd59(%rip),%rax
mov    %rax,-0x4a(%rbp)
mov    0xd56(%rip),%ax
mov    %ax,-0x42(%rbp)
cmpl   $0x6,-0x8(%rbp)
jne    1325 <main+0xa5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd3b(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1325 <main+0xa5>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    -0xb0(%rbp),%rcx
xor    %r8d,%r8d
call   10f0 <createNexaString@plt>
cmp    $0x0,%rax
jne    1320 <main+0xa0>
mov    $0x0,%al
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    15a2 <main+0x322>
cmpl   $0x6,-0x8(%rbp)
jne    1397 <main+0x117>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xcd1(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1397 <main+0x117>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    -0xb0(%rbp),%rcx
mov    $0x1,%r8d
call   10f0 <createNexaString@plt>
cmp    $0x0,%rax
jne    1392 <main+0x112>
mov    $0x0,%al
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    159d <main+0x31d>
cmpl   $0x5,-0x8(%rbp)
jne    13fb <main+0x17b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xc67(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13fb <main+0x17b>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
lea    -0xb0(%rbp),%rdx
call   11a0 <createSartanoString@plt>
cmp    $0x0,%rax
jne    13f6 <main+0x176>
mov    $0x0,%al
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    1598 <main+0x318>
cmpl   $0x7,-0x8(%rbp)
jne    146f <main+0x1ef>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xc0b(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    146f <main+0x1ef>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rcx
lea    -0xb0(%rbp),%r8
call   1030 <createIkeaString@plt>
cmp    $0x0,%rax
jne    146a <main+0x1ea>
mov    $0x0,%al
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    1593 <main+0x313>
cmpl   $0x6,-0x8(%rbp)
jne    14db <main+0x25b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xb9c(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    14db <main+0x25b>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    -0xb0(%rbp),%rcx
call   10e0 <createRisingSunString@plt>
cmp    $0x0,%rax
jne    14d6 <main+0x256>
mov    $0x0,%al
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    158e <main+0x30e>
cmpl   $0x5,-0x8(%rbp)
jne    153f <main+0x2bf>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xb3a(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    153f <main+0x2bf>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
lea    -0xb0(%rbp),%rdx
call   1170 <createEverFlourishString@plt>
cmp    $0x0,%rax
jne    153a <main+0x2ba>
mov    $0x0,%al
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    1589 <main+0x309>
cmpl   $0x2,-0x8(%rbp)
jl     1578 <main+0x2f8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xae3(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1578 <main+0x2f8>
mov    $0x0,%al
call   10d0 <printVersion@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    $0x0,%al
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    158e <main+0x30e>
jmp    1593 <main+0x313>
jmp    1598 <main+0x318>
jmp    159d <main+0x31d>
jmp    15a2 <main+0x322>
lea    -0xb0(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%rax
jle    1890 <main+0x610>
lea    -0x4a(%rbp),%rdi
mov    0x2a35(%rip),%rax
mov    (%rax),%esi
mov    $0x1a4,%edx
mov    $0x1,%ecx
call   10b0 <sem_open@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    0x29f5(%rip),%rcx
cmp    (%rcx),%rax
jne    1629 <main+0x3a9>
mov    0x29ad(%rip),%rax
mov    (%rax),%edi
lea    0xa49(%rip),%rsi
lea    0xa66(%rip),%rdx
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    0xa5e(%rip),%rdi
call   1140 <perror@plt>
lea    -0x4a(%rbp),%rdi
call   1190 <sem_unlink@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x40(%rbp),%rdi
call   1040 <sem_wait@plt>
cmp    $0x0,%rax
je     1676 <main+0x3f6>
mov    0x295d(%rip),%rax
mov    (%rax),%edi
lea    0xa38(%rip),%rsi
lea    0xa16(%rip),%rdx
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    -0x4a(%rbp),%rdi
call   1190 <sem_unlink@plt>
mov    -0x40(%rbp),%rdi
call   1130 <sem_close@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xa23(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     180e <main+0x58e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x293d(%rip),%rax
mov    (%rax),%esi
call   1120 <open@plt>
mov    %eax,%ecx
mov    %ecx,-0x34(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    172c <main+0x4ac>
mov    0x28e0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0x9de(%rip),%rsi
lea    0x991(%rip),%rdx
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1090 <sem_post@plt>
cmp    $0x0,%rax
je     1710 <main+0x490>
mov    0x28a7(%rip),%rax
mov    (%rax),%edi
lea    0x9c4(%rip),%rsi
lea    0x960(%rip),%rdx
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    -0x4a(%rbp),%rdi
call   1190 <sem_unlink@plt>
mov    -0x40(%rbp),%rdi
call   1130 <sem_close@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
lea    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1150 <bzero@plt>
mov    0x2887(%rip),%rax
mov    (%rax),%eax
mov    0x286e(%rip),%rcx
or     (%rcx),%eax
mov    0x2835(%rip),%rcx
or     (%rcx),%eax
mov    0x2864(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x30(%rbp)
mov    0x2830(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x12c0,-0x2c(%rbp)
movl   $0x12c0,-0x28(%rbp)
mov    -0x34(%rbp),%edi
mov    0x281b(%rip),%rax
mov    (%rax),%esi
call   1070 <tcflush@plt>
mov    -0x34(%rbp),%edi
mov    0x2832(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1110 <tcsetattr@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0xbc(%rbp)
lea    -0xb0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0xb0(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0xbc(%rbp),%edi
mov    -0xb8(%rbp),%rsi
mov    %rax,%rdx
call   1050 <write@plt>
cmp    $0x0,%rax
jge    17f7 <main+0x577>
lea    0x8f9(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1180 <sleep@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
jmp    182c <main+0x5ac>
mov    0x278b(%rip),%rax
mov    (%rax),%edi
lea    0x8e8(%rip),%rsi
lea    0x844(%rip),%rdx
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1090 <sem_post@plt>
cmp    $0x0,%rax
je     1879 <main+0x5f9>
mov    0x275a(%rip),%rax
mov    (%rax),%edi
lea    0x877(%rip),%rsi
lea    0x813(%rip),%rdx
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    -0x4a(%rbp),%rdi
call   1190 <sem_unlink@plt>
mov    -0x40(%rbp),%rdi
call   1130 <sem_close@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
lea    -0x4a(%rbp),%rdi
call   1190 <sem_unlink@plt>
mov    -0x40(%rbp),%rdi
call   1130 <sem_close@plt>
jmp    1890 <main+0x610>
xor    %edi,%edi
call   1160 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
mov    %rsi,%rbx
movabs $0x45535f444d434652,%rax
5f 53 45
mov    %rax,(%rsp)
movw   $0x4d,0x8(%rsp)
cmp    $0x5,%edi
je     12e8 <main+0x68>
cmp    $0x7,%edi
je     1321 <main+0xa1>
cmp    $0x6,%edi
jne    1362 <main+0xe2>
mov    0x10(%rbx),%rdi
lea    0xd49(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1370 <main+0xf0>
mov    0x18(%rbx),%rdi
mov    0x20(%rbx),%rsi
mov    0x28(%rbx),%rdx
lea    0x30(%rsp),%rcx
xor    %r8d,%r8d
jmp    139c <main+0x11c>
mov    0x10(%rbx),%rdi
lea    0xd24(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    13ab <main+0x12b>
mov    0x18(%rbx),%rdi
mov    0x20(%rbx),%rsi
lea    0x30(%rsp),%rdx
call   11a0 <createSartanoString@plt>
test   %rax,%rax
jne    1418 <main+0x198>
jmp    14b7 <main+0x237>
mov    0x10(%rbx),%rdi
lea    0xcf3(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1491 <main+0x211>
mov    0x18(%rbx),%rdi
mov    0x20(%rbx),%rsi
mov    0x28(%rbx),%rdx
mov    0x30(%rbx),%rcx
lea    0x30(%rsp),%r8
call   1030 <createIkeaString@plt>
test   %rax,%rax
jne    1418 <main+0x198>
jmp    14b7 <main+0x237>
cmp    $0x2,%edi
jge    1491 <main+0x211>
jmp    14b7 <main+0x237>
mov    0x10(%rbx),%rdi
lea    0xc94(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    13e0 <main+0x160>
mov    0x18(%rbx),%rdi
mov    0x20(%rbx),%rsi
mov    0x28(%rbx),%rdx
lea    0x30(%rsp),%rcx
mov    $0x1,%r8d
call   10f0 <createNexaString@plt>
test   %rax,%rax
jne    1418 <main+0x198>
jmp    14b7 <main+0x237>
mov    0x10(%rbx),%rdi
lea    0xc78(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1491 <main+0x211>
mov    0x18(%rbx),%rdi
mov    0x20(%rbx),%rsi
lea    0x30(%rsp),%rdx
call   1170 <createEverFlourishString@plt>
test   %rax,%rax
jne    1418 <main+0x198>
jmp    14b7 <main+0x237>
mov    0x10(%rbx),%rdi
lea    0xc39(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1491 <main+0x211>
mov    0x18(%rbx),%rdi
mov    0x20(%rbx),%rsi
mov    0x28(%rbx),%rdx
lea    0x30(%rsp),%rcx
call   10e0 <createRisingSunString@plt>
test   %rax,%rax
je     14b7 <main+0x237>
lea    0x30(%rsp),%rdi
call   1060 <strlen@plt>
test   %rax,%rax
jle    1651 <main+0x3d1>
mov    0x2bc6(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdi
mov    $0x1a4,%edx
mov    $0x1,%ecx
call   10b0 <sem_open@plt>
mov    %rax,%r14
mov    0x2b88(%rip),%rax
cmp    (%rax),%r14
jne    14c8 <main+0x248>
mov    0x2b44(%rip),%rax
mov    (%rax),%edi
lea    0xbe0(%rip),%rsi
lea    0xbfd(%rip),%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
lea    0xbf5(%rip),%rdi
call   1140 <perror@plt>
mov    %rsp,%rdi
call   1190 <sem_unlink@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    0x8(%rbx),%rdi
lea    0xb9f(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    14b7 <main+0x237>
xor    %eax,%eax
call   10d0 <printVersion@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
xor    %eax,%eax
call   1100 <printUsage@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    %r14,%rdi
call   1040 <sem_wait@plt>
test   %rax,%rax
jne    150d <main+0x28d>
mov    0x8(%rbx),%rdi
lea    0xbc8(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1522 <main+0x2a2>
mov    0x2aaf(%rip),%rax
mov    (%rax),%edi
lea    0xc0c(%rip),%rsi
lea    0xb68(%rip),%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    1634 <main+0x3b4>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
lea    0xb67(%rip),%rsi
jmp    1668 <main+0x3e8>
mov    0x8(%rbx),%rdi
mov    0x2ab3(%rip),%rax
mov    (%rax),%esi
call   1120 <open@plt>
test   %eax,%eax
jns    1574 <main+0x2f4>
mov    0x2a61(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x8(%rbx),%rcx
lea    0xb62(%rip),%rsi
lea    0xb15(%rip),%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %r14,%rdi
call   1090 <sem_post@plt>
test   %rax,%rax
je     1676 <main+0x3f6>
mov    0x0(%rbp),%edi
jmp    1661 <main+0x3e1>
mov    %eax,%ebp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1150 <bzero@plt>
mov    0x2a39(%rip),%rax
mov    0x2a22(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x29e7(%rip),%rax
or     (%rax),%ecx
mov    0x2a16(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x10(%rsp)
mov    0x29e1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
movq   $0x0,0x20(%rsp)
movabs $0x12c0000012c0,%rax
mov    %rax,0x14(%rsp)
mov    0x29cc(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1070 <tcflush@plt>
mov    0x29e4(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %rbx,%rdx
call   1110 <tcsetattr@plt>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <write@plt>
test   %rax,%rax
jns    1623 <main+0x3a3>
lea    0xacd(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1180 <sleep@plt>
mov    %ebp,%edi
call   1080 <close@plt>
mov    %r14,%rdi
call   1090 <sem_post@plt>
test   %rax,%rax
jne    1658 <main+0x3d8>
mov    %rsp,%rdi
call   1190 <sem_unlink@plt>
mov    %r14,%rdi
call   1130 <sem_close@plt>
xor    %edi,%edi
call   1160 <exit@plt>
mov    0x2941(%rip),%rax
mov    (%rax),%edi
lea    0xa5e(%rip),%rsi
lea    0x9fa(%rip),%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %rsp,%rdi
call   1190 <sem_unlink@plt>
mov    %r14,%rdi
call   1130 <sem_close@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32, i64, i32 }
@__const.main.SEM_NAME = [10 x i8] c"RFCMD_SEM\00"
@.str = [5 x i8] c"NEXA\00"
@.str.1 = [8 x i8] c"WAVEMAN\00"
@.str.2 = [8 x i8] c"SARTANO\00"
@.str.3 = [5 x i8] c"IKEA\00"
@.str.4 = [10 x i8] c"RISINGSUN\00"
@.str.5 = [13 x i8] c"EVERFLOURISH\00"
@.str.6 = [10 x i8] c"--version\00"
@O_CREAT = global i32 0
@SEM_FAILED = global i32* null
@stderr = global i32 0
@.str.7 = [36 x i8] c"%s - Error creating port semaphore\0A\00"
@.str.8 = [6 x i8] c"rfcmd\00"
@.str.9 = [21 x i8] c"Semaphore open error\00"
@.str.10 = [36 x i8] c"%s - Error aquiring port semaphore\0A\00"
@.str.11 = [7 x i8] c"LIBUSB\00"
@O_RDWR = global i32 0
@.str.12 = [23 x i8] c"%s - Error opening %s\0A\00"
@.str.13 = [37 x i8] c"%s - Error releasing port semaphore\0A\00"
@B4800 = global i32 0
@CS8 = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@IGNPAR = global i32 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.14 = [27 x i8] c"Error writing to rf device\00"
@.str.15 = [94 x i8] c"%s - Support for libftdi is not compiled in, please recompile rfcmd with support for libftdi\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.termios
%7 = alloca i32
%8 = alloca i32*
%9 = alloca [10 x i8]
%10 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %7
%11 = bitcast [10 x i8]* %9 to i8*
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 6
br i1 %13, label %14, label %37
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %37
20: ; preds = %14
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 4
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 5
%29 = load i8*, i8** %28
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%31 = call i64 @createNexaString(i8* %23, i8* %26, i8* %29, i8* %30, i32 0)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %20
%34 = call i32 (...) @printUsage()
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %20
br label %184
37: ; preds = %14, %2
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 6
br i1 %39, label %40, label %63
40: ; preds = %37
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %63
46: ; preds = %40
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 3
%49 = load i8*, i8** %48
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 4
%52 = load i8*, i8** %51
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 5
%55 = load i8*, i8** %54
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%57 = call i64 @createNexaString(i8* %49, i8* %52, i8* %55, i8* %56, i32 1)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %46
%60 = call i32 (...) @printUsage()
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %46
br label %183
63: ; preds = %40, %37
%64 = load i32, i32* %4
%65 = icmp eq i32 %64, 5
br i1 %65, label %66, label %86
66: ; preds = %63
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 2
%69 = load i8*, i8** %68
%70 = call i64 @strcmp(i8* %69, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %86
72: ; preds = %66
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 3
%75 = load i8*, i8** %74
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 4
%78 = load i8*, i8** %77
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%80 = call i64 @createSartanoString(i8* %75, i8* %78, i8* %79)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %72
%83 = call i32 (...) @printUsage()
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %72
br label %182
86: ; preds = %66, %63
%87 = load i32, i32* %4
%88 = icmp eq i32 %87, 7
br i1 %88, label %89, label %115
89: ; preds = %86
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 2
%92 = load i8*, i8** %91
%93 = call i64 @strcmp(i8* %92, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%94 = icmp eq i64 %93, 0
br i1 %94, label %95, label %115
95: ; preds = %89
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 3
%98 = load i8*, i8** %97
%99 = load i8**, i8*** %5
%100 = getelementptr inbounds i8*, i8** %99, i64 4
%101 = load i8*, i8** %100
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 5
%104 = load i8*, i8** %103
%105 = load i8**, i8*** %5
%106 = getelementptr inbounds i8*, i8** %105, i64 6
%107 = load i8*, i8** %106
%108 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%109 = call i64 @createIkeaString(i8* %98, i8* %101, i8* %104, i8* %107, i8* %108)
%110 = icmp eq i64 %109, 0
br i1 %110, label %111, label %114
111: ; preds = %95
%112 = call i32 (...) @printUsage()
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %95
br label %181
115: ; preds = %89, %86
%116 = load i32, i32* %4
%117 = icmp eq i32 %116, 6
br i1 %117, label %118, label %141
118: ; preds = %115
%119 = load i8**, i8*** %5
%120 = getelementptr inbounds i8*, i8** %119, i64 2
%121 = load i8*, i8** %120
%122 = call i64 @strcmp(i8* %121, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%123 = icmp eq i64 %122, 0
br i1 %123, label %124, label %141
124: ; preds = %118
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 3
%127 = load i8*, i8** %126
%128 = load i8**, i8*** %5
%129 = getelementptr inbounds i8*, i8** %128, i64 4
%130 = load i8*, i8** %129
%131 = load i8**, i8*** %5
%132 = getelementptr inbounds i8*, i8** %131, i64 5
%133 = load i8*, i8** %132
%134 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%135 = call i64 @createRisingSunString(i8* %127, i8* %130, i8* %133, i8* %134)
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %140
137: ; preds = %124
%138 = call i32 (...) @printUsage()
%139 = call i32 @exit(i32 1)
unreachable
140: ; preds = %124
br label %180
141: ; preds = %118, %115
%142 = load i32, i32* %4
%143 = icmp eq i32 %142, 5
br i1 %143, label %144, label %164
144: ; preds = %141
%145 = load i8**, i8*** %5
%146 = getelementptr inbounds i8*, i8** %145, i64 2
%147 = load i8*, i8** %146
%148 = call i64 @strcmp(i8* %147, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%149 = icmp eq i64 %148, 0
br i1 %149, label %150, label %164
150: ; preds = %144
%151 = load i8**, i8*** %5
%152 = getelementptr inbounds i8*, i8** %151, i64 3
%153 = load i8*, i8** %152
%154 = load i8**, i8*** %5
%155 = getelementptr inbounds i8*, i8** %154, i64 4
%156 = load i8*, i8** %155
%157 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%158 = call i64 @createEverFlourishString(i8* %153, i8* %156, i8* %157)
%159 = icmp eq i64 %158, 0
br i1 %159, label %160, label %163
160: ; preds = %150
%161 = call i32 (...) @printUsage()
%162 = call i32 @exit(i32 1)
unreachable
163: ; preds = %150
br label %179
164: ; preds = %144, %141
%165 = load i32, i32* %4
%166 = icmp sge i32 %165, 2
br i1 %166, label %167, label %176
167: ; preds = %164
%168 = load i8**, i8*** %5
%169 = getelementptr inbounds i8*, i8** %168, i64 1
%170 = load i8*, i8** %169
%171 = call i64 @strcmp(i8* %170, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%172 = icmp eq i64 %171, 0
br i1 %172, label %173, label %176
173: ; preds = %167
%174 = call i32 (...) @printVersion()
%175 = call i32 @exit(i32 1)
unreachable
176: ; preds = %167, %164
%177 = call i32 (...) @printUsage()
%178 = call i32 @exit(i32 1)
unreachable
179: ; preds = %163
br label %180
180: ; preds = %179, %140
br label %181
181: ; preds = %180, %114
br label %182
182: ; preds = %181, %85
br label %183
183: ; preds = %182, %62
br label %184
184: ; preds = %183, %36
%185 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%186 = call i64 @strlen(i8* %185)
%187 = icmp sgt i64 %186, 0
br i1 %187, label %188, label %299
188: ; preds = %184
%189 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%190 = load i32, i32* @O_CREAT
%191 = call i32* @sem_open(i8* %189, i32 %190, i32 420, i32 1)
store i32* %191, i32** %8
%192 = load i32*, i32** %8
%193 = load i32*, i32** @SEM_FAILED
%194 = icmp eq i32* %192, %193
br i1 %194, label %195, label %202
195: ; preds = %188
%196 = load i32, i32* @stderr
%197 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %196, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%198 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%199 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%200 = call i32 @sem_unlink(i8* %199)
%201 = call i32 @exit(i32 1)
unreachable
202: ; preds = %188
%203 = load i32*, i32** %8
%204 = call i64 @sem_wait(i32* %203)
%205 = icmp ne i64 %204, 0
br i1 %205, label %206, label %214
206: ; preds = %202
%207 = load i32, i32* @stderr
%208 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %207, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%209 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%210 = call i32 @sem_unlink(i8* %209)
%211 = load i32*, i32** %8
%212 = call i32 @sem_close(i32* %211)
%213 = call i32 @exit(i32 1)
unreachable
214: ; preds = %202
%215 = load i8**, i8*** %5
%216 = getelementptr inbounds i8*, i8** %215, i64 1
%217 = load i8*, i8** %216
%218 = call i64 @strcmp(i8* %217, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%219 = icmp ne i64 %218, 0
br i1 %219, label %220, label %278
220: ; preds = %214
%221 = load i8**, i8*** %5
%222 = getelementptr inbounds i8*, i8** %221, i64 1
%223 = load i8*, i8** %222
%224 = load i32, i32* @O_RDWR
%225 = call i32 @open(i8* %223, i32 %224)
store i32 %225, i32* %7
%226 = icmp sgt i32 0, %225
br i1 %226, label %227, label %245
227: ; preds = %220
%228 = load i32, i32* @stderr
%229 = load i8**, i8*** %5
%230 = getelementptr inbounds i8*, i8** %229, i64 1
%231 = load i8*, i8** %230
%232 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %228, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %231)
%233 = load i32*, i32** %8
%234 = call i64 @sem_post(i32* %233)
%235 = icmp ne i64 %234, 0
br i1 %235, label %236, label %239
236: ; preds = %227
%237 = load i32, i32* @stderr
%238 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %237, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %239
239: ; preds = %236, %227
%240 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%241 = call i32 @sem_unlink(i8* %240)
%242 = load i32*, i32** %8
%243 = call i32 @sem_close(i32* %242)
%244 = call i32 @exit(i32 1)
unreachable
245: ; preds = %220
%246 = call i32 @bzero(%struct.termios* %6, i32 32)
%247 = load i32, i32* @B4800
%248 = load i32, i32* @CS8
%249 = or i32 %247, %248
%250 = load i32, i32* @CLOCAL
%251 = or i32 %249, %250
%252 = load i32, i32* @CREAD
%253 = or i32 %251, %252
%254 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
store i32 %253, i32* %254
%255 = load i32, i32* @IGNPAR
%256 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 4
store i32 %255, i32* %256
%257 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 3
store i64 0, i64* %257
%258 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 1
store i32 4800, i32* %258
%259 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 2
store i32 4800, i32* %259
%260 = load i32, i32* %7
%261 = load i32, i32* @TCIFLUSH
%262 = call i32 @tcflush(i32 %260, i32 %261)
%263 = load i32, i32* %7
%264 = load i32, i32* @TCSANOW
%265 = call i32 @tcsetattr(i32 %263, i32 %264, %struct.termios* %6)
%266 = load i32, i32* %7
%267 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%268 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%269 = call i64 @strlen(i8* %268)
%270 = call i64 @write(i32 %266, i8* %267, i64 %269)
%271 = icmp slt i64 %270, 0
br i1 %271, label %272, label %274
272: ; preds = %245
%273 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
br label %274
274: ; preds = %272, %245
%275 = call i32 @sleep(i32 1)
%276 = load i32, i32* %7
%277 = call i32 @close(i32 %276)
br label %281
278: ; preds = %214
%279 = load i32, i32* @stderr
%280 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %279, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %281
281: ; preds = %278, %274
%282 = load i32*, i32** %8
%283 = call i64 @sem_post(i32* %282)
%284 = icmp ne i64 %283, 0
br i1 %284, label %285, label %293
285: ; preds = %281
%286 = load i32, i32* @stderr
%287 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %286, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%288 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%289 = call i32 @sem_unlink(i8* %288)
%290 = load i32*, i32** %8
%291 = call i32 @sem_close(i32* %290)
%292 = call i32 @exit(i32 1)
unreachable
293: ; preds = %281
%294 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%295 = call i32 @sem_unlink(i8* %294)
%296 = load i32*, i32** %8
%297 = call i32 @sem_close(i32* %296)
br label %298
298: ; preds = %293
br label %299
299: ; preds = %298, %184
%300 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i64, i32 }
@__const.main.SEM_NAME = [10 x i8] c"RFCMD_SEM\00"
@.str = [5 x i8] c"NEXA\00"
@.str.1 = [8 x i8] c"WAVEMAN\00"
@.str.2 = [8 x i8] c"SARTANO\00"
@.str.3 = [5 x i8] c"IKEA\00"
@.str.4 = [10 x i8] c"RISINGSUN\00"
@.str.5 = [13 x i8] c"EVERFLOURISH\00"
@.str.6 = [10 x i8] c"--version\00"
@O_CREAT = global i32 0
@SEM_FAILED = global i32* null
@stderr = global i32 0
@.str.7 = [36 x i8] c"%s - Error creating port semaphore\0A\00"
@.str.8 = [6 x i8] c"rfcmd\00"
@.str.9 = [21 x i8] c"Semaphore open error\00"
@.str.10 = [36 x i8] c"%s - Error aquiring port semaphore\0A\00"
@.str.11 = [7 x i8] c"LIBUSB\00"
@O_RDWR = global i32 0
@.str.12 = [23 x i8] c"%s - Error opening %s\0A\00"
@.str.13 = [37 x i8] c"%s - Error releasing port semaphore\0A\00"
@B4800 = global i32 0
@CS8 = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@IGNPAR = global i32 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.14 = [27 x i8] c"Error writing to rf device\00"
@.str.15 = [94 x i8] c"%s - Support for libftdi is not compiled in, please recompile rfcmd with support for libftdi\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.termios
%4 = alloca [10 x i8]
%5 = alloca [100 x i8]
%6 = bitcast %struct.termios* %3 to i8*
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
switch i32 %0, label %106 [
i32 6, label %9
i32 5, label %42
i32 7, label %57
]
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8*, i8** %1, i64 4
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8*, i8** %1, i64 5
%20 = load i8*, i8** %19
%21 = call i64 @createNexaString(i8* %16, i8* %18, i8* %20, i8* %8, i32 0)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %119
23: ; preds = %14
%24 = call i32 (...) @printUsage()
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %9
%27 = load i8*, i8** %10
%28 = tail call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %76
30: ; preds = %26
%31 = getelementptr inbounds i8*, i8** %1, i64 3
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8*, i8** %1, i64 4
%34 = load i8*, i8** %33
%35 = getelementptr inbounds i8*, i8** %1, i64 5
%36 = load i8*, i8** %35
%37 = call i64 @createNexaString(i8* %32, i8* %34, i8* %36, i8* %8, i32 1)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %119
39: ; preds = %30
%40 = call i32 (...) @printUsage()
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %2
%43 = getelementptr inbounds i8*, i8** %1, i64 2
%44 = load i8*, i8** %43
%45 = tail call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %92
47: ; preds = %42
%48 = getelementptr inbounds i8*, i8** %1, i64 3
%49 = load i8*, i8** %48
%50 = getelementptr inbounds i8*, i8** %1, i64 4
%51 = load i8*, i8** %50
%52 = call i64 @createSartanoString(i8* %49, i8* %51, i8* %8)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %119
54: ; preds = %47
%55 = call i32 (...) @printUsage()
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %2
%58 = getelementptr inbounds i8*, i8** %1, i64 2
%59 = load i8*, i8** %58
%60 = tail call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %108
62: ; preds = %57
%63 = getelementptr inbounds i8*, i8** %1, i64 3
%64 = load i8*, i8** %63
%65 = getelementptr inbounds i8*, i8** %1, i64 4
%66 = load i8*, i8** %65
%67 = getelementptr inbounds i8*, i8** %1, i64 5
%68 = load i8*, i8** %67
%69 = getelementptr inbounds i8*, i8** %1, i64 6
%70 = load i8*, i8** %69
%71 = call i64 @createIkeaString(i8* %64, i8* %66, i8* %68, i8* %70, i8* %8)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %119
73: ; preds = %62
%74 = call i32 (...) @printUsage()
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %26
%77 = load i8*, i8** %10
%78 = tail call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %108
80: ; preds = %76
%81 = getelementptr inbounds i8*, i8** %1, i64 3
%82 = load i8*, i8** %81
%83 = getelementptr inbounds i8*, i8** %1, i64 4
%84 = load i8*, i8** %83
%85 = getelementptr inbounds i8*, i8** %1, i64 5
%86 = load i8*, i8** %85
%87 = call i64 @createRisingSunString(i8* %82, i8* %84, i8* %86, i8* %8)
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %119
89: ; preds = %80
%90 = call i32 (...) @printUsage()
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %42
%93 = load i8*, i8** %43
%94 = tail call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %108
96: ; preds = %92
%97 = getelementptr inbounds i8*, i8** %1, i64 3
%98 = load i8*, i8** %97
%99 = getelementptr inbounds i8*, i8** %1, i64 4
%100 = load i8*, i8** %99
%101 = call i64 @createEverFlourishString(i8* %98, i8* %100, i8* %8)
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %119
103: ; preds = %96
%104 = call i32 (...) @printUsage()
%105 = call i32 @exit(i32 1)
unreachable
106: ; preds = %2
%107 = icmp sgt i32 %0, 1
br i1 %107, label %108, label %116
108: ; preds = %76, %92, %57, %106
%109 = getelementptr inbounds i8*, i8** %1, i64 1
%110 = load i8*, i8** %109
%111 = tail call i64 @strcmp(i8* %110, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%112 = icmp eq i64 %111, 0
br i1 %112, label %113, label %116
113: ; preds = %108
%114 = tail call i32 (...) @printVersion()
%115 = tail call i32 @exit(i32 1)
unreachable
116: ; preds = %108, %106
%117 = tail call i32 (...) @printUsage()
%118 = tail call i32 @exit(i32 1)
unreachable
119: ; preds = %30, %62, %96, %80, %47, %14
%120 = call i64 @strlen(i8* %8)
%121 = icmp sgt i64 %120, 0
br i1 %121, label %122, label %207
122: ; preds = %119
%123 = load i32, i32* @O_CREAT
%124 = call i32* @sem_open(i8* %7, i32 %123, i32 420, i32 1)
%125 = load i32*, i32** @SEM_FAILED
%126 = icmp eq i32* %124, %125
br i1 %126, label %127, label %133
127: ; preds = %122
%128 = load i32, i32* @stderr
%129 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%130 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%131 = call i32 @sem_unlink(i8* %7)
%132 = call i32 @exit(i32 1)
unreachable
133: ; preds = %122
%134 = call i64 @sem_wait(i32* %124)
%135 = icmp eq i64 %134, 0
br i1 %135, label %142, label %136
136: ; preds = %133
%137 = load i32, i32* @stderr
%138 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%139 = call i32 @sem_unlink(i8* %7)
%140 = call i32 @sem_close(i32* %124)
%141 = call i32 @exit(i32 1)
unreachable
142: ; preds = %133
%143 = getelementptr inbounds i8*, i8** %1, i64 1
%144 = load i8*, i8** %143
%145 = call i64 @strcmp(i8* %144, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%146 = icmp eq i64 %145, 0
br i1 %146, label %192, label %147
147: ; preds = %142
%148 = load i8*, i8** %143
%149 = load i32, i32* @O_RDWR
%150 = call i32 @open(i8* %148, i32 %149)
%151 = icmp slt i32 %150, 0
br i1 %151, label %152, label %165
152: ; preds = %147
%153 = load i32, i32* @stderr
%154 = load i8*, i8** %143
%155 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %153, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %154)
%156 = call i64 @sem_post(i32* %124)
%157 = icmp eq i64 %156, 0
br i1 %157, label %161, label %158
158: ; preds = %152
%159 = load i32, i32* @stderr
%160 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %159, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %161
161: ; preds = %158, %152
%162 = call i32 @sem_unlink(i8* %7)
%163 = call i32 @sem_close(i32* %124)
%164 = call i32 @exit(i32 1)
unreachable
165: ; preds = %147
%166 = call i32 @bzero(%struct.termios* %3, i32 32)
%167 = load i32, i32* @B4800
%168 = load i32, i32* @CS8
%169 = or i32 %168, %167
%170 = load i32, i32* @CLOCAL
%171 = or i32 %169, %170
%172 = load i32, i32* @CREAD
%173 = or i32 %171, %172
%174 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 0
store i32 %173, i32* %174
%175 = load i32, i32* @IGNPAR
%176 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 4
store i32 %175, i32* %176
%177 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 3
store i64 0, i64* %177
%178 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 1
store i32 4800, i32* %178
%179 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 2
store i32 4800, i32* %179
%180 = load i32, i32* @TCIFLUSH
%181 = call i32 @tcflush(i32 %150, i32 %180)
%182 = load i32, i32* @TCSANOW
%183 = call i32 @tcsetattr(i32 %150, i32 %182, %struct.termios* %3)
%184 = call i64 @strlen(i8* %8)
%185 = call i64 @write(i32 %150, i8* %8, i64 %184)
%186 = icmp slt i64 %185, 0
br i1 %186, label %187, label %189
187: ; preds = %165
%188 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
br label %189
189: ; preds = %187, %165
%190 = call i32 @sleep(i32 1)
%191 = call i32 @close(i32 %150)
br label %195
192: ; preds = %142
%193 = load i32, i32* @stderr
%194 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %193, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %195
195: ; preds = %192, %189
%196 = call i64 @sem_post(i32* %124)
%197 = icmp eq i64 %196, 0
br i1 %197, label %204, label %198
198: ; preds = %195
%199 = load i32, i32* @stderr
%200 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %199, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%201 = call i32 @sem_unlink(i8* %7)
%202 = call i32 @sem_close(i32* %124)
%203 = call i32 @exit(i32 1)
unreachable
204: ; preds = %195
%205 = call i32 @sem_unlink(i8* %7)
%206 = call i32 @sem_close(i32* %124)
br label %207
207: ; preds = %204, %119
%208 = call i32 @exit(i32 0)
unreachable
}