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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int IPC_CREAT;
int /*<<< orphan*/ IPC_PRIVATE;
int /*<<< orphan*/ IPC_RMID;
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fork();
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int get_nprocs();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printMatrix(float **, int, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ shmat(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ shmctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ shmdt(float **);
int shmget(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  float **A, **B, **C;
  int iA, jA, iB, jB, iC, jC, i;
  int height, width;
  int shm_A_ptr, shm_B_ptr, shm_C_ptr;
  int num_procs;
  int pid, pnum;
  int start_col, end_col, steps;
  FILE *input_file;
  if (argv[1] == NULL || (argv[2] != NULL && atoi(argv[2]) < 1)) {
    printf("Modo de usar: matriz_CPU.o (arquivo) (?qtd. processos > 0)\n");
    return EXIT_FAILURE;
  }
  input_file = fopen(argv[1], "r");
  if (input_file == NULL) {
    printf("Erro: problema ao abrir o arquivo.\n");
    return EXIT_FAILURE;
  }
  fscanf(input_file, "%d %d", &width, &height);
  printf("Processadores disponiveis: %d\n", get_nprocs());
  if (argv[2] != NULL)
    num_procs = atoi(argv[2]);
  else {
    if (width <= get_nprocs())
      num_procs = width;
    else
      num_procs = get_nprocs();
  }
  printf("Num. de processos: %d\n", num_procs);
  int shm_A[height], shm_B[height], shm_C[height];
  if ((shm_A_ptr = shmget(IPC_PRIVATE, height * sizeof(float *),
                          IPC_CREAT | 0666)) < 0) {
    perror("erro no shmget");
    exit(1);
  }
  if ((shm_B_ptr = shmget(IPC_PRIVATE, height * sizeof(float *),
                          IPC_CREAT | 0666)) < 0) {
    perror("erro no shmget");
    exit(1);
  }
  if ((shm_C_ptr = shmget(IPC_PRIVATE, height * sizeof(float *),
                          IPC_CREAT | 0666)) < 0) {
    perror("erro no shmget");
    exit(1);
  }
  A = (float **)shmat(shm_A_ptr, NULL, 0);
  B = (float **)shmat(shm_B_ptr, NULL, 0);
  C = (float **)shmat(shm_C_ptr, NULL, 0);
  for (i = 0; i < height; i++) {
    if ((shm_A[i] = shmget(IPC_PRIVATE, width * sizeof(float),
                           IPC_CREAT | 0666)) < 0) {
      perror("shmget i");
      exit(1);
    }
    if ((shm_B[i] = shmget(IPC_PRIVATE, width * sizeof(float),
                           IPC_CREAT | 0666)) < 0) {
      perror("shmget i");
      exit(1);
    }
    if ((shm_C[i] = shmget(IPC_PRIVATE, width * sizeof(float),
                           IPC_CREAT | 0666)) < 0) {
      perror("shmget i");
      exit(1);
    }
    A[i] = (float *)shmat(shm_A[i], NULL, 0);
    B[i] = (float *)shmat(shm_B[i], NULL, 0);
    C[i] = (float *)shmat(shm_C[i], NULL, 0);
  }
  for (jC = 0; jC < height; jC++) {
    for (iC = 0; iC < width; iC++) {
      fscanf(input_file, "%f", &A[jC][iC]);
    }
  }
  fscanf(input_file, "\n");
  for (jC = 0; jC < height; jC++) {
    for (iC = 0; iC < width; iC++) {
      fscanf(input_file, "%f", &B[jC][iC]);
    }
  }
  printf("\nArquivo %s lido!\n", argv[1]);
  fclose(input_file);
  pnum = 0;
  for (i = 1; i < num_procs; i++) {
    pid = fork();
    if (pid)
      break;
    pnum = i;
  }
  steps = 0;
  start_col = ((int)(1.0f * width / num_procs) * pnum);
  end_col = ((int)(1.0f * width / num_procs) * (pnum + 1));
  for (jC = 0; jC < height; jC++) {
    for (iC = start_col; iC < end_col; iC++) {
      float aux = 0.0f;
      for (iA = 0; iA < width; iA++) {
        aux += A[jC][iA] * B[iA][iC];
        steps++;
      }
      C[jC][iC] = aux;
    }
  }
  if (!pnum)
    printf("\n");
  printf("Passos no proc. %d: %d\n", pnum, steps);
  wait(NULL);
  if (pnum)
    return 0;
  printf("\nResultado:");
  printMatrix(C, width, height);
  shmdt(A);
  shmdt(B);
  shmdt(C);
  shmctl(shm_A_ptr, IPC_RMID, 0);
  shmctl(shm_B_ptr, IPC_RMID, 0);
  shmctl(shm_C_ptr, IPC_RMID, 0);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     123d <main+0x4d>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     125c <main+0x6c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
cmp    $0x1,%eax
jge    125c <main+0x6c>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    19c8 <main+0x7d8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd5(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    129e <main+0xae>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    19c8 <main+0x7d8>
mov    -0x78(%rbp),%rdi
lea    0xdbd(%rip),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    $0x0,%al
call   1110 <get_nprocs@plt>
mov    %eax,%esi
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     12f3 <main+0x103>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x5c(%rbp)
jmp    132d <main+0x13d>
mov    -0x4c(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    $0x0,%al
call   1110 <get_nprocs@plt>
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
cmp    %ecx,%eax
jg     131e <main+0x12e>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    1328 <main+0x138>
mov    $0x0,%al
call   1110 <get_nprocs@plt>
mov    %eax,-0x5c(%rbp)
jmp    132d <main+0x13d>
mov    -0x5c(%rbp),%esi
lea    0xd54(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x48(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x80(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
mov    -0x48(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x90(%rbp)
mov    -0x48(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x98(%rbp)
mov    0x2c2a(%rip),%rax
mov    (%rax),%edi
movslq -0x48(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
mov    0x2bef(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
call   10c0 <shmget@plt>
mov    %eax,-0x50(%rbp)
cmp    $0x0,%eax
jge    1400 <main+0x210>
lea    0xcb1(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
movslq -0x48(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
mov    0x2ba6(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
call   10c0 <shmget@plt>
mov    %eax,-0x54(%rbp)
cmp    $0x0,%eax
jge    1449 <main+0x259>
lea    0xc68(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2b98(%rip),%rax
mov    (%rax),%edi
movslq -0x48(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
mov    0x2b5d(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
call   10c0 <shmget@plt>
mov    %eax,-0x58(%rbp)
cmp    $0x0,%eax
jge    1492 <main+0x2a2>
lea    0xc1f(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x50(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
mov    %rax,-0x18(%rbp)
mov    -0x54(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
mov    %rax,-0x20(%rbp)
mov    -0x58(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    165d <main+0x46d>
mov    0x2b06(%rip),%rax
mov    (%rax),%edi
movslq -0x4c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
mov    0x2acb(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
call   10c0 <shmget@plt>
mov    -0xc0(%rbp),%rcx
movslq -0x44(%rbp),%rdx
mov    %eax,(%rcx,%rdx,4)
cmp    $0x0,%eax
jge    152f <main+0x33f>
lea    0xb91(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2ab2(%rip),%rax
mov    (%rax),%edi
movslq -0x4c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
mov    0x2a77(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
call   10c0 <shmget@plt>
mov    -0xb8(%rbp),%rcx
movslq -0x44(%rbp),%rdx
mov    %eax,(%rcx,%rdx,4)
cmp    $0x0,%eax
jge    1583 <main+0x393>
lea    0xb3d(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2a5e(%rip),%rax
mov    (%rax),%edi
movslq -0x4c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
mov    0x2a23(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
call   10c0 <shmget@plt>
mov    -0xb0(%rbp),%rcx
movslq -0x44(%rbp),%rdx
mov    %eax,(%rcx,%rdx,4)
cmp    $0x0,%eax
jge    15d7 <main+0x3e7>
lea    0xae9(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0xc0(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
mov    %rax,%rsi
mov    -0xb8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x44(%rbp),%rdx
mov    %rsi,(%rcx,%rdx,8)
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
mov    %rax,%rsi
mov    -0xb0(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x44(%rbp),%rdx
mov    %rsi,(%rcx,%rdx,8)
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    14cf <main+0x2df>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    16cd <main+0x4dd>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    16ba <main+0x4ca>
mov    -0x78(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xa15(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1677 <main+0x487>
jmp    16bf <main+0x4cf>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1664 <main+0x474>
mov    -0x78(%rbp),%rdi
lea    0x9f6(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    174f <main+0x55f>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    173c <main+0x54c>
mov    -0x78(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0x993(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    16f9 <main+0x509>
jmp    1741 <main+0x551>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    16e6 <main+0x4f6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x95f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x78(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x64(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jge    17b5 <main+0x5c5>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
je     17a1 <main+0x5b1>
jmp    17b5 <main+0x5c5>
mov    -0x44(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    177c <main+0x58c>
movl   $0x0,-0x70(%rbp)
cvtsi2ssl -0x4c(%rbp),%xmm1
movss  0x837(%rip),%xmm0
mulss  %xmm1,%xmm0
cvtsi2ssl -0x5c(%rbp),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
imul   -0x64(%rbp),%eax
mov    %eax,-0x68(%rbp)
cvtsi2ssl -0x4c(%rbp),%xmm1
movss  0x812(%rip),%xmm0
mulss  %xmm1,%xmm0
cvtsi2ssl -0x5c(%rbp),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x6c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    18e5 <main+0x6f5>
mov    -0x68(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    18d2 <main+0x6e2>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    18a7 <main+0x6b7>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
movss  -0x9c(%rbp),%xmm1
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1842 <main+0x652>
movss  -0x9c(%rbp),%xmm0
ff
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1824 <main+0x634>
jmp    18d7 <main+0x6e7>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1812 <main+0x622>
cmpl   $0x0,-0x64(%rbp)
jne    18fd <main+0x70d>
lea    0x7d8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x64(%rbp),%esi
mov    -0x70(%rbp),%edx
lea    0x7c6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <wait@plt>
cmpl   $0x0,-0x64(%rbp)
je     193a <main+0x74a>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xa0(%rbp)
jmp    19c1 <main+0x7d1>
lea    0x7a7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    -0x48(%rbp),%edx
call   1070 <printMatrix@plt>
mov    -0x18(%rbp),%rdi
call   1030 <shmdt@plt>
mov    -0x20(%rbp),%rdi
call   1030 <shmdt@plt>
mov    -0x28(%rbp),%rdi
call   1030 <shmdt@plt>
mov    -0x50(%rbp),%edi
mov    0x2654(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1080 <shmctl@plt>
mov    -0x54(%rbp),%edi
mov    0x2641(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1080 <shmctl@plt>
mov    -0x58(%rbp),%edi
mov    0x262e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1080 <shmctl@plt>
mov    0x2616(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0xa0(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    0x8(%rsi),%rbx
test   %rbx,%rbx
je     1295 <main+0x85>
mov    %rsi,%rbp
mov    0x10(%rsi),%rdi
test   %rdi,%rdi
je     123c <main+0x2c>
call   10f0 <atoi@plt>
test   %eax,%eax
jle    1295 <main+0x85>
lea    0xdbd(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     129e <main+0x8e>
mov    %rax,%r12
lea    0xda8(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %rax,%rdi
xor    %eax,%eax
call   1080 <fscanf@plt>
xor    %eax,%eax
call   1130 <get_nprocs@plt>
lea    0xd8c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x10(%rbp),%rdi
test   %rdi,%rdi
je     12b8 <main+0xa8>
call   10f0 <atoi@plt>
jmp    12d2 <main+0xc2>
lea    0xe17(%rip),%rdi
jmp    12a5 <main+0x95>
lea    0xdeb(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d27(%rip),%rax
mov    (%rax),%ebp
jmp    1837 <main+0x627>
mov    0x8(%rsp),%ebx
xor    %eax,%eax
call   1130 <get_nprocs@plt>
cmp    %eax,%ebx
jle    15d4 <main+0x3c4>
xor    %eax,%eax
call   1130 <get_nprocs@plt>
mov    %eax,%esi
lea    0xd4c(%rip),%rdi
mov    %rsi,0x18(%rsp)
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,0x50(%rsp)
mov    0xc(%rsp),%esi
mov    0x2cf1(%rip),%r14
mov    (%r14),%edi
shl    $0x3,%esi
mov    0x2cbc(%rip),%r13
mov    $0x1b6,%ebx
mov    0x0(%r13),%edx
or     %ebx,%edx
call   10e0 <shmget@plt>
test   %eax,%eax
js     185e <main+0x64e>
mov    %eax,%r15d
mov    (%r14),%edi
mov    0xc(%rsp),%esi
shl    $0x3,%esi
or     0x0(%r13),%ebx
mov    %ebx,%edx
call   10e0 <shmget@plt>
test   %eax,%eax
js     185e <main+0x64e>
mov    %eax,%r13d
mov    %r12,0x10(%rsp)
mov    %rbp,0x20(%rsp)
mov    (%r14),%edi
mov    0xc(%rsp),%esi
shl    $0x3,%esi
mov    $0x1b6,%edx
mov    0x2c61(%rip),%rbx
or     (%rbx),%edx
call   10e0 <shmget@plt>
test   %eax,%eax
js     185e <main+0x64e>
mov    %eax,%ebp
mov    %r15d,0x44(%rsp)
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <shmat@plt>
mov    %rax,0x28(%rsp)
mov    %r13d,0x40(%rsp)
mov    %r13d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <shmat@plt>
mov    %rax,%r15
mov    %ebp,0x3c(%rsp)
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <shmat@plt>
mov    %rax,0x30(%rsp)
cmpl   $0x0,0xc(%rsp)
jle    14ee <main+0x2de>
xor    %r13d,%r13d
mov    $0x1b6,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
mov    0x8(%rsp),%esi
shl    $0x2,%esi
mov    (%rbx),%edx
or     %ebp,%edx
call   10e0 <shmget@plt>
test   %eax,%eax
js     1848 <main+0x638>
mov    %eax,%r12d
mov    (%r14),%edi
mov    0x8(%rsp),%esi
shl    $0x2,%esi
mov    (%rbx),%edx
or     %ebp,%edx
call   10e0 <shmget@plt>
mov    $0x1b6,%ecx
test   %eax,%eax
js     1848 <main+0x638>
mov    %eax,%ebp
mov    (%r14),%edi
mov    0x8(%rsp),%esi
shl    $0x2,%esi
mov    (%rbx),%edx
or     %ecx,%edx
call   10e0 <shmget@plt>
test   %eax,%eax
js     1848 <main+0x638>
mov    %eax,%r14d
mov    %r12d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <shmat@plt>
mov    0x28(%rsp),%rcx
mov    %rax,(%rcx,%r13,8)
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <shmat@plt>
mov    %rax,(%r15,%r13,8)
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <shmat@plt>
mov    0x30(%rsp),%rcx
mov    %rax,(%rcx,%r13,8)
add    $0x1,%r13
movslq 0xc(%rsp),%rax
cmp    %rax,%r13
mov    0x2b6e(%rip),%r14
mov    $0x1b6,%ebp
jl     13d0 <main+0x1c0>
test   %eax,%eax
jle    14ee <main+0x2de>
mov    0x8(%rsp),%ecx
lea    0xbc2(%rip),%r12
xor    %r13d,%r13d
mov    0x28(%rsp),%r14
jmp    14ac <main+0x29c>
xchg   %ax,%ax
add    $0x1,%r13
movslq %eax,%rdx
cmp    %rdx,%r13
jge    14ee <main+0x2de>
test   %ecx,%ecx
jle    14a0 <main+0x290>
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%r13,8),%rdx
add    %rbp,%rdx
mov    0x10(%rsp),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <fscanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rcx
add    $0x4,%rbp
cmp    %rcx,%rbx
jl     14c0 <main+0x2b0>
mov    0xc(%rsp),%eax
jmp    14a0 <main+0x290>
lea    0xb75(%rip),%rsi
mov    0x10(%rsp),%rdi
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    156c <main+0x35c>
mov    0x8(%rsp),%eax
lea    0xb42(%rip),%r14
xor    %r12d,%r12d
mov    0x10(%rsp),%r13
jmp    152c <main+0x31c>
xchg   %ax,%ax
add    $0x1,%r12
movslq %ecx,%rdx
cmp    %rdx,%r12
jge    156c <main+0x35c>
test   %eax,%eax
jle    1520 <main+0x310>
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%r12,8),%rdx
add    %rbp,%rdx
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fscanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%rbp
cmp    %rax,%rbx
jl     1540 <main+0x330>
mov    0xc(%rsp),%ecx
jmp    1520 <main+0x310>
mov    0x20(%rsp),%rax
mov    0x8(%rax),%rsi
lea    0xadd(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x10(%rsp),%rdi
call   1060 <fclose@plt>
mov    0x18(%rsp),%rbp
cmp    $0x2,%ebp
mov    $0x0,%ebx
mov    0x28(%rsp),%r12
jl     15e0 <main+0x3d0>
xor    %ebx,%ebx
xor    %eax,%eax
call   1120 <fork@plt>
test   %eax,%eax
jne    15e0 <main+0x3d0>
lea    -0x1(%rbp),%r14d
add    $0xfffffffe,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
cmp    %ebx,%ebp
je     15dd <main+0x3cd>
xor    %eax,%eax
call   1120 <fork@plt>
add    $0x1,%ebx
test   %eax,%eax
je     15c0 <main+0x3b0>
jmp    15e0 <main+0x3d0>
mov    0x8(%rsp),%esi
jmp    12d4 <main+0xc4>
mov    %r14d,%ebx
mov    %rbx,0x58(%rsp)
mov    %r12,%r14
mov    0xc(%rsp),%r8d
test   %r8d,%r8d
jle    1771 <main+0x561>
mov    0x8(%rsp),%r11d
cvtsi2ss %r11d,%xmm0
cvtsi2ssl 0x18(%rsp),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edx
mov    0x58(%rsp),%rcx
mov    %ecx,%eax
imul   %edx,%eax
lea    0x1(%rcx),%esi
imul   %edx,%esi
movslq %eax,%rcx
mov    %rcx,0x60(%rsp)
xor    %ebp,%ebp
test   %r11d,%r11d
mov    $0x0,%ecx
cmovg  %r11d,%ecx
imul   %edx,%ecx
mov    %ecx,0x48(%rsp)
movslq %esi,%rdi
lea    -0x1(%r11),%r13
mov    %r11d,%ecx
and    $0x3,%ecx
mov    %r11d,%edx
and    $0xfffffffc,%edx
xor    %ebx,%ebx
mov    %r8,0x20(%rsp)
mov    %eax,0x18(%rsp)
mov    %esi,0x4c(%rsp)
jmp    1682 <main+0x472>
nop
mov    0x10(%rsp),%ebx
add    0x48(%rsp),%ebx
mov    0x20(%rsp),%r8
mov    0x18(%rsp),%eax
mov    0x4c(%rsp),%esi
add    $0x1,%rbp
cmp    %r8,%rbp
je     1773 <main+0x563>
cmp    %esi,%eax
jge    1675 <main+0x465>
mov    %ebx,0x10(%rsp)
mov    0x30(%rsp),%rax
mov    (%rax,%rbp,8),%r8
mov    0x60(%rsp),%r12
jmp    16b2 <main+0x4a2>
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
movss  %xmm0,(%r8,%r12,4)
add    $0x1,%r12
cmp    %rdi,%r12
je     1660 <main+0x450>
test   %r11d,%r11d
jle    16a0 <main+0x490>
mov    (%r14,%rbp,8),%rax
xorps  %xmm0,%xmm0
xor    %r9d,%r9d
cmp    $0x3,%r13
jb     172f <main+0x51f>
nopw   0x0(%rax,%rax,1)
movss  (%rax,%r9,4),%xmm1
movss  0x4(%rax,%r9,4),%xmm2
mov    (%r15,%r9,8),%rbx
mov    0x8(%r15,%r9,8),%rsi
mulss  (%rbx,%r12,4),%xmm1
addss  %xmm0,%xmm1
mulss  (%rsi,%r12,4),%xmm2
addss  %xmm1,%xmm2
movss  0x8(%rax,%r9,4),%xmm1
mov    0x10(%r15,%r9,8),%rsi
mulss  (%rsi,%r12,4),%xmm1
movss  0xc(%rax,%r9,4),%xmm0
mov    0x18(%r15,%r9,8),%rsi
mulss  (%rsi,%r12,4),%xmm0
addss  %xmm2,%xmm1
addss  %xmm1,%xmm0
add    $0x4,%r9
cmp    %r9,%rdx
jne    16d0 <main+0x4c0>
test   %rcx,%rcx
je     16a3 <main+0x493>
lea    (%r15,%r9,8),%r10
lea    (%rax,%r9,4),%rax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%rax,%rbx,4),%xmm1
mov    (%r10,%rbx,8),%rsi
mulss  (%rsi,%r12,4),%xmm1
addss  %xmm1,%xmm0
add    $0x1,%rbx
cmp    %rbx,%rcx
jne    1750 <main+0x540>
jmp    16a3 <main+0x493>
xor    %ebx,%ebx
mov    0x58(%rsp),%rsi
test   %esi,%esi
je     179a <main+0x58a>
lea    0x8e9(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   1110 <wait@plt>
jmp    182f <main+0x61f>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x8c1(%rip),%rdi
xor    %esi,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   1110 <wait@plt>
lea    0x8c0(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <printMatrix@plt>
mov    %r14,%rdi
call   1050 <shmdt@plt>
mov    %r15,%rdi
call   1050 <shmdt@plt>
mov    %rbx,%rdi
call   1050 <shmdt@plt>
mov    0x27d1(%rip),%rbx
mov    (%rbx),%esi
mov    0x44(%rsp),%edi
xor    %edx,%edx
call   10a0 <shmctl@plt>
mov    (%rbx),%esi
mov    0x40(%rsp),%edi
xor    %edx,%edx
call   10a0 <shmctl@plt>
mov    (%rbx),%esi
mov    0x3c(%rsp),%edi
xor    %edx,%edx
call   10a0 <shmctl@plt>
mov    0x279b(%rip),%rax
mov    (%rax),%ebp
mov    0x50(%rsp),%rax
mov    %rax,%rsp
mov    %ebp,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x7fe(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0x7d9(%rip),%rdi
jmp    184f <main+0x63f>

LLVM IR (-O0):
@.str = [60 x i8] c"Modo de usar: matriz_CPU.o (arquivo) (?qtd. processos > 0)\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [36 x i8] c"Erro: problema ao abrir o arquivo.\0A\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [31 x i8] c"Processadores disponiveis: %d\0A\00"
@.str.5 = [23 x i8] c"Num. de processos: %d\0A\00"
@IPC_PRIVATE = global i32 0
@IPC_CREAT = global i32 0
@.str.6 = [15 x i8] c"erro no shmget\00"
@.str.7 = [9 x i8] c"shmget i\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [19 x i8] c"\0AArquivo %s lido!\0A\00"
@.str.11 = [24 x i8] c"Passos no proc. %d: %d\0A\00"
@.str.12 = [12 x i8] c"\0AResultado:\00"
@IPC_RMID = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float**
%7 = alloca float**
%8 = alloca float**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32*
%28 = alloca i8*
%29 = alloca i64
%30 = alloca i64
%31 = alloca i64
%32 = alloca float
%33 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = icmp eq i8* %36, null
br i1 %37, label %49, label %38
38: ; preds = %2
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %52
43: ; preds = %38
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @atoi(i8* %46)
%48 = icmp slt i32 %47, 1
br i1 %48, label %49, label %52
49: ; preds = %43, %2
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%51 = load i32, i32* @EXIT_FAILURE
store i32 %51, i32* %3
br label %426
52: ; preds = %43, %38
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %56, i32** %27
%57 = load i32*, i32** %27
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %62
59: ; preds = %52
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%61 = load i32, i32* @EXIT_FAILURE
store i32 %61, i32* %3
br label %426
62: ; preds = %52
%63 = load i32*, i32** %27
%64 = call i32 (i32*, i8*, ...) @fscanf(i32* %63, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %17, i32* %16)
%65 = call i32 (...) @get_nprocs()
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %65)
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 2
%69 = load i8*, i8** %68
%70 = icmp ne i8* %69, null
br i1 %70, label %71, label %76
71: ; preds = %62
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 2
%74 = load i8*, i8** %73
%75 = call i32 @atoi(i8* %74)
store i32 %75, i32* %21
br label %85
76: ; preds = %62
%77 = load i32, i32* %17
%78 = call i32 (...) @get_nprocs()
%79 = icmp sle i32 %77, %78
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = load i32, i32* %17
store i32 %81, i32* %21
br label %84
82: ; preds = %76
%83 = call i32 (...) @get_nprocs()
store i32 %83, i32* %21
br label %84
84: ; preds = %82, %80
br label %85
85: ; preds = %84, %71
%86 = load i32, i32* %21
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %86)
%88 = load i32, i32* %16
%89 = zext i32 %88 to i64
%90 = call i8* @llvm.stacksave()
store i8* %90, i8** %28
%91 = alloca i32, i64 %89
store i64 %89, i64* %29
%92 = load i32, i32* %16
%93 = zext i32 %92 to i64
%94 = alloca i32, i64 %93
store i64 %93, i64* %30
%95 = load i32, i32* %16
%96 = zext i32 %95 to i64
%97 = alloca i32, i64 %96
store i64 %96, i64* %31
%98 = load i32, i32* @IPC_PRIVATE
%99 = load i32, i32* %16
%100 = sext i32 %99 to i64
%101 = mul i64 %100, 8
%102 = trunc i64 %101 to i32
%103 = load i32, i32* @IPC_CREAT
%104 = or i32 %103, 438
%105 = call i32 @shmget(i32 %98, i32 %102, i32 %104)
store i32 %105, i32* %18
%106 = icmp slt i32 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %85
%108 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %85
%111 = load i32, i32* @IPC_PRIVATE
%112 = load i32, i32* %16
%113 = sext i32 %112 to i64
%114 = mul i64 %113, 8
%115 = trunc i64 %114 to i32
%116 = load i32, i32* @IPC_CREAT
%117 = or i32 %116, 438
%118 = call i32 @shmget(i32 %111, i32 %115, i32 %117)
store i32 %118, i32* %19
%119 = icmp slt i32 %118, 0
br i1 %119, label %120, label %123
120: ; preds = %110
%121 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%122 = call i32 @exit(i32 1)
unreachable
123: ; preds = %110
%124 = load i32, i32* @IPC_PRIVATE
%125 = load i32, i32* %16
%126 = sext i32 %125 to i64
%127 = mul i64 %126, 8
%128 = trunc i64 %127 to i32
%129 = load i32, i32* @IPC_CREAT
%130 = or i32 %129, 438
%131 = call i32 @shmget(i32 %124, i32 %128, i32 %130)
store i32 %131, i32* %20
%132 = icmp slt i32 %131, 0
br i1 %132, label %133, label %136
133: ; preds = %123
%134 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%135 = call i32 @exit(i32 1)
unreachable
136: ; preds = %123
%137 = load i32, i32* %18
%138 = call i64 @shmat(i32 %137, i32* null, i32 0)
%139 = inttoptr i64 %138 to float**
store float** %139, float*** %6
%140 = load i32, i32* %19
%141 = call i64 @shmat(i32 %140, i32* null, i32 0)
%142 = inttoptr i64 %141 to float**
store float** %142, float*** %7
%143 = load i32, i32* %20
%144 = call i64 @shmat(i32 %143, i32* null, i32 0)
%145 = inttoptr i64 %144 to float**
store float** %145, float*** %8
store i32 0, i32* %15
br label %146
146: ; preds = %229, %136
%147 = load i32, i32* %15
%148 = load i32, i32* %16
%149 = icmp slt i32 %147, %148
br i1 %149, label %150, label %232
150: ; preds = %146
%151 = load i32, i32* @IPC_PRIVATE
%152 = load i32, i32* %17
%153 = sext i32 %152 to i64
%154 = mul i64 %153, 4
%155 = trunc i64 %154 to i32
%156 = load i32, i32* @IPC_CREAT
%157 = or i32 %156, 438
%158 = call i32 @shmget(i32 %151, i32 %155, i32 %157)
%159 = load i32, i32* %15
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i32, i32* %91, i64 %160
store i32 %158, i32* %161
%162 = icmp slt i32 %158, 0
br i1 %162, label %163, label %166
163: ; preds = %150
%164 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %150
%167 = load i32, i32* @IPC_PRIVATE
%168 = load i32, i32* %17
%169 = sext i32 %168 to i64
%170 = mul i64 %169, 4
%171 = trunc i64 %170 to i32
%172 = load i32, i32* @IPC_CREAT
%173 = or i32 %172, 438
%174 = call i32 @shmget(i32 %167, i32 %171, i32 %173)
%175 = load i32, i32* %15
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds i32, i32* %94, i64 %176
store i32 %174, i32* %177
%178 = icmp slt i32 %174, 0
br i1 %178, label %179, label %182
179: ; preds = %166
%180 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%181 = call i32 @exit(i32 1)
unreachable
182: ; preds = %166
%183 = load i32, i32* @IPC_PRIVATE
%184 = load i32, i32* %17
%185 = sext i32 %184 to i64
%186 = mul i64 %185, 4
%187 = trunc i64 %186 to i32
%188 = load i32, i32* @IPC_CREAT
%189 = or i32 %188, 438
%190 = call i32 @shmget(i32 %183, i32 %187, i32 %189)
%191 = load i32, i32* %15
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds i32, i32* %97, i64 %192
store i32 %190, i32* %193
%194 = icmp slt i32 %190, 0
br i1 %194, label %195, label %198
195: ; preds = %182
%196 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%197 = call i32 @exit(i32 1)
unreachable
198: ; preds = %182
%199 = load i32, i32* %15
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds i32, i32* %91, i64 %200
%202 = load i32, i32* %201
%203 = call i64 @shmat(i32 %202, i32* null, i32 0)
%204 = inttoptr i64 %203 to float*
%205 = load float**, float*** %6
%206 = load i32, i32* %15
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds float*, float** %205, i64 %207
store float* %204, float** %208
%209 = load i32, i32* %15
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i32, i32* %94, i64 %210
%212 = load i32, i32* %211
%213 = call i64 @shmat(i32 %212, i32* null, i32 0)
%214 = inttoptr i64 %213 to float*
%215 = load float**, float*** %7
%216 = load i32, i32* %15
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds float*, float** %215, i64 %217
store float* %214, float** %218
%219 = load i32, i32* %15
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds i32, i32* %97, i64 %220
%222 = load i32, i32* %221
%223 = call i64 @shmat(i32 %222, i32* null, i32 0)
%224 = inttoptr i64 %223 to float*
%225 = load float**, float*** %8
%226 = load i32, i32* %15
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds float*, float** %225, i64 %227
store float* %224, float** %228
br label %229
229: ; preds = %198
%230 = load i32, i32* %15
%231 = add nsw i32 %230, 1
store i32 %231, i32* %15
br label %146
232: ; preds = %146
store i32 0, i32* %14
br label %233
233: ; preds = %257, %232
%234 = load i32, i32* %14
%235 = load i32, i32* %16
%236 = icmp slt i32 %234, %235
br i1 %236, label %237, label %260
237: ; preds = %233
store i32 0, i32* %13
br label %238
238: ; preds = %253, %237
%239 = load i32, i32* %13
%240 = load i32, i32* %17
%241 = icmp slt i32 %239, %240
br i1 %241, label %242, label %256
242: ; preds = %238
%243 = load i32*, i32** %27
%244 = load float**, float*** %6
%245 = load i32, i32* %14
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds float*, float** %244, i64 %246
%248 = load float*, float** %247
%249 = load i32, i32* %13
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds float, float* %248, i64 %250
%252 = call i32 (i32*, i8*, ...) @fscanf(i32* %243, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %251)
br label %253
253: ; preds = %242
%254 = load i32, i32* %13
%255 = add nsw i32 %254, 1
store i32 %255, i32* %13
br label %238
256: ; preds = %238
br label %257
257: ; preds = %256
%258 = load i32, i32* %14
%259 = add nsw i32 %258, 1
store i32 %259, i32* %14
br label %233
260: ; preds = %233
%261 = load i32*, i32** %27
%262 = call i32 (i32*, i8*, ...) @fscanf(i32* %261, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %14
br label %263
263: ; preds = %287, %260
%264 = load i32, i32* %14
%265 = load i32, i32* %16
%266 = icmp slt i32 %264, %265
br i1 %266, label %267, label %290
267: ; preds = %263
store i32 0, i32* %13
br label %268
268: ; preds = %283, %267
%269 = load i32, i32* %13
%270 = load i32, i32* %17
%271 = icmp slt i32 %269, %270
br i1 %271, label %272, label %286
272: ; preds = %268
%273 = load i32*, i32** %27
%274 = load float**, float*** %7
%275 = load i32, i32* %14
%276 = sext i32 %275 to i64
%277 = getelementptr inbounds float*, float** %274, i64 %276
%278 = load float*, float** %277
%279 = load i32, i32* %13
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds float, float* %278, i64 %280
%282 = call i32 (i32*, i8*, ...) @fscanf(i32* %273, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %281)
br label %283
283: ; preds = %272
%284 = load i32, i32* %13
%285 = add nsw i32 %284, 1
store i32 %285, i32* %13
br label %268
286: ; preds = %268
br label %287
287: ; preds = %286
%288 = load i32, i32* %14
%289 = add nsw i32 %288, 1
store i32 %289, i32* %14
br label %263
290: ; preds = %263
%291 = load i8**, i8*** %5
%292 = getelementptr inbounds i8*, i8** %291, i64 1
%293 = load i8*, i8** %292
%294 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %293)
%295 = load i32*, i32** %27
%296 = call i32 @fclose(i32* %295)
store i32 0, i32* %23
store i32 1, i32* %15
br label %297
297: ; preds = %308, %290
%298 = load i32, i32* %15
%299 = load i32, i32* %21
%300 = icmp slt i32 %298, %299
br i1 %300, label %301, label %311
301: ; preds = %297
%302 = call i32 (...) @fork()
store i32 %302, i32* %22
%303 = load i32, i32* %22
%304 = icmp ne i32 %303, 0
br i1 %304, label %305, label %306
305: ; preds = %301
br label %311
306: ; preds = %301
%307 = load i32, i32* %15
store i32 %307, i32* %23
br label %308
308: ; preds = %306
%309 = load i32, i32* %15
%310 = add nsw i32 %309, 1
store i32 %310, i32* %15
br label %297
311: ; preds = %305, %297
store i32 0, i32* %26
%312 = load i32, i32* %17
%313 = sitofp i32 %312 to float
%314 = fmul float 1.000000e+00, %313
%315 = load i32, i32* %21
%316 = sitofp i32 %315 to float
%317 = fdiv float %314, %316
%318 = fptosi float %317 to i32
%319 = load i32, i32* %23
%320 = mul nsw i32 %318, %319
store i32 %320, i32* %24
%321 = load i32, i32* %17
%322 = sitofp i32 %321 to float
%323 = fmul float 1.000000e+00, %322
%324 = load i32, i32* %21
%325 = sitofp i32 %324 to float
%326 = fdiv float %323, %325
%327 = fptosi float %326 to i32
%328 = load i32, i32* %23
%329 = add nsw i32 %328, 1
%330 = mul nsw i32 %327, %329
store i32 %330, i32* %25
store i32 0, i32* %14
br label %331
331: ; preds = %386, %311
%332 = load i32, i32* %14
%333 = load i32, i32* %16
%334 = icmp slt i32 %332, %333
br i1 %334, label %335, label %389
335: ; preds = %331
%336 = load i32, i32* %24
store i32 %336, i32* %13
br label %337
337: ; preds = %382, %335
%338 = load i32, i32* %13
%339 = load i32, i32* %25
%340 = icmp slt i32 %338, %339
br i1 %340, label %341, label %385
341: ; preds = %337
store float 0.000000e+00, float* %32
store i32 0, i32* %9
br label %342
342: ; preds = %369, %341
%343 = load i32, i32* %9
%344 = load i32, i32* %17
%345 = icmp slt i32 %343, %344
br i1 %345, label %346, label %372
346: ; preds = %342
%347 = load float**, float*** %6
%348 = load i32, i32* %14
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds float*, float** %347, i64 %349
%351 = load float*, float** %350
%352 = load i32, i32* %9
%353 = sext i32 %352 to i64
%354 = getelementptr inbounds float, float* %351, i64 %353
%355 = load float, float* %354
%356 = load float**, float*** %7
%357 = load i32, i32* %9
%358 = sext i32 %357 to i64
%359 = getelementptr inbounds float*, float** %356, i64 %358
%360 = load float*, float** %359
%361 = load i32, i32* %13
%362 = sext i32 %361 to i64
%363 = getelementptr inbounds float, float* %360, i64 %362
%364 = load float, float* %363
%365 = load float, float* %32
%366 = call float @llvm.fmuladd.f32(float %355, float %364, float %365)
store float %366, float* %32
%367 = load i32, i32* %26
%368 = add nsw i32 %367, 1
store i32 %368, i32* %26
br label %369
369: ; preds = %346
%370 = load i32, i32* %9
%371 = add nsw i32 %370, 1
store i32 %371, i32* %9
br label %342
372: ; preds = %342
%373 = load float, float* %32
%374 = load float**, float*** %8
%375 = load i32, i32* %14
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds float*, float** %374, i64 %376
%378 = load float*, float** %377
%379 = load i32, i32* %13
%380 = sext i32 %379 to i64
%381 = getelementptr inbounds float, float* %378, i64 %380
store float %373, float* %381
br label %382
382: ; preds = %372
%383 = load i32, i32* %13
%384 = add nsw i32 %383, 1
store i32 %384, i32* %13
br label %337
385: ; preds = %337
br label %386
386: ; preds = %385
%387 = load i32, i32* %14
%388 = add nsw i32 %387, 1
store i32 %388, i32* %14
br label %331
389: ; preds = %331
%390 = load i32, i32* %23
%391 = icmp ne i32 %390, 0
br i1 %391, label %394, label %392
392: ; preds = %389
%393 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %394
394: ; preds = %392, %389
%395 = load i32, i32* %23
%396 = load i32, i32* %26
%397 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %395, i32 %396)
%398 = call i32 @wait(i32* null)
%399 = load i32, i32* %23
%400 = icmp ne i32 %399, 0
br i1 %400, label %401, label %402
401: ; preds = %394
store i32 0, i32* %3
store i32 1, i32* %33
br label %424
402: ; preds = %394
%403 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%404 = load float**, float*** %8
%405 = load i32, i32* %17
%406 = load i32, i32* %16
%407 = call i32 @printMatrix(float** %404, i32 %405, i32 %406)
%408 = load float**, float*** %6
%409 = call i32 @shmdt(float** %408)
%410 = load float**, float*** %7
%411 = call i32 @shmdt(float** %410)
%412 = load float**, float*** %8
%413 = call i32 @shmdt(float** %412)
%414 = load i32, i32* %18
%415 = load i32, i32* @IPC_RMID
%416 = call i32 @shmctl(i32 %414, i32 %415, i32 0)
%417 = load i32, i32* %19
%418 = load i32, i32* @IPC_RMID
%419 = call i32 @shmctl(i32 %417, i32 %418, i32 0)
%420 = load i32, i32* %20
%421 = load i32, i32* @IPC_RMID
%422 = call i32 @shmctl(i32 %420, i32 %421, i32 0)
%423 = load i32, i32* @EXIT_SUCCESS
store i32 %423, i32* %3
store i32 1, i32* %33
br label %424
424: ; preds = %402, %401
%425 = load i8*, i8** %28
br label %426
426: ; preds = %424, %59, %49
%427 = load i32, i32* %3
ret i32 %427
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [31 x i8] c"Processadores disponiveis: %d\0A\00"
@.str.5 = [23 x i8] c"Num. de processos: %d\0A\00"
@IPC_PRIVATE = global i32 0
@IPC_CREAT = global i32 0
@.str.6 = [15 x i8] c"erro no shmget\00"
@.str.7 = [9 x i8] c"shmget i\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [19 x i8] c"\0AArquivo %s lido!\0A\00"
@.str.11 = [24 x i8] c"Passos no proc. %d: %d\0A\00"
@.str.12 = [12 x i8] c"\0AResultado:\00"
@IPC_RMID = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [35 x i8] c"Erro: problema ao abrir o arquivo.\00"
@str.13 = [59 x i8] c"Modo de usar: matriz_CPU.o (arquivo) (?qtd. processos > 0)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %17, label %10
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %20, label %14
14: ; preds = %10
%15 = tail call i32 @atoi(i8* %12)
%16 = icmp slt i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %14, %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.13, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
br label %340
20: ; preds = %14, %10
%21 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
br label %340
26: ; preds = %20
%27 = call i32 (i32*, i8*, ...) @fscanf(i32* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %3)
%28 = call i32 (...) @get_nprocs()
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i8*, i8** %11
%31 = icmp eq i8* %30, null
br i1 %31, label %34, label %32
32: ; preds = %26
%33 = call i32 @atoi(i8* %30)
br label %42
34: ; preds = %26
%35 = load i32, i32* %4
%36 = call i32 (...) @get_nprocs()
%37 = icmp sgt i32 %35, %36
br i1 %37, label %40, label %38
38: ; preds = %34
%39 = load i32, i32* %4
br label %42
40: ; preds = %34
%41 = call i32 (...) @get_nprocs()
br label %42
42: ; preds = %38, %40, %32
%43 = phi i32 [ %33, %32 ], [ %39, %38 ], [ %41, %40 ]
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %43)
%45 = call i8* @llvm.stacksave()
%46 = load i32, i32* %3
%47 = load i32, i32* @IPC_PRIVATE
%48 = shl i32 %46, 3
%49 = load i32, i32* @IPC_CREAT
%50 = or i32 %49, 438
%51 = call i32 @shmget(i32 %47, i32 %48, i32 %50)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %42
%54 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %42
%57 = load i32, i32* @IPC_PRIVATE
%58 = load i32, i32* %3
%59 = shl i32 %58, 3
%60 = load i32, i32* @IPC_CREAT
%61 = or i32 %60, 438
%62 = call i32 @shmget(i32 %57, i32 %59, i32 %61)
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %56
%65 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %56
%68 = load i32, i32* @IPC_PRIVATE
%69 = load i32, i32* %3
%70 = shl i32 %69, 3
%71 = load i32, i32* @IPC_CREAT
%72 = or i32 %71, 438
%73 = call i32 @shmget(i32 %68, i32 %70, i32 %72)
%74 = icmp slt i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %67
%76 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %67
%79 = call i64 @shmat(i32 %51, i32* null, i32 0)
%80 = inttoptr i64 %79 to float**
%81 = call i64 @shmat(i32 %62, i32* null, i32 0)
%82 = inttoptr i64 %81 to float**
%83 = call i64 @shmat(i32 %73, i32* null, i32 0)
%84 = inttoptr i64 %83 to float**
%85 = load i32, i32* %3
%86 = icmp sgt i32 %85, 0
br i1 %86, label %91, label %163
87: ; preds = %125
%88 = icmp sgt i32 %136, 0
br i1 %88, label %89, label %163
89: ; preds = %87
%90 = load i32, i32* %4
br label %139
91: ; preds = %78, %125
%92 = phi i64 [ %135, %125 ], [ 0, %78 ]
%93 = load i32, i32* @IPC_PRIVATE
%94 = load i32, i32* %4
%95 = shl i32 %94, 2
%96 = load i32, i32* @IPC_CREAT
%97 = or i32 %96, 438
%98 = call i32 @shmget(i32 %93, i32 %95, i32 %97)
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %91
%101 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %91
%104 = load i32, i32* @IPC_PRIVATE
%105 = load i32, i32* %4
%106 = shl i32 %105, 2
%107 = load i32, i32* @IPC_CREAT
%108 = or i32 %107, 438
%109 = call i32 @shmget(i32 %104, i32 %106, i32 %108)
%110 = icmp slt i32 %109, 0
br i1 %110, label %111, label %114
111: ; preds = %103
%112 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %103
%115 = load i32, i32* @IPC_PRIVATE
%116 = load i32, i32* %4
%117 = shl i32 %116, 2
%118 = load i32, i32* @IPC_CREAT
%119 = or i32 %118, 438
%120 = call i32 @shmget(i32 %115, i32 %117, i32 %119)
%121 = icmp slt i32 %120, 0
br i1 %121, label %122, label %125
122: ; preds = %114
%123 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %114
%126 = call i64 @shmat(i32 %98, i32* null, i32 0)
%127 = inttoptr i64 %126 to float*
%128 = getelementptr inbounds float*, float** %80, i64 %92
store float* %127, float** %128
%129 = call i64 @shmat(i32 %109, i32* null, i32 0)
%130 = inttoptr i64 %129 to float*
%131 = getelementptr inbounds float*, float** %82, i64 %92
store float* %130, float** %131
%132 = call i64 @shmat(i32 %120, i32* null, i32 0)
%133 = inttoptr i64 %132 to float*
%134 = getelementptr inbounds float*, float** %84, i64 %92
store float* %133, float** %134
%135 = add nuw nsw i64 %92, 1
%136 = load i32, i32* %3
%137 = sext i32 %136 to i64
%138 = icmp slt i64 %135, %137
br i1 %138, label %91, label %87
139: ; preds = %89, %157
%140 = phi i32 [ %136, %89 ], [ %158, %157 ]
%141 = phi i32 [ %90, %89 ], [ %159, %157 ]
%142 = phi i64 [ 0, %89 ], [ %160, %157 ]
%143 = icmp sgt i32 %141, 0
br i1 %143, label %144, label %157
144: ; preds = %139
%145 = getelementptr inbounds float*, float** %80, i64 %142
br label %146
146: ; preds = %144, %146
%147 = phi i64 [ 0, %144 ], [ %151, %146 ]
%148 = load float*, float** %145
%149 = getelementptr inbounds float, float* %148, i64 %147
%150 = call i32 (i32*, i8*, ...) @fscanf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %149)
%151 = add nuw nsw i64 %147, 1
%152 = load i32, i32* %4
%153 = sext i32 %152 to i64
%154 = icmp slt i64 %151, %153
br i1 %154, label %146, label %155
155: ; preds = %146
%156 = load i32, i32* %3
br label %157
157: ; preds = %155, %139
%158 = phi i32 [ %156, %155 ], [ %140, %139 ]
%159 = phi i32 [ %152, %155 ], [ %141, %139 ]
%160 = add nuw nsw i64 %142, 1
%161 = sext i32 %158 to i64
%162 = icmp slt i64 %160, %161
br i1 %162, label %139, label %163
163: ; preds = %157, %78, %87
%164 = call i32 (i32*, i8*, ...) @fscanf(i32* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%165 = load i32, i32* %3
%166 = icmp sgt i32 %165, 0
br i1 %166, label %167, label %193
167: ; preds = %163
%168 = load i32, i32* %4
br label %169
169: ; preds = %167, %187
%170 = phi i32 [ %165, %167 ], [ %188, %187 ]
%171 = phi i32 [ %168, %167 ], [ %189, %187 ]
%172 = phi i64 [ 0, %167 ], [ %190, %187 ]
%173 = icmp sgt i32 %171, 0
br i1 %173, label %174, label %187
174: ; preds = %169
%175 = getelementptr inbounds float*, float** %82, i64 %172
br label %176
176: ; preds = %174, %176
%177 = phi i64 [ 0, %174 ], [ %181, %176 ]
%178 = load float*, float** %175
%179 = getelementptr inbounds float, float* %178, i64 %177
%180 = call i32 (i32*, i8*, ...) @fscanf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %179)
%181 = add nuw nsw i64 %177, 1
%182 = load i32, i32* %4
%183 = sext i32 %182 to i64
%184 = icmp slt i64 %181, %183
br i1 %184, label %176, label %185
185: ; preds = %176
%186 = load i32, i32* %3
br label %187
187: ; preds = %185, %169
%188 = phi i32 [ %186, %185 ], [ %170, %169 ]
%189 = phi i32 [ %182, %185 ], [ %171, %169 ]
%190 = add nuw nsw i64 %172, 1
%191 = sext i32 %188 to i64
%192 = icmp slt i64 %190, %191
br i1 %192, label %169, label %193
193: ; preds = %187, %163
%194 = load i8*, i8** %7
%195 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %194)
%196 = call i32 @fclose(i32* %21)
%197 = icmp sgt i32 %43, 1
br i1 %197, label %198, label %210
198: ; preds = %193
%199 = add nsw i32 %43, -1
%200 = call i32 (...) @fork()
%201 = icmp eq i32 %200, 0
br i1 %201, label %202, label %210
202: ; preds = %198, %206
%203 = phi i32 [ %209, %206 ], [ 2, %198 ]
%204 = phi i32 [ %203, %206 ], [ 1, %198 ]
%205 = icmp eq i32 %203, %43
br i1 %205, label %210, label %206
206: ; preds = %202
%207 = call i32 (...) @fork()
%208 = icmp eq i32 %207, 0
%209 = add nuw nsw i32 %203, 1
br i1 %208, label %202, label %210
210: ; preds = %206, %202, %198, %193
%211 = phi i32 [ 0, %193 ], [ 0, %198 ], [ %199, %202 ], [ %204, %206 ]
%212 = load i32, i32* %4
%213 = sitofp i32 %212 to float
%214 = sitofp i32 %43 to float
%215 = fdiv float %213, %214
%216 = fptosi float %215 to i32
%217 = mul i32 %211, %216
%218 = add nuw nsw i32 %211, 1
%219 = mul i32 %218, %216
%220 = load i32, i32* %3
%221 = icmp sgt i32 %220, 0
br i1 %221, label %222, label %314
222: ; preds = %210
%223 = icmp slt i32 %217, %219
%224 = icmp sgt i32 %212, 0
%225 = sext i32 %217 to i64
%226 = call i32 @llvm.smax.i32(i32 %212, i32 0)
%227 = mul i32 %226, %216
%228 = zext i32 %220 to i64
%229 = sext i32 %219 to i64
%230 = zext i32 %212 to i64
%231 = add nsw i64 %230, -1
%232 = and i64 %230, 3
%233 = icmp ult i64 %231, 3
%234 = and i64 %230, 4294967292
%235 = icmp eq i64 %232, 0
br label %236
236: ; preds = %222, %310
%237 = phi i64 [ 0, %222 ], [ %312, %310 ]
%238 = phi i32 [ 0, %222 ], [ %311, %310 ]
br i1 %223, label %239, label %310
239: ; preds = %236
%240 = getelementptr inbounds float*, float** %80, i64 %237
%241 = getelementptr inbounds float*, float** %84, i64 %237
%242 = load float*, float** %241
br label %243
243: ; preds = %239, %303
%244 = phi i64 [ %225, %239 ], [ %306, %303 ]
br i1 %224, label %245, label %303
245: ; preds = %243
%246 = load float*, float** %240
br i1 %233, label %285, label %247
247: ; preds = %245, %247
%248 = phi i64 [ %282, %247 ], [ 0, %245 ]
%249 = phi float [ %281, %247 ], [ 0.000000e+00, %245 ]
%250 = phi i64 [ %283, %247 ], [ 0, %245 ]
%251 = getelementptr inbounds float, float* %246, i64 %248
%252 = load float, float* %251
%253 = getelementptr inbounds float*, float** %82, i64 %248
%254 = load float*, float** %253
%255 = getelementptr inbounds float, float* %254, i64 %244
%256 = load float, float* %255
%257 = call float @llvm.fmuladd.f32(float %252, float %256, float %249)
%258 = or i64 %248, 1
%259 = getelementptr inbounds float, float* %246, i64 %258
%260 = load float, float* %259
%261 = getelementptr inbounds float*, float** %82, i64 %258
%262 = load float*, float** %261
%263 = getelementptr inbounds float, float* %262, i64 %244
%264 = load float, float* %263
%265 = call float @llvm.fmuladd.f32(float %260, float %264, float %257)
%266 = or i64 %248, 2
%267 = getelementptr inbounds float, float* %246, i64 %266
%268 = load float, float* %267
%269 = getelementptr inbounds float*, float** %82, i64 %266
%270 = load float*, float** %269
%271 = getelementptr inbounds float, float* %270, i64 %244
%272 = load float, float* %271
%273 = call float @llvm.fmuladd.f32(float %268, float %272, float %265)
%274 = or i64 %248, 3
%275 = getelementptr inbounds float, float* %246, i64 %274
%276 = load float, float* %275
%277 = getelementptr inbounds float*, float** %82, i64 %274
%278 = load float*, float** %277
%279 = getelementptr inbounds float, float* %278, i64 %244
%280 = load float, float* %279
%281 = call float @llvm.fmuladd.f32(float %276, float %280, float %273)
%282 = add nuw nsw i64 %248, 4
%283 = add i64 %250, 4
%284 = icmp eq i64 %283, %234
br i1 %284, label %285, label %247
285: ; preds = %247, %245
%286 = phi float [ undef, %245 ], [ %281, %247 ]
%287 = phi i64 [ 0, %245 ], [ %282, %247 ]
%288 = phi float [ 0.000000e+00, %245 ], [ %281, %247 ]
br i1 %235, label %303, label %289
289: ; preds = %285, %289
%290 = phi i64 [ %300, %289 ], [ %287, %285 ]
%291 = phi float [ %299, %289 ], [ %288, %285 ]
%292 = phi i64 [ %301, %289 ], [ 0, %285 ]
%293 = getelementptr inbounds float, float* %246, i64 %290
%294 = load float, float* %293
%295 = getelementptr inbounds float*, float** %82, i64 %290
%296 = load float*, float** %295
%297 = getelementptr inbounds float, float* %296, i64 %244
%298 = load float, float* %297
%299 = call float @llvm.fmuladd.f32(float %294, float %298, float %291)
%300 = add nuw nsw i64 %290, 1
%301 = add i64 %292, 1
%302 = icmp eq i64 %301, %232
br i1 %302, label %303, label %289
303: ; preds = %285, %289, %243
%304 = phi float [ 0.000000e+00, %243 ], [ %286, %285 ], [ %299, %289 ]
%305 = getelementptr inbounds float, float* %242, i64 %244
store float %304, float* %305
%306 = add nsw i64 %244, 1
%307 = icmp eq i64 %306, %229
br i1 %307, label %308, label %243
308: ; preds = %303
%309 = add i32 %227, %238
br label %310
310: ; preds = %308, %236
%311 = phi i32 [ %238, %236 ], [ %309, %308 ]
%312 = add nuw nsw i64 %237, 1
%313 = icmp eq i64 %312, %228
br i1 %313, label %314, label %236
314: ; preds = %310, %210
%315 = phi i32 [ 0, %210 ], [ %311, %310 ]
%316 = icmp eq i32 %211, 0
br i1 %316, label %317, label %335
317: ; preds = %314
%318 = call i32 @putchar(i32 10)
%319 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 0, i32 %315)
%320 = call i32 @wait(i32* null)
%321 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%322 = load i32, i32* %4
%323 = load i32, i32* %3
%324 = call i32 @printMatrix(float** %84, i32 %322, i32 %323)
%325 = call i32 @shmdt(float** %80)
%326 = call i32 @shmdt(float** %82)
%327 = call i32 @shmdt(float** %84)
%328 = load i32, i32* @IPC_RMID
%329 = call i32 @shmctl(i32 %51, i32 %328, i32 0)
%330 = load i32, i32* @IPC_RMID
%331 = call i32 @shmctl(i32 %62, i32 %330, i32 0)
%332 = load i32, i32* @IPC_RMID
%333 = call i32 @shmctl(i32 %73, i32 %332, i32 0)
%334 = load i32, i32* @EXIT_SUCCESS
br label %338
335: ; preds = %314
%336 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %211, i32 %315)
%337 = call i32 @wait(i32* null)
br label %338
338: ; preds = %335, %317
%339 = phi i32 [ %334, %317 ], [ 0, %335 ]
br label %340
340: ; preds = %338, %23, %17
%341 = phi i32 [ %19, %17 ], [ %25, %23 ], [ %339, %338 ]
ret i32 %341
}