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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int execvp(char *, char **);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int flagopt(int, char **);
int /*<<< orphan*/ free(char *);
int getuid();
char *malloc(int);
int /*<<< orphan*/ memcpy(char **, char **, int);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
scalar_t__ strncasecmp(char const *, char *, int);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int useropt(int, char **);
int useruid(char *);
int main(int argc, char *argv[]) {
  int i, testuid, ret, uid, realuid;
  int find = -1;
  const char *pattern3 = "reservation=";
  const char *pattern4 = "res=";
  char *user;
  char *newarg[(sizeof(char *) * (argc + 1))];
  char *command;
  char *res_id;
  char buff[512];
  FILE *file;
  char commandline[] =
      "scontrol show res %s |grep Users |awk '{print $1}' 2>&1";
  if (argc == 1) {
    printf("sres: error: No arguments !\n");
    return EXIT_FAILURE;
  }
  if (newarg == NULL) {
    printf("sres: error: Not enough memory\n");
    return EXIT_FAILURE;
  }
  newarg[0] = "scontrol";
  memcpy(&newarg[1], &argv[1], sizeof(char *) * argc);
  newarg[argc + 1] = NULL;
  if (strcmp("create", newarg[1]) != 0 && strcmp("update", newarg[1]) != 0 &&
      strcmp("delete", newarg[1]) != 0) {
    printf(
        "sres: error: only create, update or delete operations are allowed\n");
    return EXIT_FAILURE;
  }
  if ((newarg[2] == NULL) || (strncmp("res", newarg[2], 3) != 0 &&
                              strncmp("reservation", newarg[2], 11) != 0)) {
    printf("sres: error: only reservation can be configured with %s\n",
           argv[0]);
    return EXIT_FAILURE;
  }
  if (flagopt(argc, argv) == -1) {
    printf("sres: error: flags are not supported\n");
    return EXIT_FAILURE;
  }
  testuid = useropt(argc, argv);
  if (testuid == 1) {
    printf("sres: error: you cannot create/modify/delete reservation "
           "for other users\n");
    return EXIT_FAILURE;
  }
  if (testuid == -2) {
    printf("sres: error: you must indicate only one username: yours\n");
    return EXIT_FAILURE;
  }
  if (strcmp("delete", newarg[1]) == 0 || strcmp("update", newarg[1]) == 0) {
    find = -1;
    for (i = 2; i < argc; i++) {
      if (strlen(newarg[i]) > 11 && strncasecmp(pattern3, newarg[i], 11) == 0) {
        res_id = malloc(sizeof(newarg[i]) - 11);
        strncpy(res_id, newarg[i] + 11, strlen(newarg[i]) - 11);
        find = 0;
        break;
      }
      if (strlen(newarg[i]) > 4 && strncasecmp(pattern4, newarg[i], 4) == 0) {
        res_id = malloc(sizeof(newarg[i]) - 4);
        strncpy(res_id, newarg[i] + 4, strlen(newarg[i]) - 4);
        find = 0;
        break;
      }
    }
    if (find == -1) {
      printf("sres: error: you must indicate the reservation with "
             "reservation= or res=\n");
      return EXIT_FAILURE;
    }
    command = malloc(strlen(res_id) + strlen(commandline));
    sprintf(command, commandline, res_id);
    file = popen(command, "r");
    if (file == NULL) {
      printf("sres: error: Fail launching command scontrol show res\n");
      return EXIT_FAILURE;
    }
    i = 0;
    while (fgets(buff, sizeof(buff), file) != NULL) {
      if (0) {
        printf("%s", buff);
      }
      i++;
      if (strlen(buff) <= 6) {
        printf("sres: error: There is no owner ie:user of the reservation\n");
        return EXIT_FAILURE;
      }
      user = malloc(strlen(buff) - 6);
      strncpy(user, buff + 6, strlen(buff) - 7);
    }
    if (i < 1) {
      printf("sres: error: The reservation does not exist\n");
      return EXIT_FAILURE;
    }
    if (i > 1) {
      printf("sres: error: Find several reservations\n");
      return EXIT_FAILURE;
    }
    for (i = 0; i < strlen(user); i++) {
      if (user[i] == ',') {
        printf("sres: error: There is several owners of the reservation\n");
        return EXIT_FAILURE;
      }
    }
    uid = getuid();
    realuid = useruid(user);
    if (realuid == -1) {
      return EXIT_FAILURE;
    }
    if (0) {
      printf("uid = %d, given uid = %d\n", uid, realuid);
    }
    if (uid != realuid) {
      printf("sres: error: you cannot create/modify/delete reservation "
             "for other users\n");
      return EXIT_FAILURE;
    }
    free(command);
    free(res_id);
    free(user);
    pclose(file);
  } else {
    if (testuid == -1) {
      printf("sres: error: You must indicate your user name\n");
      return EXIT_FAILURE;
    }
  }
  ret = execvp("scontrol", newarg);
  if (ret != 0) {
    return EXIT_FAILURE;
  } else
    return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x28(%rbp)
lea    0xdb9(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xdbb(%rip),%rax
mov    %rax,-0x38(%rbp)
movslq -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
lea    0x8(,%rax,8),%rax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
shl    $0x6,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x2b0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
lea    -0x2a0(%rbp),%rdi
lea    0x106a(%rip),%rsi
mov    $0x38,%edx
call   10e0 <memcpy@plt>
cmpl   $0x1,-0x8(%rbp)
jne    12d3 <main+0xb3>
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2d21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x2b0(%rbp),%rdi
lea    0xd4e(%rip),%rax
mov    %rax,(%rdi)
add    $0x8,%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   10e0 <memcpy@plt>
mov    -0x2b0(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
mov    0x8(%rax),%rsi
lea    0xd16(%rip),%rdi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     139c <main+0x17c>
mov    -0x2b0(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xcfc(%rip),%rdi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     139c <main+0x17c>
mov    -0x2b0(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xce2(%rip),%rdi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     139c <main+0x17c>
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2c58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x2b0(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     13fa <main+0x1da>
mov    -0x2b0(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xcd0(%rip),%rdi
mov    $0x3,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     142a <main+0x20a>
mov    -0x2b0(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xcae(%rip),%rdi
mov    $0xb,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     142a <main+0x20a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2bca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10b0 <flagopt@plt>
cmp    $0xffffffff,%eax
jne    1468 <main+0x248>
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2b8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1110 <useropt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    14aa <main+0x28a>
lea    0xc77(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2b4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
cmpl   $0xfffffffe,-0x18(%rbp)
jne    14dd <main+0x2bd>
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2b17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x2b0(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xb57(%rip),%rdi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     151f <main+0x2ff>
mov    -0x2b0(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xb2f(%rip),%rdi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    19af <main+0x78f>
movl   $0xffffffff,-0x28(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    16a2 <main+0x482>
mov    -0x2b0(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
cmp    $0xb,%eax
jle    15e4 <main+0x3c4>
mov    -0x2b0(%rbp),%rax
mov    -0x30(%rbp),%rdi
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0xb,%edx
call   1100 <strncasecmp@plt>
cmp    $0x0,%rax
jne    15e4 <main+0x3c4>
mov    $0xfffffffd,%edi
call   10f0 <malloc@plt>
mov    %rax,%rcx
mov    -0x2b0(%rbp),%rax
mov    %rcx,-0x60(%rbp)
mov    -0x60(%rbp),%rcx
mov    %rcx,-0x2c0(%rbp)
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
add    $0xb,%rcx
mov    %rcx,-0x2b8(%rbp)
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
mov    -0x2c0(%rbp),%rdi
mov    -0x2b8(%rbp),%rsi
mov    %eax,%edx
sub    $0xb,%edx
call   1040 <strncpy@plt>
movl   $0x0,-0x28(%rbp)
jmp    16a2 <main+0x482>
mov    -0x2b0(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
cmp    $0x4,%eax
jle    168f <main+0x46f>
mov    -0x2b0(%rbp),%rax
mov    -0x38(%rbp),%rdi
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x4,%edx
call   1100 <strncasecmp@plt>
cmp    $0x0,%rax
jne    168f <main+0x46f>
mov    $0x4,%edi
call   10f0 <malloc@plt>
mov    %rax,%rcx
mov    -0x2b0(%rbp),%rax
mov    %rcx,-0x60(%rbp)
mov    -0x60(%rbp),%rcx
mov    %rcx,-0x2d0(%rbp)
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
add    $0x4,%rcx
mov    %rcx,-0x2c8(%rbp)
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
mov    -0x2d0(%rbp),%rdi
mov    -0x2c8(%rbp),%rsi
mov    %eax,%edx
sub    $0x4,%edx
call   1040 <strncpy@plt>
movl   $0x0,-0x28(%rbp)
jmp    16a2 <main+0x482>
jmp    1694 <main+0x474>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    152d <main+0x30d>
cmpl   $0xffffffff,-0x28(%rbp)
jne    16d5 <main+0x4b5>
lea    0xacf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x291f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x60(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x2d4(%rbp)
lea    -0x2a0(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x2d4(%rbp),%edi
add    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    -0x2a0(%rbp),%rsi
mov    -0x60(%rbp),%rdx
call   1140 <sprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xaac(%rip),%rsi
call   1120 <popen@plt>
mov    %rax,-0x268(%rbp)
cmpq   $0x0,-0x268(%rbp)
jne    1763 <main+0x543>
lea    0xa8d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2891(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
movl   $0x0,-0x14(%rbp)
lea    -0x260(%rbp),%rdi
mov    -0x268(%rbp),%rdx
mov    $0x200,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     1833 <main+0x613>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    -0x260(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x6,%eax
jg     17d3 <main+0x5b3>
lea    0xa54(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2821(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
lea    -0x260(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%edi
sub    $0x6,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x2e8(%rbp)
lea    -0x260(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x2e0(%rbp)
lea    -0x260(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x2e8(%rbp),%rdi
mov    -0x2e0(%rbp),%rsi
mov    %eax,%edx
sub    $0x7,%edx
call   1040 <strncpy@plt>
jmp    176a <main+0x54a>
cmpl   $0x1,-0x14(%rbp)
jge    1866 <main+0x646>
lea    0x9fc(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x278e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
cmpl   $0x1,-0x14(%rbp)
jle    1899 <main+0x679>
lea    0x9f6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x275b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2ec(%rbp)
mov    -0x40(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x2ec(%rbp),%eax
cmp    %ecx,%eax
jge    1913 <main+0x6f3>
mov    -0x40(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    1900 <main+0x6e0>
lea    0x9b7(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x26f4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
jmp    1905 <main+0x6e5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    18a0 <main+0x680>
mov    $0x0,%al
call   1080 <getuid@plt>
mov    %eax,-0x20(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <useruid@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    194e <main+0x72e>
mov    0x26a6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     1983 <main+0x763>
lea    0x79e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2671(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x268(%rbp),%rdi
call   10a0 <pclose@plt>
jmp    19e7 <main+0x7c7>
cmpl   $0xffffffff,-0x18(%rbp)
jne    19e2 <main+0x7c2>
lea    0x90e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2612(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
jmp    19e7 <main+0x7c7>
mov    -0x2b0(%rbp),%rsi
lea    0x63a(%rip),%rdi
call   1130 <execvp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1a22 <main+0x802>
mov    0x25d2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
jmp    1a38 <main+0x818>
mov    0x25af(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x2a4(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x248,%rsp
movslq %edi,%rax
lea    0x1(%rax),%rbx
mov    %rsp,%r15
mov    %rbx,%rcx
shl    $0x6,%rcx
sub    %rcx,%r15
mov    %r15,%rsp
movaps 0x109e(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movaps 0x1083(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0x1068(%rip),%xmm0
movaps %xmm0,-0x70(%rbp)
movabs $0x31263e3220277d,%rcx
mov    %rcx,-0x40(%rbp)
cmp    $0x1,%eax
jne    12a0 <main+0x70>
lea    0x102a(%rip),%rdi
call   1060 <puts@plt>
jmp    1365 <main+0x135>
mov    %rsi,%r14
mov    %edi,%r13d
lea    0xd60(%rip),%rax
mov    %rax,(%r15)
lea    0x8(%r15),%r12
add    $0x8,%rsi
lea    0x0(,%r13,8),%edx
mov    %r12,%rdi
call   10f0 <memcpy@plt>
movq   $0x0,(%r15,%rbx,8)
mov    0x8(%r15),%rsi
lea    0xd3b(%rip),%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     131b <main+0xeb>
mov    (%r12),%rsi
lea    0xd2d(%rip),%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     131b <main+0xeb>
mov    (%r12),%rsi
lea    0xd1f(%rip),%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     131b <main+0xeb>
lea    0xf68(%rip),%rdi
jmp    1296 <main+0x66>
mov    0x10(%r15),%rsi
test   %rsi,%rsi
je     1354 <main+0x124>
lea    0xe60(%rip),%rdi
mov    $0x3,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     137d <main+0x14d>
mov    0x10(%r15),%rsi
lea    0xe08(%rip),%rdi
mov    $0xb,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     137d <main+0x14d>
mov    (%r14),%rsi
lea    0xccd(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x2c74(%rip),%rbx
mov    (%rbx),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13d,%edi
mov    %r14,%rsi
call   10c0 <flagopt@plt>
cmp    $0xffffffff,%eax
je     13b1 <main+0x181>
mov    %r13d,%edi
mov    %r14,%rsi
call   1120 <useropt@plt>
cmp    $0xfffffffe,%eax
je     13bd <main+0x18d>
mov    %eax,%r14d
cmp    $0x1,%eax
jne    13c9 <main+0x199>
lea    0xe64(%rip),%rdi
jmp    1296 <main+0x66>
lea    0xea1(%rip),%rdi
jmp    1296 <main+0x66>
lea    0xe14(%rip),%rdi
jmp    1296 <main+0x66>
mov    (%r12),%rsi
lea    0xc50(%rip),%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     1420 <main+0x1f0>
mov    (%r12),%rsi
lea    0xc34(%rip),%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     1420 <main+0x1f0>
cmp    $0xffffffff,%r14d
je     14c0 <main+0x290>
lea    0xc09(%rip),%rdi
mov    %r15,%rsi
call   1140 <execvp@plt>
test   %eax,%eax
jne    1365 <main+0x135>
mov    0x2bbd(%rip),%rbx
jmp    136c <main+0x13c>
cmp    $0x3,%r13d
jl     14b4 <main+0x284>
mov    %r13d,%r13d
mov    $0x2,%r14d
lea    0xd99(%rip),%r12
jmp    1445 <main+0x215>
add    $0x1,%r14
cmp    %r14,%r13
je     14b4 <main+0x284>
mov    (%r15,%r14,8),%rdi
call   1080 <strlen@plt>
mov    (%r15,%r14,8),%rbx
cmp    $0xc,%eax
jl     1470 <main+0x240>
lea    0xba2(%rip),%rdi
mov    %rbx,%rsi
mov    $0xb,%edx
call   1110 <strncasecmp@plt>
test   %rax,%rax
je     14cc <main+0x29c>
mov    %rbx,%rdi
call   1080 <strlen@plt>
cmp    $0x5,%eax
jl     143c <main+0x20c>
mov    (%r15,%r14,8),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1110 <strncasecmp@plt>
test   %rax,%rax
jne    143c <main+0x20c>
mov    $0x4,%edi
call   1100 <malloc@plt>
mov    %rax,%r12
lea    0x4(%rbx),%r14
mov    %rbx,%rdi
call   1080 <strlen@plt>
lea    -0x4(%rax),%edx
jmp    14e8 <main+0x2b8>
lea    0xcd4(%rip),%rdi
jmp    1296 <main+0x66>
lea    0xb9f(%rip),%rdi
jmp    1296 <main+0x66>
mov    $0xfffffffd,%edi
call   1100 <malloc@plt>
mov    %rax,%r12
lea    0xb(%rbx),%r14
mov    %rbx,%rdi
call   1080 <strlen@plt>
lea    -0xb(%rax),%edx
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <strncpy@plt>
mov    %r12,%rdi
call   1080 <strlen@plt>
mov    %eax,%ebx
lea    -0x70(%rbp),%r14
mov    %r14,%rdi
call   1080 <strlen@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1100 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1150 <sprintf@plt>
lea    0xb3a(%rip),%rsi
mov    %rbx,%rdi
call   1130 <popen@plt>
test   %rax,%rax
je     15d1 <main+0x3a1>
mov    %rax,%r13
lea    -0x270(%rbp),%rdi
mov    $0x200,%esi
mov    %rax,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
je     15dd <main+0x3ad>
mov    %rbx,-0x30(%rbp)
mov    %r12,-0x38(%rbp)
mov    $0x1,%ebx
lea    -0x270(%rbp),%r12
mov    %r12,%rdi
call   1080 <strlen@plt>
cmp    $0x6,%eax
jle    15e9 <main+0x3b9>
mov    %r12,%rdi
call   1080 <strlen@plt>
lea    -0x6(%rax),%edi
call   1100 <malloc@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1080 <strlen@plt>
lea    -0x7(%rax),%edx
mov    %r14,%rdi
lea    -0x26a(%rbp),%rsi
call   1040 <strncpy@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   10d0 <fgets@plt>
add    $0xffffffff,%ebx
test   %rax,%rax
jne    156f <main+0x33f>
test   %ebx,%ebx
je     15f5 <main+0x3c5>
lea    0xb00(%rip),%rdi
jmp    1296 <main+0x66>
lea    0xb81(%rip),%rdi
jmp    1296 <main+0x66>
lea    0xb0f(%rip),%rdi
jmp    1296 <main+0x66>
lea    0xb2f(%rip),%rdi
jmp    1296 <main+0x66>
mov    %r14,%rdi
call   1080 <strlen@plt>
test   %eax,%eax
jle    161d <main+0x3ed>
xor    %ebx,%ebx
cmpb   $0x2c,(%r14,%rbx,1)
je     166b <main+0x43b>
add    $0x1,%rbx
mov    %r14,%rdi
call   1080 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1603 <main+0x3d3>
xor    %eax,%eax
call   1090 <getuid@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1070 <useruid@plt>
mov    0x29aa(%rip),%rbx
cmp    $0xffffffff,%eax
je     136c <main+0x13c>
cmp    %eax,%r12d
jne    1677 <main+0x447>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   10b0 <pclose@plt>
jmp    13fd <main+0x1cd>
lea    0xa22(%rip),%rdi
jmp    1296 <main+0x66>
lea    0xb92(%rip),%rdi
call   1060 <puts@plt>
jmp    136c <main+0x13c>

LLVM IR (-O0):
@.str = [13 x i8] c"reservation=\00"
@.str.1 = [5 x i8] c"res=\00"
@__const.main.commandline = [56 x i8] c"scontrol show res %s |grep Users |awk '{print $1}' 2>&1\00"
@.str.2 = [29 x i8] c"sres: error: No arguments !\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [9 x i8] c"scontrol\00"
@.str.4 = [7 x i8] c"create\00"
@.str.5 = [7 x i8] c"update\00"
@.str.6 = [7 x i8] c"delete\00"
@.str.7 = [67 x i8] c"sres: error: only create, update or delete operations are allowed\0A\00"
@.str.8 = [4 x i8] c"res\00"
@.str.9 = [12 x i8] c"reservation\00"
@.str.10 = [57 x i8] c"sres: error: only reservation can be configured with %s\0A\00"
@.str.11 = [38 x i8] c"sres: error: flags are not supported\0A\00"
@.str.12 = [74 x i8] c"sres: error: you cannot create/modify/delete reservation for other users\0A\00"
@.str.13 = [57 x i8] c"sres: error: you must indicate only one username: yours\0A\00"
@.str.14 = [74 x i8] c"sres: error: you must indicate the reservation with reservation= or res=\0A\00"
@.str.15 = [2 x i8] c"r\00"
@.str.16 = [55 x i8] c"sres: error: Fail launching command scontrol show res\0A\00"
@.str.17 = [59 x i8] c"sres: error: There is no owner ie:user of the reservation\0A\00"
@.str.18 = [45 x i8] c"sres: error: The reservation does not exist\0A\00"
@.str.19 = [40 x i8] c"sres: error: Find several reservations\0A\00"
@.str.20 = [57 x i8] c"sres: error: There is several owners of the reservation\0A\00"
@.str.21 = [47 x i8] c"sres: error: You must indicate your user name\0A\00"
@EXIT_SUCCESS = global i32 0
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 i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca [512 x i8]
%20 = alloca i32*
%21 = alloca [56 x i8]
%22 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %11
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %13
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = mul i64 8, %25
%27 = call i8* @llvm.stacksave()
store i8* %27, i8** %15
%28 = alloca i8*, i64 %26
store i64 %26, i64* %16
%29 = bitcast [56 x i8]* %21 to i8*
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %35
32: ; preds = %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
store i32 %34, i32* %3
store i32 1, i32* %22
br label %311
35: ; preds = %2
%36 = getelementptr inbounds i8*, i8** %28, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %36
%37 = getelementptr inbounds i8*, i8** %28, i64 1
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = mul i64 8, %41
%43 = trunc i64 %42 to i32
%44 = call i32 @memcpy(i8** %37, i8** %39, i32 %43)
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %28, i64 %47
store i8* null, i8** %48
%49 = getelementptr inbounds i8*, i8** %28, i64 1
%50 = load i8*, i8** %49
%51 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %66
53: ; preds = %35
%54 = getelementptr inbounds i8*, i8** %28, i64 1
%55 = load i8*, i8** %54
%56 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %66
58: ; preds = %53
%59 = getelementptr inbounds i8*, i8** %28, i64 1
%60 = load i8*, i8** %59
%61 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %58
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0))
%65 = load i32, i32* @EXIT_FAILURE
store i32 %65, i32* %3
store i32 1, i32* %22
br label %311
66: ; preds = %58, %53, %35
%67 = getelementptr inbounds i8*, i8** %28, i64 2
%68 = load i8*, i8** %67
%69 = icmp eq i8* %68, null
br i1 %69, label %80, label %70
70: ; preds = %66
%71 = getelementptr inbounds i8*, i8** %28, i64 2
%72 = load i8*, i8** %71
%73 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %72, i32 3)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %86
75: ; preds = %70
%76 = getelementptr inbounds i8*, i8** %28, i64 2
%77 = load i8*, i8** %76
%78 = call i64 @strncmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* %77, i32 11)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %86
80: ; preds = %75, %66
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 0
%83 = load i8*, i8** %82
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0), i8* %83)
%85 = load i32, i32* @EXIT_FAILURE
store i32 %85, i32* %3
store i32 1, i32* %22
br label %311
86: ; preds = %75, %70
%87 = load i32, i32* %4
%88 = load i8**, i8*** %5
%89 = call i32 @flagopt(i32 %87, i8** %88)
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %94
91: ; preds = %86
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
%93 = load i32, i32* @EXIT_FAILURE
store i32 %93, i32* %3
store i32 1, i32* %22
br label %311
94: ; preds = %86
%95 = load i32, i32* %4
%96 = load i8**, i8*** %5
%97 = call i32 @useropt(i32 %95, i8** %96)
store i32 %97, i32* %7
%98 = load i32, i32* %7
%99 = icmp eq i32 %98, 1
br i1 %99, label %100, label %103
100: ; preds = %94
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.12, i64 0, i64 0))
%102 = load i32, i32* @EXIT_FAILURE
store i32 %102, i32* %3
store i32 1, i32* %22
br label %311
103: ; preds = %94
%104 = load i32, i32* %7
%105 = icmp eq i32 %104, -2
br i1 %105, label %106, label %109
106: ; preds = %103
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.13, i64 0, i64 0))
%108 = load i32, i32* @EXIT_FAILURE
store i32 %108, i32* %3
store i32 1, i32* %22
br label %311
109: ; preds = %103
%110 = getelementptr inbounds i8*, i8** %28, i64 1
%111 = load i8*, i8** %110
%112 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %111)
%113 = icmp eq i64 %112, 0
br i1 %113, label %119, label %114
114: ; preds = %109
%115 = getelementptr inbounds i8*, i8** %28, i64 1
%116 = load i8*, i8** %115
%117 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %116)
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %296
119: ; preds = %114, %109
store i32 -1, i32* %11
store i32 2, i32* %6
br label %120
120: ; preds = %185, %119
%121 = load i32, i32* %6
%122 = load i32, i32* %4
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %188
124: ; preds = %120
%125 = load i32, i32* %6
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8*, i8** %28, i64 %126
%128 = load i8*, i8** %127
%129 = call i32 @strlen(i8* %128)
%130 = icmp sgt i32 %129, 11
br i1 %130, label %131, label %154
131: ; preds = %124
%132 = load i8*, i8** %12
%133 = load i32, i32* %6
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8*, i8** %28, i64 %134
%136 = load i8*, i8** %135
%137 = call i64 @strncasecmp(i8* %132, i8* %136, i32 11)
%138 = icmp eq i64 %137, 0
br i1 %138, label %139, label %154
139: ; preds = %131
%140 = call i8* @malloc(i32 -3)
store i8* %140, i8** %18
%141 = load i8*, i8** %18
%142 = load i32, i32* %6
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8*, i8** %28, i64 %143
%145 = load i8*, i8** %144
%146 = getelementptr inbounds i8, i8* %145, i64 11
%147 = load i32, i32* %6
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i8*, i8** %28, i64 %148
%150 = load i8*, i8** %149
%151 = call i32 @strlen(i8* %150)
%152 = sub nsw i32 %151, 11
%153 = call i32 @strncpy(i8* %141, i8* %146, i32 %152)
store i32 0, i32* %11
br label %188
154: ; preds = %131, %124
%155 = load i32, i32* %6
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i8*, i8** %28, i64 %156
%158 = load i8*, i8** %157
%159 = call i32 @strlen(i8* %158)
%160 = icmp sgt i32 %159, 4
br i1 %160, label %161, label %184
161: ; preds = %154
%162 = load i8*, i8** %13
%163 = load i32, i32* %6
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8*, i8** %28, i64 %164
%166 = load i8*, i8** %165
%167 = call i64 @strncasecmp(i8* %162, i8* %166, i32 4)
%168 = icmp eq i64 %167, 0
br i1 %168, label %169, label %184
169: ; preds = %161
%170 = call i8* @malloc(i32 4)
store i8* %170, i8** %18
%171 = load i8*, i8** %18
%172 = load i32, i32* %6
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds i8*, i8** %28, i64 %173
%175 = load i8*, i8** %174
%176 = getelementptr inbounds i8, i8* %175, i64 4
%177 = load i32, i32* %6
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i8*, i8** %28, i64 %178
%180 = load i8*, i8** %179
%181 = call i32 @strlen(i8* %180)
%182 = sub nsw i32 %181, 4
%183 = call i32 @strncpy(i8* %171, i8* %176, i32 %182)
store i32 0, i32* %11
br label %188
184: ; preds = %161, %154
br label %185
185: ; preds = %184
%186 = load i32, i32* %6
%187 = add nsw i32 %186, 1
store i32 %187, i32* %6
br label %120
188: ; preds = %169, %139, %120
%189 = load i32, i32* %11
%190 = icmp eq i32 %189, -1
br i1 %190, label %191, label %194
191: ; preds = %188
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.14, i64 0, i64 0))
%193 = load i32, i32* @EXIT_FAILURE
store i32 %193, i32* %3
store i32 1, i32* %22
br label %311
194: ; preds = %188
%195 = load i8*, i8** %18
%196 = call i32 @strlen(i8* %195)
%197 = getelementptr inbounds [56 x i8], [56 x i8]* %21, i64 0, i64 0
%198 = call i32 @strlen(i8* %197)
%199 = add nsw i32 %196, %198
%200 = call i8* @malloc(i32 %199)
store i8* %200, i8** %17
%201 = load i8*, i8** %17
%202 = getelementptr inbounds [56 x i8], [56 x i8]* %21, i64 0, i64 0
%203 = load i8*, i8** %18
%204 = call i32 @sprintf(i8* %201, i8* %202, i8* %203)
%205 = load i8*, i8** %17
%206 = call i32* @popen(i8* %205, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
store i32* %206, i32** %20
%207 = load i32*, i32** %20
%208 = icmp eq i32* %207, null
br i1 %208, label %209, label %212
209: ; preds = %194
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.16, i64 0, i64 0))
%211 = load i32, i32* @EXIT_FAILURE
store i32 %211, i32* %3
store i32 1, i32* %22
br label %311
212: ; preds = %194
store i32 0, i32* %6
br label %213
213: ; preds = %227, %212
%214 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%215 = load i32*, i32** %20
%216 = call i32* @fgets(i8* %214, i32 512, i32* %215)
%217 = icmp ne i32* %216, null
br i1 %217, label %218, label %239
218: ; preds = %213
%219 = load i32, i32* %6
%220 = add nsw i32 %219, 1
store i32 %220, i32* %6
%221 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%222 = call i32 @strlen(i8* %221)
%223 = icmp sle i32 %222, 6
br i1 %223, label %224, label %227
224: ; preds = %218
%225 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.17, i64 0, i64 0))
%226 = load i32, i32* @EXIT_FAILURE
store i32 %226, i32* %3
store i32 1, i32* %22
br label %311
227: ; preds = %218
%228 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%229 = call i32 @strlen(i8* %228)
%230 = sub nsw i32 %229, 6
%231 = call i8* @malloc(i32 %230)
store i8* %231, i8** %14
%232 = load i8*, i8** %14
%233 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%234 = getelementptr inbounds i8, i8* %233, i64 6
%235 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%236 = call i32 @strlen(i8* %235)
%237 = sub nsw i32 %236, 7
%238 = call i32 @strncpy(i8* %232, i8* %234, i32 %237)
br label %213
239: ; preds = %213
%240 = load i32, i32* %6
%241 = icmp slt i32 %240, 1
br i1 %241, label %242, label %245
242: ; preds = %239
%243 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.18, i64 0, i64 0))
%244 = load i32, i32* @EXIT_FAILURE
store i32 %244, i32* %3
store i32 1, i32* %22
br label %311
245: ; preds = %239
%246 = load i32, i32* %6
%247 = icmp sgt i32 %246, 1
br i1 %247, label %248, label %251
248: ; preds = %245
%249 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.19, i64 0, i64 0))
%250 = load i32, i32* @EXIT_FAILURE
store i32 %250, i32* %3
store i32 1, i32* %22
br label %311
251: ; preds = %245
store i32 0, i32* %6
br label %252
252: ; preds = %269, %251
%253 = load i32, i32* %6
%254 = load i8*, i8** %14
%255 = call i32 @strlen(i8* %254)
%256 = icmp slt i32 %253, %255
br i1 %256, label %257, label %272
257: ; preds = %252
%258 = load i8*, i8** %14
%259 = load i32, i32* %6
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds i8, i8* %258, i64 %260
%262 = load i8, i8* %261
%263 = sext i8 %262 to i32
%264 = icmp eq i32 %263, 44
br i1 %264, label %265, label %268
265: ; preds = %257
%266 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.20, i64 0, i64 0))
%267 = load i32, i32* @EXIT_FAILURE
store i32 %267, i32* %3
store i32 1, i32* %22
br label %311
268: ; preds = %257
br label %269
269: ; preds = %268
%270 = load i32, i32* %6
%271 = add nsw i32 %270, 1
store i32 %271, i32* %6
br label %252
272: ; preds = %252
%273 = call i32 (...) @getuid()
store i32 %273, i32* %9
%274 = load i8*, i8** %14
%275 = call i32 @useruid(i8* %274)
store i32 %275, i32* %10
%276 = load i32, i32* %10
%277 = icmp eq i32 %276, -1
br i1 %277, label %278, label %280
278: ; preds = %272
%279 = load i32, i32* @EXIT_FAILURE
store i32 %279, i32* %3
store i32 1, i32* %22
br label %311
280: ; preds = %272
%281 = load i32, i32* %9
%282 = load i32, i32* %10
%283 = icmp ne i32 %281, %282
br i1 %283, label %284, label %287
284: ; preds = %280
%285 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.12, i64 0, i64 0))
%286 = load i32, i32* @EXIT_FAILURE
store i32 %286, i32* %3
store i32 1, i32* %22
br label %311
287: ; preds = %280
%288 = load i8*, i8** %17
%289 = call i32 @free(i8* %288)
%290 = load i8*, i8** %18
%291 = call i32 @free(i8* %290)
%292 = load i8*, i8** %14
%293 = call i32 @free(i8* %292)
%294 = load i32*, i32** %20
%295 = call i32 @pclose(i32* %294)
br label %303
296: ; preds = %114
%297 = load i32, i32* %7
%298 = icmp eq i32 %297, -1
br i1 %298, label %299, label %302
299: ; preds = %296
%300 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.21, i64 0, i64 0))
%301 = load i32, i32* @EXIT_FAILURE
store i32 %301, i32* %3
store i32 1, i32* %22
br label %311
302: ; preds = %296
br label %303
303: ; preds = %302, %287
%304 = call i32 @execvp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %28)
store i32 %304, i32* %8
%305 = load i32, i32* %8
%306 = icmp ne i32 %305, 0
br i1 %306, label %307, label %309
307: ; preds = %303
%308 = load i32, i32* @EXIT_FAILURE
store i32 %308, i32* %3
store i32 1, i32* %22
br label %311
309: ; preds = %303
%310 = load i32, i32* @EXIT_SUCCESS
store i32 %310, i32* %3
store i32 1, i32* %22
br label %311
311: ; preds = %309, %307, %299, %284, %278, %265, %248, %242, %224, %209, %191, %106, %100, %91, %80, %63, %32
%312 = load i8*, i8** %15
%313 = load i32, i32* %3
ret i32 %313
}

LLVM IR (-O2):
@.str = [13 x i8] c"reservation=\00"
@.str.1 = [5 x i8] c"res=\00"
@__const.main.commandline = [56 x i8] c"scontrol show res %s |grep Users |awk '{print $1}' 2>&1\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [9 x i8] c"scontrol\00"
@.str.4 = [7 x i8] c"create\00"
@.str.5 = [7 x i8] c"update\00"
@.str.6 = [7 x i8] c"delete\00"
@.str.8 = [4 x i8] c"res\00"
@.str.9 = [12 x i8] c"reservation\00"
@.str.10 = [57 x i8] c"sres: error: only reservation can be configured with %s\0A\00"
@.str.15 = [2 x i8] c"r\00"
@EXIT_SUCCESS = global i32 0
@str = [46 x i8] c"sres: error: You must indicate your user name\00"
@str.23 = [56 x i8] c"sres: error: There is several owners of the reservation\00"
@str.24 = [39 x i8] c"sres: error: Find several reservations\00"
@str.25 = [44 x i8] c"sres: error: The reservation does not exist\00"
@str.26 = [58 x i8] c"sres: error: There is no owner ie:user of the reservation\00"
@str.27 = [54 x i8] c"sres: error: Fail launching command scontrol show res\00"
@str.28 = [73 x i8] c"sres: error: you must indicate the reservation with reservation= or res=\00"
@str.29 = [56 x i8] c"sres: error: you must indicate only one username: yours\00"
@str.30 = [73 x i8] c"sres: error: you cannot create/modify/delete reservation for other users\00"
@str.31 = [37 x i8] c"sres: error: flags are not supported\00"
@str.32 = [66 x i8] c"sres: error: only create, update or delete operations are allowed\00"
@str.33 = [28 x i8] c"sres: error: No arguments !\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [512 x i8]
%4 = alloca [56 x i8]
%5 = add nsw i32 %0, 1
%6 = sext i32 %5 to i64
%7 = shl nsw i64 %6, 3
%8 = alloca i8*, i64 %7
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [56 x i8], [56 x i8]* %4, i64 0, i64 0
%11 = icmp eq i32 %0, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.33, i64 0, i64 0))
br label %178
14: ; preds = %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %8
%15 = getelementptr inbounds i8*, i8** %8, i64 1
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = shl i32 %0, 3
%18 = call i32 @memcpy(i8** %15, i8** %16, i32 %17)
%19 = getelementptr inbounds i8*, i8** %8, i64 %6
store i8* null, i8** %19
%20 = load i8*, i8** %15
%21 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %33, label %23
23: ; preds = %14
%24 = load i8*, i8** %15
%25 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %23
%28 = load i8*, i8** %15
%29 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %27
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.32, i64 0, i64 0))
br label %178
33: ; preds = %27, %23, %14
%34 = getelementptr inbounds i8*, i8** %8, i64 2
%35 = load i8*, i8** %34
%36 = icmp eq i8* %35, null
br i1 %36, label %44, label %37
37: ; preds = %33
%38 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %35, i32 3)
%39 = icmp eq i64 %38, 0
br i1 %39, label %47, label %40
40: ; preds = %37
%41 = load i8*, i8** %34
%42 = call i64 @strncmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* %41, i32 11)
%43 = icmp eq i64 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %40, %33
%45 = load i8*, i8** %1
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0), i8* %45)
br label %178
47: ; preds = %40, %37
%48 = call i32 @flagopt(i32 %0, i8** %1)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.31, i64 0, i64 0))
br label %178
52: ; preds = %47
%53 = call i32 @useropt(i32 %0, i8** %1)
switch i32 %53, label %58 [
i32 1, label %54
i32 -2, label %56
]
54: ; preds = %52
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.30, i64 0, i64 0))
br label %178
56: ; preds = %52
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.29, i64 0, i64 0))
br label %178
58: ; preds = %52
%59 = load i8*, i8** %15
%60 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %66, label %62
62: ; preds = %58
%63 = load i8*, i8** %15
%64 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %170
66: ; preds = %62, %58
%67 = icmp sgt i32 %0, 2
br i1 %67, label %68, label %102
68: ; preds = %66
%69 = zext i32 %0 to i64
br label %70
70: ; preds = %68, %99
%71 = phi i64 [ 2, %68 ], [ %100, %99 ]
%72 = getelementptr inbounds i8*, i8** %8, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 @strlen(i8* %73)
%75 = icmp sgt i32 %74, 11
%76 = load i8*, i8** %72
br i1 %75, label %77, label %86
77: ; preds = %70
%78 = call i64 @strncasecmp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %76, i32 11)
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %86
80: ; preds = %77
%81 = call dereferenceable_or_null(4294967293) i8* @malloc(i32 -3)
%82 = getelementptr inbounds i8, i8* %76, i64 11
%83 = call i32 @strlen(i8* %76)
%84 = add nsw i32 %83, -11
%85 = call i32 @strncpy(i8* %81, i8* %82, i32 %84)
br label %104
86: ; preds = %70, %77
%87 = call i32 @strlen(i8* %76)
%88 = icmp sgt i32 %87, 4
br i1 %88, label %89, label %99
89: ; preds = %86
%90 = load i8*, i8** %72
%91 = call i64 @strncasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %90, i32 4)
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %99
93: ; preds = %89
%94 = call dereferenceable_or_null(4) i8* @malloc(i32 4)
%95 = getelementptr inbounds i8, i8* %90, i64 4
%96 = call i32 @strlen(i8* %90)
%97 = add nsw i32 %96, -4
%98 = call i32 @strncpy(i8* %94, i8* %95, i32 %97)
br label %104
99: ; preds = %86, %89
%100 = add nuw nsw i64 %71, 1
%101 = icmp eq i64 %100, %69
br i1 %101, label %102, label %70
102: ; preds = %99, %66
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.28, i64 0, i64 0))
br label %178
104: ; preds = %93, %80
%105 = phi i8* [ %81, %80 ], [ %94, %93 ]
%106 = call i32 @strlen(i8* %105)
%107 = call i32 @strlen(i8* %10)
%108 = add nsw i32 %107, %106
%109 = call i8* @malloc(i32 %108)
%110 = call i32 @sprintf(i8* dereferenceable(1) %109, i8* %10, i8* %105)
%111 = call i32* @popen(i8* %109, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%112 = icmp eq i32* %111, null
br i1 %112, label %118, label %113
113: ; preds = %104
%114 = call i32* @fgets(i8* %9, i32 512, i32* %111)
%115 = icmp eq i32* %114, null
br i1 %115, label %141, label %116
116: ; preds = %113
%117 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 6
br label %120
118: ; preds = %104
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.27, i64 0, i64 0))
br label %178
120: ; preds = %116, %126
%121 = phi i32 [ 0, %116 ], [ %127, %126 ]
%122 = call i32 @strlen(i8* %9)
%123 = icmp slt i32 %122, 7
br i1 %123, label %124, label %126
124: ; preds = %120
%125 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.26, i64 0, i64 0))
br label %178
126: ; preds = %120
%127 = add nuw nsw i32 %121, 1
%128 = call i32 @strlen(i8* %9)
%129 = add nsw i32 %128, -6
%130 = call i8* @malloc(i32 %129)
%131 = call i32 @strlen(i8* %9)
%132 = add nsw i32 %131, -7
%133 = call i32 @strncpy(i8* %130, i8* %117, i32 %132)
%134 = call i32* @fgets(i8* %9, i32 512, i32* %111)
%135 = icmp eq i32* %134, null
br i1 %135, label %136, label %120
136: ; preds = %126
%137 = icmp eq i32 %121, 0
br i1 %137, label %138, label %143
138: ; preds = %136
%139 = call i32 @strlen(i8* %130)
%140 = icmp sgt i32 %139, 0
br i1 %140, label %149, label %157
141: ; preds = %113
%142 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.25, i64 0, i64 0))
br label %178
143: ; preds = %136
%144 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.24, i64 0, i64 0))
br label %178
145: ; preds = %149
%146 = call i32 @strlen(i8* %130)
%147 = sext i32 %146 to i64
%148 = icmp slt i64 %154, %147
br i1 %148, label %149, label %157
149: ; preds = %138, %145
%150 = phi i64 [ %154, %145 ], [ 0, %138 ]
%151 = getelementptr inbounds i8, i8* %130, i64 %150
%152 = load i8, i8* %151
%153 = icmp eq i8 %152, 44
%154 = add nuw nsw i64 %150, 1
br i1 %153, label %155, label %145
155: ; preds = %149
%156 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.23, i64 0, i64 0))
br label %178
157: ; preds = %145, %138
%158 = call i32 (...) @getuid()
%159 = call i32 @useruid(i8* %130)
%160 = icmp eq i32 %159, -1
br i1 %160, label %178, label %161
161: ; preds = %157
%162 = icmp eq i32 %158, %159
br i1 %162, label %165, label %163
163: ; preds = %161
%164 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.30, i64 0, i64 0))
br label %178
165: ; preds = %161
%166 = call i32 @free(i8* %109)
%167 = call i32 @free(i8* %105)
%168 = call i32 @free(i8* %130)
%169 = call i32 @pclose(i32* %111)
br label %174
170: ; preds = %62
%171 = icmp eq i32 %53, -1
br i1 %171, label %172, label %174
172: ; preds = %170
%173 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
br label %178
174: ; preds = %170, %165
%175 = call i32 @execvp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %8)
%176 = icmp eq i32 %175, 0
%177 = select i1 %176, i32* @EXIT_SUCCESS, i32* @EXIT_FAILURE
br label %178
178: ; preds = %174, %157, %172, %163, %155, %143, %141, %124, %118, %102, %56, %54, %50, %44, %31, %12
%179 = phi i32* [ @EXIT_FAILURE, %12 ], [ @EXIT_FAILURE, %31 ], [ @EXIT_FAILURE, %44 ], [ @EXIT_FAILURE, %50 ], [ @EXIT_FAILURE, %54 ], [ @EXIT_FAILURE, %56 ], [ @EXIT_FAILURE, %102 ], [ @EXIT_FAILURE, %118 ], [ @EXIT_FAILURE, %124 ], [ @EXIT_FAILURE, %141 ], [ @EXIT_FAILURE, %143 ], [ @EXIT_FAILURE, %155 ], [ @EXIT_FAILURE, %163 ], [ @EXIT_FAILURE, %172 ], [ @EXIT_FAILURE, %157 ], [ %177, %174 ]
%180 = load i32, i32* %179
ret i32 %180
}