#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 */

/* Variables and functions */
int /*<<< orphan*/ GETVAL;
int IPC_CREAT;
int IPC_EXCL;
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ SETVAL;
int check_sem_by_id(int, int, int);
scalar_t__ check_sem_by_key(int, int);
int /*<<< orphan*/ errno;
int ftok(char *, int);
int lrand48();
int semctl(int, int, int /*<<< orphan*/, ...);
int semget(int, int, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ test_daemon();
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, ...);
int /*<<< orphan*/ test_waitsig();
int main(int argc, char **argv) {
  int id, key;
  int i;
  int val[10];
  int ret, fail_count = 0;
  test_init(argc, argv);
  key = ftok(argv[0], 89063453);
  if (key == -1) {
    test_msg("ERR: %s:%d: "
             "Can't make key"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/static/sem.c",
             121, errno, strerror(errno));
    return -1;
  }
  id = semget(key, 10, 0777 | IPC_CREAT | IPC_EXCL);
  if (id == -1) {
    fail_count++;
    test_msg("ERR: %s:%d: "
             "Can't get sem array"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/static/sem.c",
             128, errno, strerror(errno));
    goto out;
  }
  for (i = 0; i < 10; i++) {
    val[i] = lrand48() & 0x7;
    if (semctl(id, i, SETVAL, val[i]) == -1) {
      fail_count++;
      test_msg("ERR: %s:%d: "
               "Can't init sem %d"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/static/sem.c",
               137, i, errno, strerror(errno));
      goto out_destroy;
    }
  }
  test_daemon();
  test_waitsig();
  for (i = 0; i < 10; i++) {
    ret = check_sem_by_id(id, i, val[i]);
    if (ret < 0) {
      fail_count++;
      test_msg("FAIL: %s:%d: "
               "Check sem %d by id failed"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/static/sem.c",
               149, i, errno, strerror(errno));
      goto out_destroy;
    }
    if (check_sem_by_key(key, i) < 0) {
      test_msg("FAIL: %s:%d: "
               "Check sem %d by key failed"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/static/sem.c",
               154, i, errno, strerror(errno));
      fail_count++;
      goto out_destroy;
    }
    val[i] = semctl(id, 0, GETVAL);
    if (val[i] < 0) {
      test_msg("FAIL: %s:%d: "
               "Failed to get sem %d value"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/static/sem.c",
               161, i, errno, strerror(errno));
      fail_count++;
      goto out_destroy;
    }
    if (val[i] != 0) {
      test_msg("FAIL: %s:%d: "
               "Non-zero sem %d value: %d"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/static/sem.c",
               166, val, errno, strerror(errno));
      fail_count++;
    }
  }
out_destroy:
  ret = semctl(id, 0, IPC_RMID);
  if (ret < 0) {
    test_msg("FAIL: %s:%d: "
             "Destroy sem array failed"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/static/sem.c",
             174, errno, strerror(errno));
    fail_count++;
  }
out:
  if (fail_count == 0)
    test_msg("PASS\n");
  return fail_count;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <test_init@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x54f001d,%esi
call   10c0 <ftok@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1240 <main+0x90>
mov    0x2dd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x5c(%rbp),%ecx
mov    %eax,%r8d
lea    0xddf(%rip),%rdi
lea    0xe06(%rip),%rsi
mov    $0x79,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15f4 <main+0x444>
mov    -0x18(%rbp),%edi
mov    0x2d76(%rip),%rax
mov    (%rax),%edx
or     $0x1ff,%edx
mov    0x2d97(%rip),%rax
or     (%rax),%edx
mov    $0xa,%esi
call   1030 <semget@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12ba <main+0x10a>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    0x2d56(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x60(%rbp),%ecx
mov    %eax,%r8d
lea    0xe27(%rip),%rdi
lea    0xd85(%rip),%rsi
mov    $0x80,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
jmp    15d6 <main+0x426>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    136b <main+0x1bb>
mov    $0x0,%al
call   10a0 <lrand48@plt>
mov    %eax,%ecx
and    $0x7,%ecx
movslq -0x1c(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    0x2ccc(%rip),%rax
mov    (%rax),%edx
movslq -0x1c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%ecx
mov    $0x0,%al
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
jne    1358 <main+0x1a8>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x68(%rbp),%ecx
mov    -0x64(%rbp),%r8d
mov    %eax,%r9d
lea    0xdbc(%rip),%rdi
lea    0xce7(%rip),%rsi
mov    $0x89,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
jmp    1566 <main+0x3b6>
jmp    135d <main+0x1ad>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12c1 <main+0x111>
mov    $0x0,%al
call   1060 <test_daemon@plt>
mov    $0x0,%al
call   1080 <test_waitsig@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    1561 <main+0x3b1>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
movslq -0x1c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
call   1090 <check_sem_by_id@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    13fc <main+0x24c>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    0x2c18(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2c0c(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x70(%rbp),%ecx
mov    -0x6c(%rbp),%r8d
mov    %eax,%r9d
lea    0xd49(%rip),%rdi
lea    0xc43(%rip),%rsi
mov    $0x95,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
jmp    1566 <main+0x3b6>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1050 <check_sem_by_key@plt>
cmp    $0x0,%rax
jge    1463 <main+0x2b3>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    0x2bba(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2bae(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x78(%rbp),%ecx
mov    -0x74(%rbp),%r8d
mov    %eax,%r9d
lea    0xd25(%rip),%rdi
lea    0xbe5(%rip),%rsi
mov    $0x9a,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1566 <main+0x3b6>
mov    -0x14(%rbp),%edi
mov    0x2b5b(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    $0x0,%al
call   10b0 <semctl@plt>
mov    %eax,%ecx
movslq -0x1c(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x1c(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
jge    14e3 <main+0x333>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    0x2b3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2b2e(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x80(%rbp),%ecx
mov    -0x7c(%rbp),%r8d
mov    %eax,%r9d
lea    0xce0(%rip),%rdi
lea    0xb65(%rip),%rsi
mov    $0xa1,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1566 <main+0x3b6>
movslq -0x1c(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     154e <main+0x39e>
lea    -0x50(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    0x2ad4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2ac5(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x90(%rbp),%rcx
mov    -0x84(%rbp),%r8d
mov    %eax,%r9d
lea    0xcab(%rip),%rdi
lea    0xaf5(%rip),%rsi
mov    $0xa6,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1553 <main+0x3a3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1380 <main+0x1d0>
jmp    1566 <main+0x3b6>
mov    -0x14(%rbp),%edi
mov    0x2a60(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    $0x0,%al
call   10b0 <semctl@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    15d1 <main+0x421>
mov    0x2a49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    0x2a3a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x94(%rbp),%ecx
mov    %eax,%r8d
lea    0xc62(%rip),%rdi
lea    0xa72(%rip),%rsi
mov    $0xae,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    15d6 <main+0x426>
cmpl   $0x0,-0x58(%rbp)
jne    15ee <main+0x43e>
lea    0xc69(%rip),%rdi
mov    $0x0,%al
call   1070 <test_msg@plt>
mov    -0x58(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
call   1040 <test_init@plt>
mov    (%rbx),%rdi
mov    $0x54f001d,%esi
call   10c0 <ftok@plt>
cmp    $0xffffffff,%eax
je     1555 <main+0x3a5>
mov    %eax,%r12d
mov    0x2dda(%rip),%rax
mov    (%rax),%edx
mov    0x2e01(%rip),%rax
or     (%rax),%edx
or     $0x1ff,%edx
mov    %r12d,%edi
mov    $0xa,%esi
call   1030 <semget@plt>
cmp    $0xffffffff,%eax
je     158b <main+0x3db>
mov    %eax,%r14d
xor    %ebp,%ebp
xor    %eax,%eax
call   10a0 <lrand48@plt>
mov    %eax,%ebx
and    $0x7,%ebx
mov    %ebx,(%rsp)
mov    0x2d90(%rip),%r13
mov    0x0(%r13),%edx
mov    %r14d,%edi
xor    %esi,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x4(%rsp)
mov    0x0(%r13),%edx
mov    $0x1,%ebp
mov    %r14d,%edi
mov    $0x1,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x8(%rsp)
mov    0x0(%r13),%edx
mov    $0x2,%ebp
mov    %r14d,%edi
mov    $0x2,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0xc(%rsp)
mov    0x0(%r13),%edx
mov    $0x3,%ebp
mov    %r14d,%edi
mov    $0x3,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x10(%rsp)
mov    0x0(%r13),%edx
mov    $0x4,%ebp
mov    %r14d,%edi
mov    $0x4,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x14(%rsp)
mov    0x0(%r13),%edx
mov    $0x5,%ebp
mov    %r14d,%edi
mov    $0x5,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x18(%rsp)
mov    0x0(%r13),%edx
mov    $0x6,%ebp
mov    %r14d,%edi
mov    $0x6,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x1c(%rsp)
mov    0x0(%r13),%edx
mov    $0x7,%ebp
mov    %r14d,%edi
mov    $0x7,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x20(%rsp)
mov    0x0(%r13),%edx
mov    $0x8,%ebp
mov    %r14d,%edi
mov    $0x8,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %r15d,%r15d
xor    %eax,%eax
call   10a0 <lrand48@plt>
and    $0x7,%eax
mov    %eax,0x24(%rsp)
mov    0x0(%r13),%edx
mov    $0x9,%ebp
mov    %r14d,%edi
mov    $0x9,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <semctl@plt>
cmp    $0xffffffff,%eax
je     14f8 <main+0x348>
xor    %eax,%eax
call   1060 <test_daemon@plt>
xor    %eax,%eax
call   1080 <test_waitsig@plt>
mov    %r14d,%edi
xor    %esi,%esi
mov    %ebx,%edx
call   1090 <check_sem_by_id@plt>
mov    $0x0,%ebx
test   %eax,%eax
js     14c0 <main+0x310>
mov    0x2b9b(%rip),%r13
xor    %ebx,%ebx
xor    %r15d,%r15d
mov    %r12d,%edi
mov    %r15d,%esi
call   1050 <check_sem_by_key@plt>
test   %rax,%rax
js     1618 <main+0x468>
mov    0x0(%r13),%edx
mov    %r14d,%edi
xor    %esi,%esi
xor    %eax,%eax
call   10b0 <semctl@plt>
mov    %eax,(%rsp,%r15,4)
test   %eax,%eax
js     163d <main+0x48d>
je     149a <main+0x2ea>
mov    0x2b6d(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10d0 <strerror@plt>
lea    0xd62(%rip),%rdi
lea    0xbac(%rip),%rsi
mov    $0xa6,%edx
mov    %rsp,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <test_msg@plt>
add    $0x1,%ebx
cmp    $0x9,%r15
je     152f <main+0x37f>
mov    0x4(%rsp,%r15,4),%edx
add    $0x1,%r15
mov    %r14d,%edi
mov    %r15d,%esi
call   1090 <check_sem_by_id@plt>
test   %eax,%eax
jns    1432 <main+0x282>
add    $0x1,%ebx
mov    0x2b0e(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10d0 <strerror@plt>
lea    0xc53(%rip),%rdi
lea    0xb4d(%rip),%rsi
mov    $0x95,%edx
mov    %r15d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <test_msg@plt>
jmp    152f <main+0x37f>
mov    0x2ad9(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xbed(%rip),%rdi
lea    0xb18(%rip),%rsi
mov    $0x89,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <test_msg@plt>
mov    $0x1,%ebx
mov    0x2a9a(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
xor    %esi,%esi
xor    %eax,%eax
call   10b0 <semctl@plt>
test   %eax,%eax
js     15c1 <main+0x411>
test   %ebx,%ebx
jne    1607 <main+0x457>
jmp    15f7 <main+0x447>
mov    0x2a7c(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xa94(%rip),%rdi
lea    0xabb(%rip),%rsi
mov    $0x79,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <test_msg@plt>
mov    $0xffffffff,%ebx
jmp    1607 <main+0x457>
mov    0x2a46(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xb27(%rip),%rdi
lea    0xa85(%rip),%rsi
mov    $0x80,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <test_msg@plt>
mov    $0x1,%ebx
jmp    1607 <main+0x457>
mov    0x2a10(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10d0 <strerror@plt>
lea    0xc3f(%rip),%rdi
lea    0xa4f(%rip),%rsi
mov    $0xae,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <test_msg@plt>
add    $0x1,%ebx
test   %ebx,%ebx
jne    1607 <main+0x457>
lea    0xc52(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <test_msg@plt>
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29b9(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10d0 <strerror@plt>
lea    0xb38(%rip),%rdi
lea    0x9f8(%rip),%rsi
mov    $0x9a,%edx
jmp    1660 <main+0x4b0>
mov    0x2994(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10d0 <strerror@plt>
lea    0xb4e(%rip),%rdi
lea    0x9d3(%rip),%rsi
mov    $0xa1,%edx
mov    %r15d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <test_msg@plt>
add    $0x1,%ebx
jmp    152f <main+0x37f>

LLVM IR (-O0):
@.str = [46 x i8] c"ERR: %s:%d: Can't make key (errno = %d (%s))\0A\00"
@.str.1 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/static/sem.c\00"
@errno = global i32 0
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str.2 = [51 x i8] c"ERR: %s:%d: Can't get sem array (errno = %d (%s))\0A\00"
@SETVAL = global i32 0
@.str.3 = [49 x i8] c"ERR: %s:%d: Can't init sem %d (errno = %d (%s))\0A\00"
@.str.4 = [58 x i8] c"FAIL: %s:%d: Check sem %d by id failed (errno = %d (%s))\0A\00"
@.str.5 = [59 x i8] c"FAIL: %s:%d: Check sem %d by key failed (errno = %d (%s))\0A\00"
@GETVAL = global i32 0
@.str.6 = [59 x i8] c"FAIL: %s:%d: Failed to get sem %d value (errno = %d (%s))\0A\00"
@.str.7 = [58 x i8] c"FAIL: %s:%d: Non-zero sem %d value: %d (errno = %d (%s))\0A\00"
@IPC_RMID = global i32 0
@.str.8 = [57 x i8] c"FAIL: %s:%d: Destroy sem array failed (errno = %d (%s))\0A\00"
@.str.9 = [6 x i8] c"PASS\0A\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 [10 x i32]
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @test_init(i32 %12, i8** %13)
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @ftok(i8* %17, i32 89063453)
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %26
21: ; preds = %2
%22 = load i32, i32* @errno
%23 = load i32, i32* @errno
%24 = call i32 @strerror(i32 %23)
%25 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 121, i32 %22, i32 %24)
store i32 -1, i32* %3
br label %170
26: ; preds = %2
%27 = load i32, i32* %7
%28 = load i32, i32* @IPC_CREAT
%29 = or i32 511, %28
%30 = load i32, i32* @IPC_EXCL
%31 = or i32 %29, %30
%32 = call i32 @semget(i32 %27, i32 10, i32 %31)
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %42
35: ; preds = %26
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
store i32 %37, i32* %11
%38 = load i32, i32* @errno
%39 = load i32, i32* @errno
%40 = call i32 @strerror(i32 %39)
%41 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 128, i32 %38, i32 %40)
br label %163
42: ; preds = %26
store i32 0, i32* %8
br label %43
43: ; preds = %70, %42
%44 = load i32, i32* %8
%45 = icmp slt i32 %44, 10
br i1 %45, label %46, label %73
46: ; preds = %43
%47 = call i32 (...) @lrand48()
%48 = and i32 %47, 7
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %50
store i32 %48, i32* %51
%52 = load i32, i32* %6
%53 = load i32, i32* %8
%54 = load i32, i32* @SETVAL
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = call i32 (i32, i32, i32, ...) @semctl(i32 %52, i32 %53, i32 %54, i32 %58)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %69
61: ; preds = %46
%62 = load i32, i32* %11
%63 = add nsw i32 %62, 1
store i32 %63, i32* %11
%64 = load i32, i32* %8
%65 = load i32, i32* @errno
%66 = load i32, i32* @errno
%67 = call i32 @strerror(i32 %66)
%68 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 137, i32 %64, i32 %65, i32 %67)
br label %149
69: ; preds = %46
br label %70
70: ; preds = %69
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %43
73: ; preds = %43
%74 = call i32 (...) @test_daemon()
%75 = call i32 (...) @test_waitsig()
store i32 0, i32* %8
br label %76
76: ; preds = %145, %73
%77 = load i32, i32* %8
%78 = icmp slt i32 %77, 10
br i1 %78, label %79, label %148
79: ; preds = %76
%80 = load i32, i32* %6
%81 = load i32, i32* %8
%82 = load i32, i32* %8
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %83
%85 = load i32, i32* %84
%86 = call i32 @check_sem_by_id(i32 %80, i32 %81, i32 %85)
store i32 %86, i32* %10
%87 = load i32, i32* %10
%88 = icmp slt i32 %87, 0
br i1 %88, label %89, label %97
89: ; preds = %79
%90 = load i32, i32* %11
%91 = add nsw i32 %90, 1
store i32 %91, i32* %11
%92 = load i32, i32* %8
%93 = load i32, i32* @errno
%94 = load i32, i32* @errno
%95 = call i32 @strerror(i32 %94)
%96 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 149, i32 %92, i32 %93, i32 %95)
br label %149
97: ; preds = %79
%98 = load i32, i32* %7
%99 = load i32, i32* %8
%100 = call i64 @check_sem_by_key(i32 %98, i32 %99)
%101 = icmp slt i64 %100, 0
br i1 %101, label %102, label %110
102: ; preds = %97
%103 = load i32, i32* %8
%104 = load i32, i32* @errno
%105 = load i32, i32* @errno
%106 = call i32 @strerror(i32 %105)
%107 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 154, i32 %103, i32 %104, i32 %106)
%108 = load i32, i32* %11
%109 = add nsw i32 %108, 1
store i32 %109, i32* %11
br label %149
110: ; preds = %97
%111 = load i32, i32* %6
%112 = load i32, i32* @GETVAL
%113 = call i32 (i32, i32, i32, ...) @semctl(i32 %111, i32 0, i32 %112)
%114 = load i32, i32* %8
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %115
store i32 %113, i32* %116
%117 = load i32, i32* %8
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %118
%120 = load i32, i32* %119
%121 = icmp slt i32 %120, 0
br i1 %121, label %122, label %130
122: ; preds = %110
%123 = load i32, i32* %8
%124 = load i32, i32* @errno
%125 = load i32, i32* @errno
%126 = call i32 @strerror(i32 %125)
%127 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 161, i32 %123, i32 %124, i32 %126)
%128 = load i32, i32* %11
%129 = add nsw i32 %128, 1
store i32 %129, i32* %11
br label %149
130: ; preds = %110
%131 = load i32, i32* %8
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %132
%134 = load i32, i32* %133
%135 = icmp ne i32 %134, 0
br i1 %135, label %136, label %144
136: ; preds = %130
%137 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%138 = load i32, i32* @errno
%139 = load i32, i32* @errno
%140 = call i32 @strerror(i32 %139)
%141 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 166, i32* %137, i32 %138, i32 %140)
%142 = load i32, i32* %11
%143 = add nsw i32 %142, 1
store i32 %143, i32* %11
br label %144
144: ; preds = %136, %130
br label %145
145: ; preds = %144
%146 = load i32, i32* %8
%147 = add nsw i32 %146, 1
store i32 %147, i32* %8
br label %76
148: ; preds = %76
br label %149
149: ; preds = %148, %122, %102, %89, %61
%150 = load i32, i32* %6
%151 = load i32, i32* @IPC_RMID
%152 = call i32 (i32, i32, i32, ...) @semctl(i32 %150, i32 0, i32 %151)
store i32 %152, i32* %10
%153 = load i32, i32* %10
%154 = icmp slt i32 %153, 0
br i1 %154, label %155, label %162
155: ; preds = %149
%156 = load i32, i32* @errno
%157 = load i32, i32* @errno
%158 = call i32 @strerror(i32 %157)
%159 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 174, i32 %156, i32 %158)
%160 = load i32, i32* %11
%161 = add nsw i32 %160, 1
store i32 %161, i32* %11
br label %162
162: ; preds = %155, %149
br label %163
163: ; preds = %162, %35
%164 = load i32, i32* %11
%165 = icmp eq i32 %164, 0
br i1 %165, label %166, label %168
166: ; preds = %163
%167 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %168
168: ; preds = %166, %163
%169 = load i32, i32* %11
store i32 %169, i32* %3
br label %170
170: ; preds = %168, %21
%171 = load i32, i32* %3
ret i32 %171
}

LLVM IR (-O2):
@.str = [46 x i8] c"ERR: %s:%d: Can't make key (errno = %d (%s))\0A\00"
@.str.1 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/static/sem.c\00"
@errno = global i32 0
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str.2 = [51 x i8] c"ERR: %s:%d: Can't get sem array (errno = %d (%s))\0A\00"
@SETVAL = global i32 0
@.str.3 = [49 x i8] c"ERR: %s:%d: Can't init sem %d (errno = %d (%s))\0A\00"
@.str.4 = [58 x i8] c"FAIL: %s:%d: Check sem %d by id failed (errno = %d (%s))\0A\00"
@.str.5 = [59 x i8] c"FAIL: %s:%d: Check sem %d by key failed (errno = %d (%s))\0A\00"
@GETVAL = global i32 0
@.str.6 = [59 x i8] c"FAIL: %s:%d: Failed to get sem %d value (errno = %d (%s))\0A\00"
@.str.7 = [58 x i8] c"FAIL: %s:%d: Non-zero sem %d value: %d (errno = %d (%s))\0A\00"
@IPC_RMID = global i32 0
@.str.8 = [57 x i8] c"FAIL: %s:%d: Destroy sem array failed (errno = %d (%s))\0A\00"
@.str.9 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = tail call i32 @test_init(i32 %0, i8** %1)
%6 = load i8*, i8** %1
%7 = tail call i32 @ftok(i8* %6, i32 89063453)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @errno
%11 = tail call i32 @strerror(i32 %10)
%12 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 121, i32 %10, i32 %11)
br label %171
13: ; preds = %2
%14 = load i32, i32* @IPC_CREAT
%15 = load i32, i32* @IPC_EXCL
%16 = or i32 %14, %15
%17 = or i32 %16, 511
%18 = tail call i32 @semget(i32 %7, i32 10, i32 %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %27, label %20
20: ; preds = %13
%21 = tail call i32 (...) @lrand48()
%22 = and i32 %21, 7
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32 %22, i32* %23
%24 = load i32, i32* @SETVAL
%25 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 0, i32 %24, i32 %22)
%26 = icmp eq i32 %25, -1
br i1 %26, label %31, label %36
27: ; preds = %13
%28 = load i32, i32* @errno
%29 = tail call i32 @strerror(i32 %28)
%30 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 128, i32 %28, i32 %29)
br label %171
31: ; preds = %92, %85, %78, %71, %64, %57, %50, %43, %36, %20
%32 = phi i32 [ 0, %20 ], [ 1, %36 ], [ 2, %43 ], [ 3, %50 ], [ 4, %57 ], [ 5, %64 ], [ 6, %71 ], [ 7, %78 ], [ 8, %85 ], [ 9, %92 ]
%33 = load i32, i32* @errno
%34 = tail call i32 @strerror(i32 %33)
%35 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 137, i32 %32, i32 %33, i32 %34)
br label %156
36: ; preds = %20
%37 = tail call i32 (...) @lrand48()
%38 = and i32 %37, 7
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
store i32 %38, i32* %39
%40 = load i32, i32* @SETVAL
%41 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 1, i32 %40, i32 %38)
%42 = icmp eq i32 %41, -1
br i1 %42, label %31, label %43
43: ; preds = %36
%44 = tail call i32 (...) @lrand48()
%45 = and i32 %44, 7
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
store i32 %45, i32* %46
%47 = load i32, i32* @SETVAL
%48 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 2, i32 %47, i32 %45)
%49 = icmp eq i32 %48, -1
br i1 %49, label %31, label %50
50: ; preds = %43
%51 = tail call i32 (...) @lrand48()
%52 = and i32 %51, 7
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
store i32 %52, i32* %53
%54 = load i32, i32* @SETVAL
%55 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 3, i32 %54, i32 %52)
%56 = icmp eq i32 %55, -1
br i1 %56, label %31, label %57
57: ; preds = %50
%58 = tail call i32 (...) @lrand48()
%59 = and i32 %58, 7
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
store i32 %59, i32* %60
%61 = load i32, i32* @SETVAL
%62 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 4, i32 %61, i32 %59)
%63 = icmp eq i32 %62, -1
br i1 %63, label %31, label %64
64: ; preds = %57
%65 = tail call i32 (...) @lrand48()
%66 = and i32 %65, 7
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
store i32 %66, i32* %67
%68 = load i32, i32* @SETVAL
%69 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 5, i32 %68, i32 %66)
%70 = icmp eq i32 %69, -1
br i1 %70, label %31, label %71
71: ; preds = %64
%72 = tail call i32 (...) @lrand48()
%73 = and i32 %72, 7
%74 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
store i32 %73, i32* %74
%75 = load i32, i32* @SETVAL
%76 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 6, i32 %75, i32 %73)
%77 = icmp eq i32 %76, -1
br i1 %77, label %31, label %78
78: ; preds = %71
%79 = tail call i32 (...) @lrand48()
%80 = and i32 %79, 7
%81 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
store i32 %80, i32* %81
%82 = load i32, i32* @SETVAL
%83 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 7, i32 %82, i32 %80)
%84 = icmp eq i32 %83, -1
br i1 %84, label %31, label %85
85: ; preds = %78
%86 = tail call i32 (...) @lrand48()
%87 = and i32 %86, 7
%88 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
store i32 %87, i32* %88
%89 = load i32, i32* @SETVAL
%90 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 8, i32 %89, i32 %87)
%91 = icmp eq i32 %90, -1
br i1 %91, label %31, label %92
92: ; preds = %85
%93 = tail call i32 (...) @lrand48()
%94 = and i32 %93, 7
%95 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
store i32 %94, i32* %95
%96 = load i32, i32* @SETVAL
%97 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 9, i32 %96, i32 %94)
%98 = icmp eq i32 %97, -1
br i1 %98, label %31, label %99
99: ; preds = %92
%100 = tail call i32 (...) @test_daemon()
%101 = tail call i32 (...) @test_waitsig()
%102 = call i32 @check_sem_by_id(i32 %18, i32 0, i32 %22)
%103 = icmp slt i32 %102, 0
br i1 %103, label %108, label %104
104: ; preds = %99
%105 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
br label %115
106: ; preds = %149
%107 = trunc i64 %147 to i32
br label %108
108: ; preds = %106, %99
%109 = phi i32 [ %107, %106 ], [ 0, %99 ]
%110 = phi i32 [ %146, %106 ], [ 0, %99 ]
%111 = add nsw i32 %110, 1
%112 = load i32, i32* @errno
%113 = call i32 @strerror(i32 %112)
%114 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 149, i32 %109, i32 %112, i32 %113)
br label %156
115: ; preds = %104, %149
%116 = phi i32 [ 0, %104 ], [ %153, %149 ]
%117 = phi i32* [ %105, %104 ], [ %152, %149 ]
%118 = phi i32 [ 0, %104 ], [ %146, %149 ]
%119 = phi i64 [ 0, %104 ], [ %147, %149 ]
%120 = call i64 @check_sem_by_key(i32 %7, i32 %116)
%121 = icmp slt i64 %120, 0
br i1 %121, label %122, label %128
122: ; preds = %115
%123 = trunc i64 %119 to i32
%124 = load i32, i32* @errno
%125 = call i32 @strerror(i32 %124)
%126 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 154, i32 %123, i32 %124, i32 %125)
%127 = add nsw i32 %118, 1
br label %156
128: ; preds = %115
%129 = load i32, i32* @GETVAL
%130 = call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 0, i32 %129)
store i32 %130, i32* %117
%131 = icmp slt i32 %130, 0
br i1 %131, label %132, label %138
132: ; preds = %128
%133 = trunc i64 %119 to i32
%134 = load i32, i32* @errno
%135 = call i32 @strerror(i32 %134)
%136 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 161, i32 %133, i32 %134, i32 %135)
%137 = add nsw i32 %118, 1
br label %156
138: ; preds = %128
%139 = icmp eq i32 %130, 0
br i1 %139, label %145, label %140
140: ; preds = %138
%141 = load i32, i32* @errno
%142 = call i32 @strerror(i32 %141)
%143 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 166, i32* %23, i32 %141, i32 %142)
%144 = add nsw i32 %118, 1
br label %145
145: ; preds = %138, %140
%146 = phi i32 [ %144, %140 ], [ %118, %138 ]
%147 = add nuw nsw i64 %119, 1
%148 = icmp eq i64 %147, 10
br i1 %148, label %156, label %149
149: ; preds = %145
%150 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %147
%151 = load i32, i32* %150
%152 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %147
%153 = trunc i64 %147 to i32
%154 = call i32 @check_sem_by_id(i32 %18, i32 %153, i32 %151)
%155 = icmp slt i32 %154, 0
br i1 %155, label %106, label %115
156: ; preds = %145, %132, %122, %108, %31
%157 = phi i32 [ 1, %31 ], [ %111, %108 ], [ %127, %122 ], [ %137, %132 ], [ %146, %145 ]
%158 = load i32, i32* @IPC_RMID
%159 = call i32 (i32, i32, i32, ...) @semctl(i32 %18, i32 0, i32 %158)
%160 = icmp slt i32 %159, 0
br i1 %160, label %161, label %166
161: ; preds = %156
%162 = load i32, i32* @errno
%163 = call i32 @strerror(i32 %162)
%164 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 174, i32 %162, i32 %163)
%165 = add nsw i32 %157, 1
br label %166
166: ; preds = %156, %161
%167 = phi i32 [ %165, %161 ], [ %157, %156 ]
%168 = icmp eq i32 %167, 0
br i1 %168, label %169, label %171
169: ; preds = %166
%170 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %171
171: ; preds = %27, %166, %169, %9
%172 = phi i32 [ -1, %9 ], [ 0, %169 ], [ %167, %166 ], [ 1, %27 ]
ret i32 %172
}