#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
char getchar();
int getpid();
int isPrimeIt(unsigned long long, unsigned long long, unsigned long long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void isPrimeItIO() {
  unsigned long long guessed, boundsTo;
  unsigned long long boundsFrom = 2;
  bool result = true;
  bool r1 = false;
  bool r2 = false;
  bool r3 = false;
  bool r4 = false;
  bool r5 = false;
  bool r6 = false;
  printf("Bitte geben sie ihre Zahl ein: ");
  do {
    scanf("%llu", &guessed);
  } while (getchar() != '\n');
  int pid = fork();
  if (pid == 0) {
    r1 = isPrimeIt(guessed, boundsFrom, guessed / 7);
    printf("\nr1 = %d | boundsFrom = %llu | guessed/7 = %llu \n", r1,
           boundsFrom, guessed / 7);
    printf("KIND 1 : %d\n", getpid());
    exit(0);
  } else if (pid > 0) {
    r2 = isPrimeIt(guessed, guessed / 7, guessed / 6);
    waitpid(pid, NULL, 0);
    printf("ELTERN 1 : %d\n", getpid());
    printf("\nr2 = %d | guessed/7 = %llu | guessed/6 = %llu \n", r2,
           guessed / 7, guessed / 6);
    printf("\nErster Fork ist fertig. R1 = %d und R2: %d\n", r1, r2);
    int pid2 = fork();
    if (pid2 == 0) {
      r3 = isPrimeIt(guessed, guessed / 6, guessed / 5);
      printf("\nr3 = %d | guessed/6 = %llu | guessed/7 = %llu \n", r3,
             guessed / 6, guessed / 5);
      exit(0);
    } else if (pid2 > 0) {
      r4 = isPrimeIt(guessed, guessed / 5, guessed / 4);
      printf("\nr4 = %d | guessed/5 = %llu | guessed/4 = %llu \n", r4,
             guessed / 5, guessed / 4);
      waitpid(pid, NULL, 0);
      waitpid(pid2, NULL, 0);
      printf("\nZweiter Fork ist fertig. R3 = %d und R4: %d\n", r3, r4);
      int pid3 = fork();
      if (pid3 == 0) {
        r5 = isPrimeIt(guessed, guessed / 4, guessed / 3);
        printf("\nr5 = %d | guessed/4 = %llu | guessed/3 = %llu \n", r5,
               guessed / 4, guessed / 3);
        exit(0);
      } else if (pid3 > 0) {
        r6 = isPrimeIt(guessed, guessed / 3, guessed / 2);
        printf("\nr6 = %d | guessed/3 = %llu | guessed/2 = %llu \n", r6,
               guessed / 3, guessed / 2);
        waitpid(pid, NULL, 0);
        waitpid(pid2, NULL, 0);
        waitpid(pid3, NULL, 0);
        printf("\nDritter Fork ist fertig. R5 = %d und R6: %d\n\n", r5, r6);
      } else {
        printf("\n Es ist ein Fehler aufgetreten! \n");
      }
    } else {
      printf("\n Es ist ein Fehler aufgetreten! \n");
      exit(0);
    }
  } else {
    printf("\n Es ist ein Fehler aufgetreten! \n");
  }
  printf("R1 = %d | R2 = %d | R3 = %d | R4 = %d | R5 = %d | R6 = %d | \n ", r1,
         r2, r3, r4, r5, r6);
  result = r1 && r2 && r3 && r4 && r5 && r6;
  switch (result) {
  case true:
    printf("Die Zahl %llu is eine Primzahl!\n\n", guessed);
    break;
  default:
    printf("Die Zahl %llu ist keine Primzahl!\n\n", guessed);
    break;
  }
}


x86 assembly (clang, -O0):
<isPrimeItIO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movq   $0x2,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    11cf <isPrimeItIO+0x4f>
mov    $0x0,%al
call   10a0 <fork@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jne    1273 <isPrimeItIO+0xf3>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    $0x7,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x7,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x48(%rbp),%rdx
mov    %rax,%rcx
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
cmpl   $0x0,-0x38(%rbp)
jle    156b <isPrimeItIO+0x3eb>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    $0x7,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    $0x6,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,-0x24(%rbp)
mov    -0x38(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    $0x7,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x6,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x50(%rbp),%rdx
mov    %rax,%rcx
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <fork@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jne    139d <isPrimeItIO+0x21d>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    $0x6,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    $0x6,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
cmpl   $0x0,-0x3c(%rbp)
jle    154c <isPrimeItIO+0x3cc>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
shr    $0x2,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
shr    $0x2,%rcx
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    -0x3c(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <fork@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jne    1498 <isPrimeItIO+0x318>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
shr    $0x2,%rsi
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x60(%rbp),%rdx
mov    %rax,%rcx
lea    0xcd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
cmpl   $0x0,-0x40(%rbp)
jle    1534 <isPrimeItIO+0x3b4>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
shr    $0x1,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    -0x3c(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    -0x40(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
lea    0xc9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1542 <isPrimeItIO+0x3c2>
lea    0xcb7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1547 <isPrimeItIO+0x3c7>
jmp    1561 <isPrimeItIO+0x3e1>
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    1566 <isPrimeItIO+0x3e6>
jmp    1579 <isPrimeItIO+0x3f9>
lea    0xc80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    157e <isPrimeItIO+0x3fe>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x34(%rbp),%eax
lea    0xc7c(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x20(%rbp)
mov    %al,-0x61(%rbp)
je     15f8 <isPrimeItIO+0x478>
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x61(%rbp)
je     15f8 <isPrimeItIO+0x478>
xor    %eax,%eax
cmpl   $0x0,-0x28(%rbp)
mov    %al,-0x61(%rbp)
je     15f8 <isPrimeItIO+0x478>
xor    %eax,%eax
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x61(%rbp)
je     15f8 <isPrimeItIO+0x478>
xor    %eax,%eax
cmpl   $0x0,-0x30(%rbp)
mov    %al,-0x61(%rbp)
je     15f8 <isPrimeItIO+0x478>
cmpl   $0x0,-0x34(%rbp)
setne  %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
movzbl %al,%eax
and    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
jne    162c <isPrimeItIO+0x4ac>
jmp    1615 <isPrimeItIO+0x495>
mov    -0x8(%rbp),%rsi
lea    0xc34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    163e <isPrimeItIO+0x4be>
mov    -0x8(%rbp),%rsi
lea    0xc3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrimeItIO>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe6d(%rip),%rbx
lea    0x10(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    $0xa,%al
jne    11c0 <isPrimeItIO+0x30>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     143a <isPrimeItIO+0x2aa>
jle    13d6 <isPrimeItIO+0x246>
mov    %eax,%r12d
mov    0x10(%rsp),%rdi
movabs $0x2492492492492493,%rbx
49 92 24
mov    %rdi,%rax
mul    %rbx
mov    %rdi,%rsi
sub    %rdx,%rsi
shr    %rsi
add    %rdx,%rsi
shr    $0x2,%rsi
movabs $0xaaaaaaaaaaaaaaab,%r13
aa aa aa
mov    %rdi,%rax
mul    %r13
shr    $0x2,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,%r14d
mov    %r12d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xe1b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%rcx
mov    %rcx,%rax
mul    %rbx
mov    %rdx,%rbp
mov    %rcx,%rax
sub    %rdx,%rax
shr    %rax
add    %rax,%rbp
shr    $0x2,%rbp
mov    %rcx,%rax
mul    %r13
mov    %rdx,%rcx
shr    $0x2,%rcx
lea    0xdef(%rip),%rdi
mov    %r14d,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe0c(%rip),%rdi
xor    %esi,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     14b4 <isPrimeItIO+0x324>
jle    1509 <isPrimeItIO+0x379>
mov    %eax,%r15d
mov    %r13,%rbp
mov    0x10(%rsp),%rdi
movabs $0xcccccccccccccccd,%rbx
cc cc cc
mov    %rdi,%rax
mul    %rbx
shr    $0x2,%rdx
mov    %rdi,%rax
shr    $0x2,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,%r13d
mov    0x10(%rsp),%rcx
mov    %rcx,%rax
mul    %rbx
shr    $0x2,%rdx
shr    $0x2,%rcx
lea    0xdfb(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
lea    0xe03(%rip),%rdi
xor    %esi,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     151c <isPrimeItIO+0x38c>
jle    13ec <isPrimeItIO+0x25c>
mov    %eax,%ebx
mov    0x10(%rsp),%rdi
mov    %rdi,%rax
mul    %rbp
shr    %rdx
mov    %rdi,%rax
shr    %rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%rcx
mov    %rcx,%rax
movabs $0xaaaaaaaaaaaaaaab,%rdx
aa aa aa
mul    %rdx
shr    %rdx
shr    %rcx
lea    0xdfc(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
lea    0xdfa(%rip),%rdi
xor    %esi,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13fa <isPrimeItIO+0x26a>
lea    0xe78(%rip),%rdi
call   1040 <puts@plt>
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    13fa <isPrimeItIO+0x26a>
lea    0xe62(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
mov    %ebp,(%rsp)
lea    0xdee(%rip),%rdi
xor    %esi,%esi
mov    %r14d,%edx
xor    %ecx,%ecx
mov    %r13d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%rsi
lea    0xe0d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%rdi
movabs $0x2492492492492493,%rbx
49 92 24
mov    %rdi,%rax
mul    %rbx
mov    %rdi,%rax
sub    %rdx,%rax
shr    %rax
add    %rax,%rdx
shr    $0x2,%rdx
mov    $0x2,%esi
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
mov    0x10(%rsp),%rcx
mov    %rcx,%rax
mul    %rbx
sub    %rdx,%rcx
shr    %rcx
add    %rdx,%rcx
shr    $0x2,%rcx
lea    0xb9b(%rip),%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xbb3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    0x10(%rsp),%rdi
mov    %rdi,%rax
mul    %r13
mov    %rdx,%rsi
shr    $0x2,%rsi
movabs $0xcccccccccccccccd,%rbx
cc cc cc
mov    %rdi,%rax
mul    %rbx
shr    $0x2,%rdx
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
mov    0x10(%rsp),%rcx
mov    %rcx,%rax
mul    %r13
mov    %rdx,%rbp
shr    $0x2,%rbp
mov    %rcx,%rax
mul    %rbx
mov    %rdx,%rcx
shr    $0x2,%rcx
lea    0xbca(%rip),%rdi
jmp    1557 <isPrimeItIO+0x3c7>
lea    0xd45(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    0x10(%rsp),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
mov    %rdi,%rax
mov    %rbp,%rbx
mul    %rbp
shr    %rdx
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
mov    0x10(%rsp),%rax
mov    %rax,%rbp
shr    $0x2,%rbp
mul    %rbx
mov    %rdx,%rcx
shr    %rcx
lea    0xc0a(%rip),%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Bitte geben sie ihre Zahl ein: \00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [50 x i8] c"\0Ar1 = %d | boundsFrom = %llu | guessed/7 = %llu \0A\00"
@.str.3 = [13 x i8] c"KIND 1 : %d\0A\00"
@.str.4 = [15 x i8] c"ELTERN 1 : %d\0A\00"
@.str.5 = [49 x i8] c"\0Ar2 = %d | guessed/7 = %llu | guessed/6 = %llu \0A\00"
@.str.6 = [45 x i8] c"\0AErster Fork ist fertig. R1 = %d und R2: %d\0A\00"
@.str.7 = [49 x i8] c"\0Ar3 = %d | guessed/6 = %llu | guessed/7 = %llu \0A\00"
@.str.8 = [49 x i8] c"\0Ar4 = %d | guessed/5 = %llu | guessed/4 = %llu \0A\00"
@.str.9 = [46 x i8] c"\0AZweiter Fork ist fertig. R3 = %d und R4: %d\0A\00"
@.str.10 = [49 x i8] c"\0Ar5 = %d | guessed/4 = %llu | guessed/3 = %llu \0A\00"
@.str.11 = [49 x i8] c"\0Ar6 = %d | guessed/3 = %llu | guessed/2 = %llu \0A\00"
@.str.12 = [47 x i8] c"\0ADritter Fork ist fertig. R5 = %d und R6: %d\0A\0A\00"
@.str.13 = [35 x i8] c"\0A Es ist ein Fehler aufgetreten! \0A\00"
@.str.14 = [63 x i8] c"R1 = %d | R2 = %d | R3 = %d | R4 = %d | R5 = %d | R6 = %d | \0A \00"
@.str.15 = [34 x i8] c"Die Zahl %llu is eine Primzahl!\0A\0A\00"
@.str.16 = [36 x i8] c"Die Zahl %llu ist keine Primzahl!\0A\0A\00"
define void @isPrimeItIO() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i64 2, i64* %3
store i32 1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %17, %0
%16 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
br label %17
17: ; preds = %15
%18 = call signext i8 (...) @getchar()
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 10
br i1 %20, label %15, label %21
21: ; preds = %17
%22 = call i32 (...) @fork()
store i32 %22, i32* %11
%23 = load i32, i32* %11
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %39
25: ; preds = %21
%26 = load i64, i64* %1
%27 = load i64, i64* %3
%28 = load i64, i64* %1
%29 = udiv i64 %28, 7
%30 = call i32 @isPrimeIt(i64 %26, i64 %27, i64 %29)
store i32 %30, i32* %5
%31 = load i32, i32* %5
%32 = load i64, i64* %3
%33 = load i64, i64* %1
%34 = udiv i64 %33, 7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %31, i64 %32, i64 %34)
%36 = call i32 (...) @getpid()
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = call i32 @exit(i32 0)
unreachable
39: ; preds = %21
%40 = load i32, i32* %11
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %153
42: ; preds = %39
%43 = load i64, i64* %1
%44 = load i64, i64* %1
%45 = udiv i64 %44, 7
%46 = load i64, i64* %1
%47 = udiv i64 %46, 6
%48 = call i32 @isPrimeIt(i64 %43, i64 %45, i64 %47)
store i32 %48, i32* %6
%49 = load i32, i32* %11
%50 = call i32 @waitpid(i32 %49, i32* null, i32 0)
%51 = call i32 (...) @getpid()
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %6
%54 = load i64, i64* %1
%55 = udiv i64 %54, 7
%56 = load i64, i64* %1
%57 = udiv i64 %56, 6
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i32 %53, i64 %55, i64 %57)
%59 = load i32, i32* %5
%60 = load i32, i32* %6
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i32 %59, i32 %60)
%62 = call i32 (...) @fork()
store i32 %62, i32* %12
%63 = load i32, i32* %12
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %79
65: ; preds = %42
%66 = load i64, i64* %1
%67 = load i64, i64* %1
%68 = udiv i64 %67, 6
%69 = load i64, i64* %1
%70 = udiv i64 %69, 5
%71 = call i32 @isPrimeIt(i64 %66, i64 %68, i64 %70)
store i32 %71, i32* %7
%72 = load i32, i32* %7
%73 = load i64, i64* %1
%74 = udiv i64 %73, 6
%75 = load i64, i64* %1
%76 = udiv i64 %75, 5
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 %72, i64 %74, i64 %76)
%78 = call i32 @exit(i32 0)
unreachable
79: ; preds = %42
%80 = load i32, i32* %12
%81 = icmp sgt i32 %80, 0
br i1 %81, label %82, label %148
82: ; preds = %79
%83 = load i64, i64* %1
%84 = load i64, i64* %1
%85 = udiv i64 %84, 5
%86 = load i64, i64* %1
%87 = udiv i64 %86, 4
%88 = call i32 @isPrimeIt(i64 %83, i64 %85, i64 %87)
store i32 %88, i32* %8
%89 = load i32, i32* %8
%90 = load i64, i64* %1
%91 = udiv i64 %90, 5
%92 = load i64, i64* %1
%93 = udiv i64 %92, 4
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i32 %89, i64 %91, i64 %93)
%95 = load i32, i32* %11
%96 = call i32 @waitpid(i32 %95, i32* null, i32 0)
%97 = load i32, i32* %12
%98 = call i32 @waitpid(i32 %97, i32* null, i32 0)
%99 = load i32, i32* %7
%100 = load i32, i32* %8
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 %99, i32 %100)
%102 = call i32 (...) @fork()
store i32 %102, i32* %13
%103 = load i32, i32* %13
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %119
105: ; preds = %82
%106 = load i64, i64* %1
%107 = load i64, i64* %1
%108 = udiv i64 %107, 4
%109 = load i64, i64* %1
%110 = udiv i64 %109, 3
%111 = call i32 @isPrimeIt(i64 %106, i64 %108, i64 %110)
store i32 %111, i32* %9
%112 = load i32, i32* %9
%113 = load i64, i64* %1
%114 = udiv i64 %113, 4
%115 = load i64, i64* %1
%116 = udiv i64 %115, 3
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0), i32 %112, i64 %114, i64 %116)
%118 = call i32 @exit(i32 0)
unreachable
119: ; preds = %82
%120 = load i32, i32* %13
%121 = icmp sgt i32 %120, 0
br i1 %121, label %122, label %144
122: ; preds = %119
%123 = load i64, i64* %1
%124 = load i64, i64* %1
%125 = udiv i64 %124, 3
%126 = load i64, i64* %1
%127 = udiv i64 %126, 2
%128 = call i32 @isPrimeIt(i64 %123, i64 %125, i64 %127)
store i32 %128, i32* %10
%129 = load i32, i32* %10
%130 = load i64, i64* %1
%131 = udiv i64 %130, 3
%132 = load i64, i64* %1
%133 = udiv i64 %132, 2
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 %129, i64 %131, i64 %133)
%135 = load i32, i32* %11
%136 = call i32 @waitpid(i32 %135, i32* null, i32 0)
%137 = load i32, i32* %12
%138 = call i32 @waitpid(i32 %137, i32* null, i32 0)
%139 = load i32, i32* %13
%140 = call i32 @waitpid(i32 %139, i32* null, i32 0)
%141 = load i32, i32* %9
%142 = load i32, i32* %10
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0), i32 %141, i32 %142)
br label %146
144: ; preds = %119
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
br label %146
146: ; preds = %144, %122
br label %147
147: ; preds = %146
br label %151
148: ; preds = %79
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
%150 = call i32 @exit(i32 0)
unreachable
151: ; preds = %147
br label %152
152: ; preds = %151
br label %155
153: ; preds = %39
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
br label %155
155: ; preds = %153, %152
br label %156
156: ; preds = %155
%157 = load i32, i32* %5
%158 = load i32, i32* %6
%159 = load i32, i32* %7
%160 = load i32, i32* %8
%161 = load i32, i32* %9
%162 = load i32, i32* %10
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.14, i64 0, i64 0), i32 %157, i32 %158, i32 %159, i32 %160, i32 %161, i32 %162)
%164 = load i32, i32* %5
%165 = icmp ne i32 %164, 0
br i1 %165, label %166, label %181
166: ; preds = %156
%167 = load i32, i32* %6
%168 = icmp ne i32 %167, 0
br i1 %168, label %169, label %181
169: ; preds = %166
%170 = load i32, i32* %7
%171 = icmp ne i32 %170, 0
br i1 %171, label %172, label %181
172: ; preds = %169
%173 = load i32, i32* %8
%174 = icmp ne i32 %173, 0
br i1 %174, label %175, label %181
175: ; preds = %172
%176 = load i32, i32* %9
%177 = icmp ne i32 %176, 0
br i1 %177, label %178, label %181
178: ; preds = %175
%179 = load i32, i32* %10
%180 = icmp ne i32 %179, 0
br label %181
181: ; preds = %178, %175, %172, %169, %166, %156
%182 = phi i1 [ false, %175 ], [ false, %172 ], [ false, %169 ], [ false, %166 ], [ false, %156 ], [ %180, %178 ]
%183 = zext i1 %182 to i32
store i32 %183, i32* %4
%184 = load i32, i32* %4
switch i32 %184, label %188 [
i32 1, label %185
]
185: ; preds = %181
%186 = load i64, i64* %1
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0), i64 %186)
br label %191
188: ; preds = %181
%189 = load i64, i64* %1
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0), i64 %189)
br label %191
191: ; preds = %188, %185
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Bitte geben sie ihre Zahl ein: \00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [50 x i8] c"\0Ar1 = %d | boundsFrom = %llu | guessed/7 = %llu \0A\00"
@.str.3 = [13 x i8] c"KIND 1 : %d\0A\00"
@.str.4 = [15 x i8] c"ELTERN 1 : %d\0A\00"
@.str.5 = [49 x i8] c"\0Ar2 = %d | guessed/7 = %llu | guessed/6 = %llu \0A\00"
@.str.6 = [45 x i8] c"\0AErster Fork ist fertig. R1 = %d und R2: %d\0A\00"
@.str.7 = [49 x i8] c"\0Ar3 = %d | guessed/6 = %llu | guessed/7 = %llu \0A\00"
@.str.8 = [49 x i8] c"\0Ar4 = %d | guessed/5 = %llu | guessed/4 = %llu \0A\00"
@.str.9 = [46 x i8] c"\0AZweiter Fork ist fertig. R3 = %d und R4: %d\0A\00"
@.str.10 = [49 x i8] c"\0Ar5 = %d | guessed/4 = %llu | guessed/3 = %llu \0A\00"
@.str.11 = [49 x i8] c"\0Ar6 = %d | guessed/3 = %llu | guessed/2 = %llu \0A\00"
@.str.12 = [47 x i8] c"\0ADritter Fork ist fertig. R5 = %d und R6: %d\0A\0A\00"
@.str.14 = [63 x i8] c"R1 = %d | R2 = %d | R3 = %d | R4 = %d | R5 = %d | R6 = %d | \0A \00"
@.str.16 = [36 x i8] c"Die Zahl %llu ist keine Primzahl!\0A\0A\00"
@str.18 = [34 x i8] c"\0A Es ist ein Fehler aufgetreten! \00"
define void @isPrimeItIO() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%6 = call signext i8 (...) @getchar()
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %4
8: ; preds = %4
%9 = call i32 (...) @fork()
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i64, i64* %1
%13 = udiv i64 %12, 7
%14 = call i32 @isPrimeIt(i64 %12, i64 2, i64 %13)
%15 = load i64, i64* %1
%16 = udiv i64 %15, 7
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %14, i64 2, i64 %16)
%18 = call i32 (...) @getpid()
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %8
%22 = icmp sgt i32 %9, 0
br i1 %22, label %23, label %94
23: ; preds = %21
%24 = load i64, i64* %1
%25 = udiv i64 %24, 7
%26 = udiv i64 %24, 6
%27 = call i32 @isPrimeIt(i64 %24, i64 %25, i64 %26)
%28 = call i32 @waitpid(i32 %9, i32* null, i32 0)
%29 = call i32 (...) @getpid()
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%31 = load i64, i64* %1
%32 = udiv i64 %31, 7
%33 = udiv i64 %31, 6
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i32 %27, i64 %32, i64 %33)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i32 0, i32 %27)
%36 = call i32 (...) @fork()
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %48
38: ; preds = %23
%39 = load i64, i64* %1
%40 = udiv i64 %39, 6
%41 = udiv i64 %39, 5
%42 = call i32 @isPrimeIt(i64 %39, i64 %40, i64 %41)
%43 = load i64, i64* %1
%44 = udiv i64 %43, 6
%45 = udiv i64 %43, 5
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 %42, i64 %44, i64 %45)
%47 = call i32 @exit(i32 0)
unreachable
48: ; preds = %23
%49 = icmp sgt i32 %36, 0
br i1 %49, label %50, label %91
50: ; preds = %48
%51 = load i64, i64* %1
%52 = udiv i64 %51, 5
%53 = lshr i64 %51, 2
%54 = call i32 @isPrimeIt(i64 %51, i64 %52, i64 %53)
%55 = load i64, i64* %1
%56 = udiv i64 %55, 5
%57 = lshr i64 %55, 2
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i32 %54, i64 %56, i64 %57)
%59 = call i32 @waitpid(i32 %9, i32* null, i32 0)
%60 = call i32 @waitpid(i32 %36, i32* null, i32 0)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 0, i32 %54)
%62 = call i32 (...) @fork()
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %74
64: ; preds = %50
%65 = load i64, i64* %1
%66 = lshr i64 %65, 2
%67 = udiv i64 %65, 3
%68 = call i32 @isPrimeIt(i64 %65, i64 %66, i64 %67)
%69 = load i64, i64* %1
%70 = lshr i64 %69, 2
%71 = udiv i64 %69, 3
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0), i32 %68, i64 %70, i64 %71)
%73 = call i32 @exit(i32 0)
unreachable
74: ; preds = %50
%75 = icmp sgt i32 %62, 0
br i1 %75, label %76, label %89
76: ; preds = %74
%77 = load i64, i64* %1
%78 = udiv i64 %77, 3
%79 = lshr i64 %77, 1
%80 = call i32 @isPrimeIt(i64 %77, i64 %78, i64 %79)
%81 = load i64, i64* %1
%82 = udiv i64 %81, 3
%83 = lshr i64 %81, 1
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 %80, i64 %82, i64 %83)
%85 = call i32 @waitpid(i32 %9, i32* null, i32 0)
%86 = call i32 @waitpid(i32 %36, i32* null, i32 0)
%87 = call i32 @waitpid(i32 %62, i32* null, i32 0)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0), i32 0, i32 %80)
br label %96
89: ; preds = %74
%90 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0))
br label %96
91: ; preds = %48
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0))
%93 = call i32 @exit(i32 0)
unreachable
94: ; preds = %21
%95 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0))
br label %96
96: ; preds = %89, %76, %94
%97 = phi i32 [ 0, %94 ], [ %54, %76 ], [ %54, %89 ]
%98 = phi i32 [ 0, %94 ], [ %80, %76 ], [ 0, %89 ]
%99 = phi i32 [ 0, %94 ], [ %27, %76 ], [ %27, %89 ]
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.14, i64 0, i64 0), i32 0, i32 %99, i32 0, i32 %97, i32 0, i32 %98)
%101 = load i64, i64* %1
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0), i64 %101)
ret void
}