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

/* Variables and functions */
scalar_t__ EEXIST;
int IPC_CREAT;
int IPC_EXCL;
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ ftok(char *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ shmat(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ shmdt(char *);
int shmget(int /*<<< orphan*/, int, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[], char *env[]) {
  if (argc != 2 ||
      (strcmp(argv[1], "set") != 0 && strcmp(argv[1], "find") != 0)) {
    printf("Функция должна быть вызвана с аргументом set или find\n");
    return -1;
  }
  char *array;
  int shmid;
  int new = 1;
  char pathname[] = "lab06.c";
  key_t key;
  if ((key = ftok(pathname, 0)) < 0) {
    printf("Can\'t generate key\n");
    exit(-1);
  }
  if ((shmid = shmget(key, 4 * (32 + 10 + 2) * sizeof(char),
                      0666 | IPC_CREAT | IPC_EXCL)) < 0) {
    if (errno != EEXIST) {
      printf("Can\'t create shared memory\n");
      exit(-1);
    } else {
      if ((shmid = shmget(key, 4 * (32 + 10 + 2) * sizeof(char), 0)) < 0) {
        printf("Can\'t find shared memory\n");
        exit(-1);
      }
      new = 0;
    }
  }
  if ((array = (char *)shmat(shmid, NULL, 0)) == (char *)(-1)) {
    printf("Can't attach shared memory\n");
    exit(-1);
  }
  if (strcmp(argv[1], "find") == 0) {
    if (new) {
      printf("База открытий не заполнена. Режим поиска переведен в режим "
             "заполнения.\n");
      strcpy(argv[1], "set");
    } else {
      char name[32];
      memset(name, '\0', 32);
      printf("Введите название открытия: ");
      scanf("\n%[^\r\n]", name);
      int i;
      int result = 0;
      for (i = 0; i < 4 && !result; i++) {
        char tempname[32];
        memset(tempname, '\0', 32);
        strncpy(tempname, array + (i * (32 + 10 + 2)) * sizeof(char), 32);
        if (strcmp(tempname, name) == 0) {
          result = 1;
          char tempdate[10];
          memset(tempdate, '\0', 10);
          strncpy(tempdate, array + (i * (32 + 10 + 2) + 32 + 1) * sizeof(char),
                  10 + 1);
          printf(": %s\n", tempdate);
          printf("Дата открытия [%s] : %s\n", tempname, tempdate);
        }
      }
      if (!result)
        printf("Открытие не найдено.\n");
    }
  }
  if (strcmp(argv[1], "set") == 0) {
    char name[32];
    char date[10];
    int i;
    for (i = 0; i < 4; i++) {
      memset(name, '\0', 32);
      memset(date, '\0', 10);
      printf("Введите название открытия %d: ", i);
      scanf("\n%[^\r\n]", name);
      printf("Введите дату открытия [%s]: ", name);
      scanf("\n%[^\r\n]", date);
      strncpy(array + (i * (32 + 10 + 2)) * sizeof(char), name, 32);
      strncpy(array + (i * (32 + 10 + 2) + 32) * sizeof(char), "\0", 32);
      strncpy(array + (i * (32 + 10 + 2) + 32 + 1) * sizeof(char), date, 10);
      strncpy(array + ((i + 1) * (32 + 10 + 2) - 1) * sizeof(char), "\0", 10);
    }
    printf("Исследования успешно добавлены!\n");
  }
  printf("---\nПечать базы:\n");
  int j = 0;
  for (j = 0; j < 4 * (32 + 10 + 2); j++) {
    if (j % (32 + 10 + 2) == 0)
      printf("\n");
    if (array[j] == 0)
      printf("*");
    else
      printf("%c", array[j]);
  }
  printf("\n");
  if (shmdt(array) < 0) {
    printf("Can't detach shared memory\n");
    exit(-1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1213 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1a(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     122d <main+0x7d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe00(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     122d <main+0x7d>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1769 <main+0x5b9>
movl   $0x1,-0x28(%rbp)
mov    0xe2b(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
call   10d0 <ftok@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    126e <main+0xbe>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x34(%rbp),%edi
mov    0x2d50(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
mov    0x2d69(%rip),%rax
or     (%rax),%edx
mov    $0xb0,%esi
call   10b0 <shmget@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    1310 <main+0x160>
mov    0x2d2a(%rip),%rax
mov    (%rax),%rax
mov    0x2d28(%rip),%rcx
cmp    (%rcx),%rax
je     12d1 <main+0x121>
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x34(%rbp),%edi
mov    $0xb0,%esi
xor    %edx,%edx
call   10b0 <shmget@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    1304 <main+0x154>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x28(%rbp)
jmp    1310 <main+0x160>
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10a0 <shmat@plt>
mov    %rax,-0x20(%rbp)
mov    $0xffffffffffffffff,%rcx
cmp    %rcx,%rax
jne    134a <main+0x19a>
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcab(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1500 <main+0x350>
cmpl   $0x0,-0x28(%rbp)
je     1399 <main+0x1e9>
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc71(%rip),%rsi
call   1040 <strcpy@plt>
jmp    14fb <main+0x34b>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xdc8(%rip),%rdi
call   1090 <scanf@plt>
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x64(%rbp)
xor    %eax,%eax
cmpl   $0x4,-0x64(%rbp)
mov    %al,-0xd5(%rbp)
jge    13f6 <main+0x246>
cmpl   $0x0,-0x68(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0xd5(%rbp)
mov    -0xd5(%rbp),%al
test   $0x1,%al
jne    1409 <main+0x259>
jmp    14de <main+0x32e>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
lea    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rsi
imul   $0x2c,-0x64(%rbp),%eax
cltq
shl    $0x0,%rax
add    %rax,%rsi
mov    $0x20,%edx
call   1030 <strncpy@plt>
lea    -0x90(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    14cb <main+0x31b>
movl   $0x1,-0x68(%rbp)
lea    -0x9a(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <memset@plt>
lea    -0x9a(%rbp),%rdi
mov    -0x20(%rbp),%rsi
imul   $0x2c,-0x64(%rbp),%eax
add    $0x20,%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
add    %rax,%rsi
mov    $0xb,%edx
call   1030 <strncpy@plt>
lea    -0x9a(%rbp),%rsi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    -0x9a(%rbp),%rdx
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14d0 <main+0x320>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    13d5 <main+0x225>
cmpl   $0x0,-0x68(%rbp)
jne    14f6 <main+0x346>
lea    0xcc8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14fb <main+0x34b>
jmp    1500 <main+0x350>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xaf1(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1671 <main+0x4c1>
movl   $0x0,-0xd0(%rbp)
cmpl   $0x4,-0xd0(%rbp)
jge    1663 <main+0x4b3>
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
lea    -0xca(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <memset@plt>
mov    -0xd0(%rbp),%esi
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xc0(%rbp),%rsi
lea    0xc0d(%rip),%rdi
call   1090 <scanf@plt>
lea    -0xc0(%rbp),%rsi
lea    0xc84(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xca(%rbp),%rsi
lea    0xbe5(%rip),%rdi
call   1090 <scanf@plt>
mov    -0x20(%rbp),%rdi
imul   $0x2c,-0xd0(%rbp),%eax
cltq
shl    $0x0,%rax
add    %rax,%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x20,%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rdi
imul   $0x2c,-0xd0(%rbp),%eax
add    $0x20,%eax
cltq
shl    $0x0,%rax
add    %rax,%rdi
lea    0xcd1(%rip),%rsi
mov    $0x20,%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rdi
imul   $0x2c,-0xd0(%rbp),%eax
add    $0x20,%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
add    %rax,%rdi
lea    -0xca(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
imul   $0x2c,%eax,%eax
sub    $0x1,%eax
cltq
shl    $0x0,%rax
add    %rax,%rdi
lea    0xc79(%rip),%rsi
mov    $0xa,%edx
call   1030 <strncpy@plt>
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    1528 <main+0x378>
lea    0xbda(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc09(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xd4(%rbp)
cmpl   $0xb0,-0xd4(%rbp)
jge    1729 <main+0x579>
mov    -0xd4(%rbp),%eax
mov    $0x2c,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    16c8 <main+0x518>
lea    0xbbe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rax
movslq -0xd4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    16f3 <main+0x543>
lea    0xbb6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1710 <main+0x560>
mov    -0x20(%rbp),%rax
movslq -0xd4(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xb96(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1715 <main+0x565>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1693 <main+0x4e3>
lea    0xb4f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <shmdt@plt>
cmp    $0x0,%rax
jge    1762 <main+0x5b2>
lea    0xb51(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
cmp    $0x2,%edi
jne    1210 <main+0x40>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe0f(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1226 <main+0x56>
mov    0x8(%r14),%rdi
lea    0x1097(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1226 <main+0x56>
lea    0x102f(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%eax
jmp    155c <main+0x38c>
movabs $0x632e363062616c,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   10f0 <ftok@plt>
test   %eax,%eax
js     156b <main+0x39b>
mov    %eax,%ebp
mov    0x2d76(%rip),%rax
mov    (%rax),%edx
mov    0x2d95(%rip),%rax
or     (%rax),%edx
or     $0x1b6,%edx
mov    %ebp,%edi
mov    $0xb0,%esi
call   10d0 <shmget@plt>
mov    %eax,%ebx
mov    %eax,%edi
test   %eax,%eax
jns    12a9 <main+0xd9>
mov    0x2d52(%rip),%rax
mov    (%rax),%rax
mov    0x2d50(%rip),%rcx
cmp    (%rcx),%rax
jne    1586 <main+0x3b6>
mov    %ebp,%edi
mov    $0xb0,%esi
xor    %edx,%edx
call   10d0 <shmget@plt>
mov    %eax,%edi
test   %eax,%eax
js     158f <main+0x3bf>
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <shmat@plt>
cmp    $0xffffffffffffffff,%rax
je     1574 <main+0x3a4>
mov    %rax,%r15
mov    0x8(%r14),%rdi
lea    0xfd3(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    13e2 <main+0x212>
test   %ebx,%ebx
js     12fd <main+0x12d>
lea    0xe7f(%rip),%rdi
call   1060 <puts@plt>
mov    0x8(%r14),%rdi
lea    0xd0d(%rip),%rsi
call   1050 <strcpy@plt>
jmp    13e2 <main+0x212>
mov    %r15,%rbp
lea    0x40(%rsp),%r15
xor    %ebx,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
lea    0xce7(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xd0c(%rip),%rdi
mov    %r15,%rsi
call   10b0 <scanf@plt>
lea    0x20(%rsp),%r12
mov    %rbp,%r13
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x20,%edx
call   1040 <strncpy@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1390 <main+0x1c0>
je     1382 <main+0x1b2>
lea    0x1(%rbx),%rax
add    $0x2c,%rbp
cmp    $0x3,%rbx
mov    %rax,%rbx
jb     1340 <main+0x170>
lea    0xdb3(%rip),%rdi
call   1060 <puts@plt>
jmp    13df <main+0x20f>
lea    0x16(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1090 <memset@plt>
add    $0x21,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0xb,%edx
call   1040 <strncpy@plt>
lea    0xc9f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc6f(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13,%r15
mov    0x8(%r14),%rdi
lea    0xc13(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    14da <main+0x30a>
lea    0x40(%rsp),%rbx
lea    0x20(%rsp),%r14
lea    0xc2b(%rip),%r13
lea    0xe8f(%rip),%r12
mov    %r15,(%rsp)
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1090 <memset@plt>
lea    0xc1f(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10b0 <scanf@plt>
lea    0xc3a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   10b0 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1040 <strncpy@plt>
lea    0x20(%r15),%rdi
mov    %r12,%rsi
mov    $0x20,%edx
call   1040 <strncpy@plt>
lea    0x21(%r15),%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1040 <strncpy@plt>
add    $0x1,%rbp
lea    0x2b(%r15),%rdi
mov    %r12,%rsi
mov    $0xa,%edx
call   1040 <strncpy@plt>
add    $0x2c,%r15
cmp    $0x4,%rbp
jne    1420 <main+0x250>
lea    0xc2f(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%r15
lea    0xbe9(%rip),%rdi
call   1060 <puts@plt>
xor    %ebx,%ebx
mov    $0x2a,%r14d
xor    %ebp,%ebp
jmp    1523 <main+0x353>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r15,%rbp,1),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    $0xff,%bl
cmp    $0xb0,%rbp
je     1543 <main+0x373>
movzbl %bpl,%eax
imul   $0xbb,%eax,%eax
shr    $0xd,%eax
imul   $0x2c,%eax,%eax
add    %bl,%al
jne    1500 <main+0x330>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1500 <main+0x330>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   1070 <shmdt@plt>
test   %rax,%rax
js     157d <main+0x3ad>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcc1(%rip),%rdi
jmp    1596 <main+0x3c6>
lea    0xc69(%rip),%rdi
jmp    1596 <main+0x3c6>
lea    0xb61(%rip),%rdi
jmp    1596 <main+0x3c6>
lea    0xc8b(%rip),%rdi
jmp    1596 <main+0x3c6>
lea    0xc69(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"set\00"
@.str.1 = [5 x i8] c"find\00"
@.str.2 = [93 x i8] c"\D0\A4\D1\83\D0\BD\D0\BA\D1\86\D0\B8\D1\8F \D0\B4\D0\BE\D0\BB\D0\B6\D0\BD\D0\B0 \D0\B1\D1\8B\D1\82\D1\8C \D0\B2\D1\8B\D0\B7\D0\B2\D0\B0\D0\BD\D0\B0 \D1\81 \D0\B0\D1\80\D0\B3\D1\83\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\BC set \D0\B8\D0\BB\D0\B8 find\0A\00"
@__const.main.pathname = [8 x i8] c"lab06.c\00"
@.str.3 = [20 x i8] c"Can't generate key\0A\00"
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.4 = [28 x i8] c"Can't create shared memory\0A\00"
@.str.5 = [26 x i8] c"Can't find shared memory\0A\00"
@.str.6 = [28 x i8] c"Can't attach shared memory\0A\00"
@.str.7 = [131 x i8] c"\D0\91\D0\B0\D0\B7\D0\B0 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D0\B9 \D0\BD\D0\B5 \D0\B7\D0\B0\D0\BF\D0\BE\D0\BB\D0\BD\D0\B5\D0\BD\D0\B0. \D0\A0\D0\B5\D0\B6\D0\B8\D0\BC \D0\BF\D0\BE\D0\B8\D1\81\D0\BA\D0\B0 \D0\BF\D0\B5\D1\80\D0\B5\D0\B2\D0\B5\D0\B4\D0\B5\D0\BD \D0\B2 \D1\80\D0\B5\D0\B6\D0\B8\D0\BC \D0\B7\D0\B0\D0\BF\D0\BE\D0\BB\D0\BD\D0\B5\D0\BD\D0\B8\D1\8F.\0A\00"
@.str.8 = [51 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BD\D0\B0\D0\B7\D0\B2\D0\B0\D0\BD\D0\B8\D0\B5 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F: \00"
@.str.9 = [8 x i8] c"\0A%[^\0D\0A]\00"
@.str.10 = [6 x i8] c": %s\0A\00"
@.str.11 = [37 x i8] c"\D0\94\D0\B0\D1\82\D0\B0 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F [%s] : %s\0A\00"
@.str.12 = [39 x i8] c"\D0\9E\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D0\B5 \D0\BD\D0\B5 \D0\BD\D0\B0\D0\B9\D0\B4\D0\B5\D0\BD\D0\BE.\0A\00"
@.str.13 = [54 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BD\D0\B0\D0\B7\D0\B2\D0\B0\D0\BD\D0\B8\D0\B5 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F %d: \00"
@.str.14 = [48 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B4\D0\B0\D1\82\D1\83 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F [%s]: \00"
@.str.15 = [2 x i8] zeroinitializer
@.str.16 = [61 x i8] c"\D0\98\D1\81\D1\81\D0\BB\D0\B5\D0\B4\D0\BE\D0\B2\D0\B0\D0\BD\D0\B8\D1\8F \D1\83\D1\81\D0\BF\D0\B5\D1\88\D0\BD\D0\BE \D0\B4\D0\BE\D0\B1\D0\B0\D0\B2\D0\BB\D0\B5\D0\BD\D1\8B!\0A\00"
@.str.17 = [28 x i8] c"---\0A\D0\9F\D0\B5\D1\87\D0\B0\D1\82\D1\8C \D0\B1\D0\B0\D0\B7\D1\8B:\0A\00"
@.str.18 = [2 x i8] c"\0A\00"
@.str.19 = [2 x i8] c"*\00"
@.str.20 = [3 x i8] c"%c\00"
@.str.21 = [28 x i8] c"Can't detach shared memory\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [8 x i8]
%12 = alloca i32
%13 = alloca [32 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca [32 x i8]
%17 = alloca [10 x i8]
%18 = alloca [32 x i8]
%19 = alloca [10 x i8]
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, 2
br i1 %23, label %36, label %24
24: ; preds = %3
%25 = load i8**, i8*** %6
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %38
30: ; preds = %24
%31 = load i8**, i8*** %6
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %30, %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %4
br label %257
38: ; preds = %30, %24
store i32 1, i32* %10
%39 = bitcast [8 x i8]* %11 to i8*
%40 = getelementptr inbounds [8 x i8], [8 x i8]* %11, i64 0, i64 0
%41 = call i32 @ftok(i8* %40, i32 0)
store i32 %41, i32* %12
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 @exit(i32 -1)
unreachable
46: ; preds = %38
%47 = load i32, i32* %12
%48 = load i32, i32* @IPC_CREAT
%49 = or i32 438, %48
%50 = load i32, i32* @IPC_EXCL
%51 = or i32 %49, %50
%52 = call i32 @shmget(i32 %47, i32 176, i32 %51)
store i32 %52, i32* %9
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %70
54: ; preds = %46
%55 = load i64, i64* @errno
%56 = load i64, i64* @EEXIST
%57 = icmp ne i64 %55, %56
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%60 = call i32 @exit(i32 -1)
unreachable
61: ; preds = %54
%62 = load i32, i32* %12
%63 = call i32 @shmget(i32 %62, i32 176, i32 0)
store i32 %63, i32* %9
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %61
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @exit(i32 -1)
unreachable
68: ; preds = %61
store i32 0, i32* %10
br label %69
69: ; preds = %68
br label %70
70: ; preds = %69, %46
%71 = load i32, i32* %9
%72 = call i64 @shmat(i32 %71, i32* null, i32 0)
%73 = inttoptr i64 %72 to i8*
store i8* %73, i8** %8
%74 = icmp eq i8* %73, inttoptr (i64 -1 to i8*)
br i1 %74, label %75, label %78
75: ; preds = %70
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @exit(i32 -1)
unreachable
78: ; preds = %70
%79 = load i8**, i8*** %6
%80 = getelementptr inbounds i8*, i8** %79, i64 1
%81 = load i8*, i8** %80
%82 = call i64 @strcmp(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %152
84: ; preds = %78
%85 = load i32, i32* %10
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %93
87: ; preds = %84
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.7, i64 0, i64 0))
%89 = load i8**, i8*** %6
%90 = getelementptr inbounds i8*, i8** %89, i64 1
%91 = load i8*, i8** %90
%92 = call i32 @strcpy(i8* %91, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %151
93: ; preds = %84
%94 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%95 = call i32 @memset(i8* %94, i8 signext 0, i32 32)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0))
%97 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%98 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* %97)
store i32 0, i32* %15
store i32 0, i32* %14
br label %99
99: ; preds = %142, %93
%100 = load i32, i32* %14
%101 = icmp slt i32 %100, 4
br i1 %101, label %102, label %106
102: ; preds = %99
%103 = load i32, i32* %15
%104 = icmp ne i32 %103, 0
%105 = xor i1 %104, true
br label %106
106: ; preds = %102, %99
%107 = phi i1 [ false, %99 ], [ %105, %102 ]
br i1 %107, label %108, label %145
108: ; preds = %106
%109 = getelementptr inbounds [32 x i8], [32 x i8]* %16, i64 0, i64 0
%110 = call i32 @memset(i8* %109, i8 signext 0, i32 32)
%111 = getelementptr inbounds [32 x i8], [32 x i8]* %16, i64 0, i64 0
%112 = load i8*, i8** %8
%113 = load i32, i32* %14
%114 = mul nsw i32 %113, 44
%115 = sext i32 %114 to i64
%116 = mul i64 %115, 1
%117 = getelementptr inbounds i8, i8* %112, i64 %116
%118 = call i32 @strncpy(i8* %111, i8* %117, i32 32)
%119 = getelementptr inbounds [32 x i8], [32 x i8]* %16, i64 0, i64 0
%120 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%121 = call i64 @strcmp(i8* %119, i8* %120)
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %141
123: ; preds = %108
store i32 1, i32* %15
%124 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%125 = call i32 @memset(i8* %124, i8 signext 0, i32 10)
%126 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%127 = load i8*, i8** %8
%128 = load i32, i32* %14
%129 = mul nsw i32 %128, 44
%130 = add nsw i32 %129, 32
%131 = add nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = mul i64 %132, 1
%134 = getelementptr inbounds i8, i8* %127, i64 %133
%135 = call i32 @strncpy(i8* %126, i8* %134, i32 11)
%136 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* %136)
%138 = getelementptr inbounds [32 x i8], [32 x i8]* %16, i64 0, i64 0
%139 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8* %138, i8* %139)
br label %141
141: ; preds = %123, %108
br label %142
142: ; preds = %141
%143 = load i32, i32* %14
%144 = add nsw i32 %143, 1
store i32 %144, i32* %14
br label %99
145: ; preds = %106
%146 = load i32, i32* %15
%147 = icmp ne i32 %146, 0
br i1 %147, label %150, label %148
148: ; preds = %145
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0))
br label %150
150: ; preds = %148, %145
br label %151
151: ; preds = %150, %87
br label %152
152: ; preds = %151, %78
%153 = load i8**, i8*** %6
%154 = getelementptr inbounds i8*, i8** %153, i64 1
%155 = load i8*, i8** %154
%156 = call i64 @strcmp(i8* %155, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%157 = icmp eq i64 %156, 0
br i1 %157, label %158, label %215
158: ; preds = %152
store i32 0, i32* %20
br label %159
159: ; preds = %210, %158
%160 = load i32, i32* %20
%161 = icmp slt i32 %160, 4
br i1 %161, label %162, label %213
162: ; preds = %159
%163 = getelementptr inbounds [32 x i8], [32 x i8]* %18, i64 0, i64 0
%164 = call i32 @memset(i8* %163, i8 signext 0, i32 32)
%165 = getelementptr inbounds [10 x i8], [10 x i8]* %19, i64 0, i64 0
%166 = call i32 @memset(i8* %165, i8 signext 0, i32 10)
%167 = load i32, i32* %20
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.13, i64 0, i64 0), i32 %167)
%169 = getelementptr inbounds [32 x i8], [32 x i8]* %18, i64 0, i64 0
%170 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* %169)
%171 = getelementptr inbounds [32 x i8], [32 x i8]* %18, i64 0, i64 0
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), i8* %171)
%173 = getelementptr inbounds [10 x i8], [10 x i8]* %19, i64 0, i64 0
%174 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* %173)
%175 = load i8*, i8** %8
%176 = load i32, i32* %20
%177 = mul nsw i32 %176, 44
%178 = sext i32 %177 to i64
%179 = mul i64 %178, 1
%180 = getelementptr inbounds i8, i8* %175, i64 %179
%181 = getelementptr inbounds [32 x i8], [32 x i8]* %18, i64 0, i64 0
%182 = call i32 @strncpy(i8* %180, i8* %181, i32 32)
%183 = load i8*, i8** %8
%184 = load i32, i32* %20
%185 = mul nsw i32 %184, 44
%186 = add nsw i32 %185, 32
%187 = sext i32 %186 to i64
%188 = mul i64 %187, 1
%189 = getelementptr inbounds i8, i8* %183, i64 %188
%190 = call i32 @strncpy(i8* %189, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 32)
%191 = load i8*, i8** %8
%192 = load i32, i32* %20
%193 = mul nsw i32 %192, 44
%194 = add nsw i32 %193, 32
%195 = add nsw i32 %194, 1
%196 = sext i32 %195 to i64
%197 = mul i64 %196, 1
%198 = getelementptr inbounds i8, i8* %191, i64 %197
%199 = getelementptr inbounds [10 x i8], [10 x i8]* %19, i64 0, i64 0
%200 = call i32 @strncpy(i8* %198, i8* %199, i32 10)
%201 = load i8*, i8** %8
%202 = load i32, i32* %20
%203 = add nsw i32 %202, 1
%204 = mul nsw i32 %203, 44
%205 = sub nsw i32 %204, 1
%206 = sext i32 %205 to i64
%207 = mul i64 %206, 1
%208 = getelementptr inbounds i8, i8* %201, i64 %207
%209 = call i32 @strncpy(i8* %208, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 10)
br label %210
210: ; preds = %162
%211 = load i32, i32* %20
%212 = add nsw i32 %211, 1
store i32 %212, i32* %20
br label %159
213: ; preds = %159
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.16, i64 0, i64 0))
br label %215
215: ; preds = %213, %152
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0))
store i32 0, i32* %21
store i32 0, i32* %21
br label %217
217: ; preds = %245, %215
%218 = load i32, i32* %21
%219 = icmp slt i32 %218, 176
br i1 %219, label %220, label %248
220: ; preds = %217
%221 = load i32, i32* %21
%222 = srem i32 %221, 44
%223 = icmp eq i32 %222, 0
br i1 %223, label %224, label %226
224: ; preds = %220
%225 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
br label %226
226: ; preds = %224, %220
%227 = load i8*, i8** %8
%228 = load i32, i32* %21
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i8, i8* %227, i64 %229
%231 = load i8, i8* %230
%232 = sext i8 %231 to i32
%233 = icmp eq i32 %232, 0
br i1 %233, label %234, label %236
234: ; preds = %226
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
br label %244
236: ; preds = %226
%237 = load i8*, i8** %8
%238 = load i32, i32* %21
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds i8, i8* %237, i64 %239
%241 = load i8, i8* %240
%242 = sext i8 %241 to i32
%243 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i32 %242)
br label %244
244: ; preds = %236, %234
br label %245
245: ; preds = %244
%246 = load i32, i32* %21
%247 = add nsw i32 %246, 1
store i32 %247, i32* %21
br label %217
248: ; preds = %217
%249 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
%250 = load i8*, i8** %8
%251 = call i64 @shmdt(i8* %250)
%252 = icmp slt i64 %251, 0
br i1 %252, label %253, label %256
253: ; preds = %248
%254 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.21, i64 0, i64 0))
%255 = call i32 @exit(i32 -1)
unreachable
256: ; preds = %248
store i32 0, i32* %4
br label %257
257: ; preds = %256, %36
%258 = load i32, i32* %4
ret i32 %258
}

LLVM IR (-O2):
@.str = [4 x i8] c"set\00"
@.str.1 = [5 x i8] c"find\00"
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.8 = [51 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BD\D0\B0\D0\B7\D0\B2\D0\B0\D0\BD\D0\B8\D0\B5 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F: \00"
@.str.9 = [8 x i8] c"\0A%[^\0D\0A]\00"
@.str.10 = [6 x i8] c": %s\0A\00"
@.str.11 = [37 x i8] c"\D0\94\D0\B0\D1\82\D0\B0 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F [%s] : %s\0A\00"
@.str.13 = [54 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BD\D0\B0\D0\B7\D0\B2\D0\B0\D0\BD\D0\B8\D0\B5 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F %d: \00"
@.str.14 = [48 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B4\D0\B0\D1\82\D1\83 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F [%s]: \00"
@.str.15 = [2 x i8] zeroinitializer
@str = [27 x i8] c"---\0A\D0\9F\D0\B5\D1\87\D0\B0\D1\82\D1\8C \D0\B1\D0\B0\D0\B7\D1\8B:\00"
@str.22 = [27 x i8] c"Can't detach shared memory\00"
@str.23 = [60 x i8] c"\D0\98\D1\81\D1\81\D0\BB\D0\B5\D0\B4\D0\BE\D0\B2\D0\B0\D0\BD\D0\B8\D1\8F \D1\83\D1\81\D0\BF\D0\B5\D1\88\D0\BD\D0\BE \D0\B4\D0\BE\D0\B1\D0\B0\D0\B2\D0\BB\D0\B5\D0\BD\D1\8B!\00"
@str.24 = [38 x i8] c"\D0\9E\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D0\B5 \D0\BD\D0\B5 \D0\BD\D0\B0\D0\B9\D0\B4\D0\B5\D0\BD\D0\BE.\00"
@str.25 = [130 x i8] c"\D0\91\D0\B0\D0\B7\D0\B0 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D0\B9 \D0\BD\D0\B5 \D0\B7\D0\B0\D0\BF\D0\BE\D0\BB\D0\BD\D0\B5\D0\BD\D0\B0. \D0\A0\D0\B5\D0\B6\D0\B8\D0\BC \D0\BF\D0\BE\D0\B8\D1\81\D0\BA\D0\B0 \D0\BF\D0\B5\D1\80\D0\B5\D0\B2\D0\B5\D0\B4\D0\B5\D0\BD \D0\B2 \D1\80\D0\B5\D0\B6\D0\B8\D0\BC \D0\B7\D0\B0\D0\BF\D0\BE\D0\BB\D0\BD\D0\B5\D0\BD\D0\B8\D1\8F.\00"
@str.26 = [27 x i8] c"Can't attach shared memory\00"
@str.27 = [25 x i8] c"Can't find shared memory\00"
@str.28 = [27 x i8] c"Can't create shared memory\00"
@str.29 = [19 x i8] c"Can't generate key\00"
@str.30 = [92 x i8] c"\D0\A4\D1\83\D0\BD\D0\BA\D1\86\D0\B8\D1\8F \D0\B4\D0\BE\D0\BB\D0\B6\D0\BD\D0\B0 \D0\B1\D1\8B\D1\82\D1\8C \D0\B2\D1\8B\D0\B7\D0\B2\D0\B0\D0\BD\D0\B0 \D1\81 \D0\B0\D1\80\D0\B3\D1\83\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\BC set \D0\B8\D0\BB\D0\B8 find\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = alloca i64
%5 = alloca [32 x i8]
%6 = alloca [32 x i8]
%7 = alloca [10 x i8]
%8 = alloca [32 x i8]
%9 = alloca [10 x i8]
%10 = icmp eq i32 %0, 2
br i1 %10, label %11, label %20
11: ; preds = %3
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %11
%17 = load i8*, i8** %12
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16, %3
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @str.30, i64 0, i64 0))
br label %154
22: ; preds = %16, %11
%23 = bitcast i64* %4 to i8*
store i64 27916832969220460, i64* %4
%24 = call i32 @ftok(i8* %23, i32 0)
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.29, i64 0, i64 0))
%28 = call i32 @exit(i32 -1)
unreachable
29: ; preds = %22
%30 = load i32, i32* @IPC_CREAT
%31 = load i32, i32* @IPC_EXCL
%32 = or i32 %30, %31
%33 = or i32 %32, 438
%34 = call i32 @shmget(i32 %24, i32 176, i32 %33)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %49
36: ; preds = %29
%37 = load i64, i64* @errno
%38 = load i64, i64* @EEXIST
%39 = icmp eq i64 %37, %38
br i1 %39, label %43, label %40
40: ; preds = %36
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.28, i64 0, i64 0))
%42 = call i32 @exit(i32 -1)
unreachable
43: ; preds = %36
%44 = call i32 @shmget(i32 %24, i32 176, i32 0)
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.27, i64 0, i64 0))
%48 = call i32 @exit(i32 -1)
unreachable
49: ; preds = %43, %29
%50 = phi i32 [ %34, %29 ], [ %44, %43 ]
%51 = call i64 @shmat(i32 %50, i32* null, i32 0)
%52 = inttoptr i64 %51 to i8*
%53 = icmp eq i8* %52, inttoptr (i64 -1 to i8*)
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.26, i64 0, i64 0))
%56 = call i32 @exit(i32 -1)
unreachable
57: ; preds = %49
%58 = load i8*, i8** %12
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %95
61: ; preds = %57
br i1 %35, label %66, label %62
62: ; preds = %61
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([130 x i8], [130 x i8]* @str.25, i64 0, i64 0))
%64 = load i8*, i8** %12
%65 = call i32 @strcpy(i8* %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %95
66: ; preds = %61
%67 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%68 = call i32 @memset(i8* %67, i8 signext 0, i32 32)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0))
%70 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* %67)
%71 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%72 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
br label %73
73: ; preds = %66, %88
%74 = phi i64 [ 0, %66 ], [ %89, %88 ]
%75 = call i32 @memset(i8* %71, i8 signext 0, i32 32)
%76 = mul nuw nsw i64 %74, 44
%77 = getelementptr inbounds i8, i8* %52, i64 %76
%78 = call i32 @strncpy(i8* %71, i8* %77, i32 32)
%79 = call i64 @strcmp(i8* %71, i8* %67)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %88
81: ; preds = %73
%82 = call i32 @memset(i8* %72, i8 signext 0, i32 10)
%83 = add nuw nsw i64 %76, 33
%84 = getelementptr inbounds i8, i8* %52, i64 %83
%85 = call i32 @strncpy(i8* %72, i8* %84, i32 11)
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* %72)
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8* %71, i8* %72)
br label %94
88: ; preds = %73
%89 = add nuw nsw i64 %74, 1
%90 = icmp ugt i64 %74, 2
%91 = or i1 %80, %90
br i1 %91, label %92, label %73
92: ; preds = %88
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.24, i64 0, i64 0))
br label %94
94: ; preds = %81, %92
br label %95
95: ; preds = %62, %94, %57
%96 = load i8*, i8** %12
%97 = call i64 @strcmp(i8* %96, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%98 = icmp eq i64 %97, 0
br i1 %98, label %99, label %128
99: ; preds = %95
%100 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%101 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
br label %102
102: ; preds = %99, %102
%103 = phi i64 [ 0, %99 ], [ %120, %102 ]
%104 = call i32 @memset(i8* %100, i8 signext 0, i32 32)
%105 = call i32 @memset(i8* %101, i8 signext 0, i32 10)
%106 = trunc i64 %103 to i32
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.13, i64 0, i64 0), i32 %106)
%108 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* %100)
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), i8* %100)
%110 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* %101)
%111 = mul nuw nsw i64 %103, 44
%112 = getelementptr inbounds i8, i8* %52, i64 %111
%113 = call i32 @strncpy(i8* %112, i8* %100, i32 32)
%114 = add nuw nsw i64 %111, 32
%115 = getelementptr inbounds i8, i8* %52, i64 %114
%116 = call i32 @strncpy(i8* %115, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 32)
%117 = add nuw nsw i64 %111, 33
%118 = getelementptr inbounds i8, i8* %52, i64 %117
%119 = call i32 @strncpy(i8* %118, i8* %101, i32 10)
%120 = add nuw nsw i64 %103, 1
%121 = mul nuw nsw i64 %120, 44
%122 = add nsw i64 %121, -1
%123 = getelementptr inbounds i8, i8* %52, i64 %122
%124 = call i32 @strncpy(i8* %123, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 10)
%125 = icmp eq i64 %120, 4
br i1 %125, label %126, label %102
126: ; preds = %102
%127 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.23, i64 0, i64 0))
br label %128
128: ; preds = %126, %95
%129 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %130
130: ; preds = %128, %137
%131 = phi i64 [ 0, %128 ], [ %144, %137 ]
%132 = trunc i64 %131 to i8
%133 = urem i8 %132, 44
%134 = icmp eq i8 %133, 0
br i1 %134, label %135, label %137
135: ; preds = %130
%136 = call i32 @putchar(i32 10)
br label %137
137: ; preds = %135, %130
%138 = getelementptr inbounds i8, i8* %52, i64 %131
%139 = load i8, i8* %138
%140 = icmp eq i8 %139, 0
%141 = select i1 %140, i8 42, i8 %139
%142 = sext i8 %141 to i32
%143 = call i32 @putchar(i32 %142)
%144 = add nuw nsw i64 %131, 1
%145 = icmp eq i64 %144, 176
br i1 %145, label %146, label %130
146: ; preds = %137
%147 = call i32 @putchar(i32 10)
%148 = call i64 @shmdt(i8* %52)
%149 = icmp slt i64 %148, 0
br i1 %149, label %150, label %153
150: ; preds = %146
%151 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.22, i64 0, i64 0))
%152 = call i32 @exit(i32 -1)
unreachable
153: ; preds = %146
br label %154
154: ; preds = %153, %20
%155 = phi i32 [ -1, %20 ], [ 0, %153 ]
ret i32 %155
}