#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 pid_t;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int fork();
int getchar();
int /*<<< orphan*/ perror(char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int const);
scalar_t__ scanf(char *, unsigned long long *);
int sqrt(unsigned long long);
int /*<<< orphan*/ stdout;
int waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int write(int, char *, int const);
int main(void) {
  unsigned long long number = 0;
  unsigned long long begin1, begin2, end1, end2;
  unsigned long long i = 0;
  bool isPrime = true;
  int v = 0;
  int ret_code = 0;
  const int n = sizeof(int);
  char check[n];
  int fd[2];
  pid_t pid = 0;
  begin1 = begin2 = end1 = end2 = 0;
  fd[0] = fd[1] = 0;
  check[0] = check[1] = check[2] = check[3] = 'x';
  printf("Bitte gibt eine zu pruefende Zahl ein: ");
  while (scanf("%llu", &number) <= 0) {
    printf("Fehler bei der Eingabe. Bitte versuche es noch einmal: ");
    int c = getchar();
    while (c != '\n' && c != EOF)
      c = getchar();
  }
  printf("%llu ist... ", number);
  fflush(stdout);
  if (number == 0 || number == 1) {
    printf("keine Primzahl.\n");
    return EXIT_SUCCESS;
  } else if (number == 2 || number == 3) {
    printf("eine Primzahl.\n");
    return EXIT_SUCCESS;
  }
  if (number % 2 == 0) {
    printf("keine Primzahl.\n");
    return EXIT_SUCCESS;
  }
  begin1 = 3;
  end1 = sqrt(number) / 2;
  begin2 = end1 + 1;
  end2 = sqrt(number) + 1;
  ret_code = pipe(fd);
  if (ret_code < 0) {
    perror("Fehler beim Einrichten der Pipe.");
    exit(EXIT_FAILURE);
  }
  pid = ret_code = fork();
  if (ret_code < 0) {
    perror("Fehler bei fork().");
    exit(EXIT_FAILURE);
  }
  if (pid > 0) {
    close(fd[1]);
    for (i = begin1; i <= end1; i += 2) {
      if (number % i == 0) {
        isPrime = false;
        break;
      }
    }
    ret_code = waitpid(pid, NULL, 0);
    if (ret_code < 0) {
      perror("Fehler beim Warten auf Kindprozess.");
      exit(EXIT_FAILURE);
    }
    read(fd[0], check, n);
    if (((check[0] << 24) + (check[1] << 16) + (check[2] << 8) + check[3]) !=
        0) {
      isPrime = false;
    }
    if (isPrime)
      printf("eine Primzahl.\n");
    else
      printf("keine Primzahl.\n");
  } else {
    close(fd[0]);
    if (begin2 % 2 == 0)
      begin2++;
    for (i = begin2; i < end2; i += 2) {
      if (number % i == 0) {
        v = 1;
        break;
      }
    }
    check[0] = (v >> 24) & 0xFF;
    check[1] = (v >> 16) & 0xFF;
    check[2] = (v >> 8) & 0xFF;
    check[3] = v & 0xFF;
    ret_code = write(fd[1], check, n);
    if (ret_code != n) {
      perror("Fehler bei write().");
      exit(EXIT_FAILURE);
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x4,-0x48(%rbp)
mov    %rsp,%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x5c(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movb   $0x78,-0x6d(%rbp)
movb   $0x78,-0x6e(%rbp)
movb   $0x78,-0x6f(%rbp)
movb   $0x78,-0x70(%rbp)
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdb9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10a0 <scanf@plt>
cmp    $0x0,%rax
jg     12df <main+0x10f>
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %eax,-0x60(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x60(%rbp)
mov    %al,-0x71(%rbp)
je     12bb <main+0xeb>
mov    -0x60(%rbp),%eax
mov    0x2d35(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    12cb <main+0xfb>
jmp    12da <main+0x10a>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %eax,-0x60(%rbp)
jmp    129a <main+0xca>
jmp    1268 <main+0x98>
mov    -0x10(%rbp),%rsi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
cmpq   $0x0,-0x10(%rbp)
je     1315 <main+0x145>
cmpq   $0x1,-0x10(%rbp)
jne    133b <main+0x16b>
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1650 <main+0x480>
cmpq   $0x2,-0x10(%rbp)
je     1351 <main+0x181>
cmpq   $0x3,-0x10(%rbp)
jne    1377 <main+0x1a7>
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1650 <main+0x480>
jmp    137c <main+0x1ac>
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    13b4 <main+0x1e4>
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c25(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1650 <main+0x480>
movq   $0x3,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   10d0 <sqrt@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   10d0 <sqrt@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x30(%rbp)
lea    -0x58(%rbp),%rdi
call   1060 <pipe@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    1421 <main+0x251>
lea    0xc75(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x44(%rbp)
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    1452 <main+0x282>
lea    0xc65(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2b8d(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
cmpl   $0x0,-0x5c(%rbp)
jle    1557 <main+0x387>
mov    -0x54(%rbp),%edi
call   1050 <close@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
ja     14b2 <main+0x2e2>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x38(%rbp)
cmp    $0x0,%rdx
jne    149c <main+0x2cc>
movl   $0x0,-0x3c(%rbp)
jmp    14b2 <main+0x2e2>
jmp    14a1 <main+0x2d1>
mov    -0x38(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x38(%rbp)
jmp    146c <main+0x29c>
mov    -0x5c(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <waitpid@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    14e7 <main+0x317>
lea    0xbe3(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2af8(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x58(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x4,%edx
call   1070 <read@plt>
movsbl -0x70(%rbp),%eax
shl    $0x18,%eax
movsbl -0x6f(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
movsbl -0x6e(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
movsbl -0x6d(%rbp),%ecx
add    %ecx,%eax
cmp    $0x0,%eax
je     1527 <main+0x357>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1544 <main+0x374>
lea    0xb3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1552 <main+0x382>
lea    0xb27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    163d <main+0x46d>
mov    -0x58(%rbp),%edi
call   1050 <close@plt>
mov    -0x20(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    157d <main+0x3ad>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    15cb <main+0x3fb>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x38(%rbp)
cmp    $0x0,%rdx
jne    15b5 <main+0x3e5>
movl   $0x1,-0x40(%rbp)
jmp    15cb <main+0x3fb>
jmp    15ba <main+0x3ea>
mov    -0x38(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x38(%rbp)
jmp    1585 <main+0x3b5>
mov    -0x40(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x70(%rbp)
mov    -0x40(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x6f(%rbp)
mov    -0x40(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x6e(%rbp)
mov    -0x40(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x6d(%rbp)
mov    -0x54(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x4,-0x44(%rbp)
je     1638 <main+0x468>
lea    0xab6(%rip),%rdi
call   10c0 <perror@plt>
mov    0x29a7(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    163d <main+0x46d>
mov    0x2984(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%r12
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
movl   $0x78787878,(%rsp)
lea    0xdef(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe09(%rip),%rdi
lea    0x8(%rsp),%rsi
call   10b0 <scanf@plt>
test   %rax,%rax
jle    127e <main+0x9e>
mov    0x8(%rsp),%rsi
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    0x8(%rsp),%rax
lea    0xe83(%rip),%rdi
cmp    $0x2,%rax
jb     144a <main+0x26a>
mov    %rax,%rcx
and    $0xfffffffffffffffe,%rcx
cmp    $0x2,%rcx
jne    12d3 <main+0xf3>
lea    0xe66(%rip),%rdi
jmp    144a <main+0x26a>
lea    0xda8(%rip),%r14
mov    0x2d5c(%rip),%rbp
lea    0xd95(%rip),%r15
lea    0x8(%rsp),%rbx
jmp    12b4 <main+0xd4>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   10b0 <scanf@plt>
test   %rax,%rax
jg     122e <main+0x4e>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0xa,%eax
je     12a0 <main+0xc0>
cmp    0x0(%rbp),%eax
jne    12c0 <main+0xe0>
jmp    12a0 <main+0xc0>
test   $0x1,%al
je     144a <main+0x26a>
mov    %rax,%rdi
call   10e0 <sqrt@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rdi
call   10e0 <sqrt@plt>
mov    %eax,%r15d
lea    0x10(%rsp),%rdi
call   1070 <pipe@plt>
test   %eax,%eax
js     149a <main+0x2ba>
mov    %ebx,%ebp
shr    $0x1f,%ebp
add    %ebx,%ebp
sar    %ebp
movslq %ebp,%rbx
lea    0x1(%rbx),%r13
add    $0x1,%r15d
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
js     14a3 <main+0x2c3>
je     1341 <main+0x161>
mov    %eax,%r14d
mov    0x14(%rsp),%edi
call   1060 <close@plt>
cmp    $0x3,%ebp
jae    13a1 <main+0x1c1>
xor    %ebp,%ebp
jmp    13eb <main+0x20b>
movslq %r15d,%rbp
mov    0x10(%rsp),%edi
call   1060 <close@plt>
add    $0x2,%rbx
test   $0x1,%r13b
cmovne %r13,%rbx
cmp    %rbp,%rbx
jae    146a <main+0x28a>
mov    0x8(%rsp),%rcx
jmp    1381 <main+0x1a1>
mov    %ecx,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
je     139a <main+0x1ba>
add    $0x2,%rbx
cmp    %rbp,%rbx
jae    146a <main+0x28a>
mov    %rcx,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1369 <main+0x189>
mov    %rcx,%rax
xor    %edx,%edx
div    %rbx
test   %rdx,%rdx
jne    1374 <main+0x194>
mov    $0x1,%al
jmp    146c <main+0x28c>
mov    $0x5,%esi
mov    0x8(%rsp),%rcx
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rsi),%rdi
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     13d0 <main+0x1f0>
mov    %rcx,%rax
xor    %edx,%edx
div    %rdi
jmp    13d6 <main+0x1f6>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
sete   %bpl
je     13eb <main+0x20b>
lea    0x2(%rsi),%rax
cmp    %rbx,%rsi
mov    %rax,%rsi
jbe    13b0 <main+0x1d0>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <waitpid@plt>
test   %eax,%eax
js     14ac <main+0x2cc>
mov    0x10(%rsp),%edi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    (%rsp),%eax
shl    $0x18,%eax
movsbl 0x1(%rsp),%ecx
shl    $0x10,%ecx
add    %eax,%ecx
movsbl 0x2(%rsp),%eax
shl    $0x8,%eax
add    %ecx,%eax
lea    0xcad(%rip),%rcx
lea    0xca7(%rip),%rdi
test   %bpl,%bpl
cmovne %rcx,%rdi
movsbl 0x3(%rsp),%edx
add    %eax,%edx
cmovne %rcx,%rdi
call   1030 <puts@plt>
mov    %r12,%rsp
mov    0x2b6f(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
movw   $0x0,(%rsp)
movb   $0x0,0x2(%rsp)
mov    %al,0x3(%rsp)
mov    0x14(%rsp),%edi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1040 <write@plt>
cmp    $0x4,%eax
je     144f <main+0x26f>
lea    0xc32(%rip),%rdi
jmp    14b3 <main+0x2d3>
lea    0xbd1(%rip),%rdi
jmp    14b3 <main+0x2d3>
lea    0xbe9(%rip),%rdi
jmp    14b3 <main+0x2d3>
lea    0xbf3(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b19(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Bitte gibt eine zu pruefende Zahl ein: \00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [56 x i8] c"Fehler bei der Eingabe. Bitte versuche es noch einmal: \00"
@EOF = global i32 0
@.str.3 = [13 x i8] c"%llu ist... \00"
@stdout = global i32 0
@.str.4 = [17 x i8] c"keine Primzahl.\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.5 = [16 x i8] c"eine Primzahl.\0A\00"
@.str.6 = [33 x i8] c"Fehler beim Einrichten der Pipe.\00"
@EXIT_FAILURE = global i32 0
@.str.7 = [19 x i8] c"Fehler bei fork().\00"
@.str.8 = [36 x i8] c"Fehler beim Warten auf Kindprozess.\00"
@.str.9 = [20 x i8] c"Fehler bei write().\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [2 x i32]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %7
store i32 1, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 4, i32* %11
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %12
%18 = alloca i8, i64 4
store i32 0, i32* %14
store i64 0, i64* %6
store i64 0, i64* %5
store i64 0, i64* %4
store i64 0, i64* %3
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
store i32 0, i32* %19
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
store i32 0, i32* %20
%21 = getelementptr inbounds i8, i8* %18, i64 3
store i8 120, i8* %21
%22 = getelementptr inbounds i8, i8* %18, i64 2
store i8 120, i8* %22
%23 = getelementptr inbounds i8, i8* %18, i64 1
store i8 120, i8* %23
%24 = getelementptr inbounds i8, i8* %18, i64 0
store i8 120, i8* %24
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %43, %0
%27 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%28 = icmp sle i64 %27, 0
br i1 %28, label %29, label %44
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 (...) @getchar()
store i32 %31, i32* %15
br label %32
32: ; preds = %41, %29
%33 = load i32, i32* %15
%34 = icmp ne i32 %33, 10
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load i32, i32* %15
%37 = load i32, i32* @EOF
%38 = icmp ne i32 %36, %37
br label %39
39: ; preds = %35, %32
%40 = phi i1 [ false, %32 ], [ %38, %35 ]
br i1 %40, label %41, label %43
41: ; preds = %39
%42 = call i32 (...) @getchar()
store i32 %42, i32* %15
br label %32
43: ; preds = %39
br label %26
44: ; preds = %26
%45 = load i64, i64* %2
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i64 %45)
%47 = load i32, i32* @stdout
%48 = call i32 @fflush(i32 %47)
%49 = load i64, i64* %2
%50 = icmp eq i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %44
%52 = load i64, i64* %2
%53 = icmp eq i64 %52, 1
br i1 %53, label %54, label %57
54: ; preds = %51, %44
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%56 = load i32, i32* @EXIT_SUCCESS
store i32 %56, i32* %1
store i32 1, i32* %16
br label %222
57: ; preds = %51
%58 = load i64, i64* %2
%59 = icmp eq i64 %58, 2
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load i64, i64* %2
%62 = icmp eq i64 %61, 3
br i1 %62, label %63, label %66
63: ; preds = %60, %57
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%65 = load i32, i32* @EXIT_SUCCESS
store i32 %65, i32* %1
store i32 1, i32* %16
br label %222
66: ; preds = %60
br label %67
67: ; preds = %66
%68 = load i64, i64* %2
%69 = urem i64 %68, 2
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%73 = load i32, i32* @EXIT_SUCCESS
store i32 %73, i32* %1
store i32 1, i32* %16
br label %222
74: ; preds = %67
store i64 3, i64* %3
%75 = load i64, i64* %2
%76 = call i32 @sqrt(i64 %75)
%77 = sdiv i32 %76, 2
%78 = sext i32 %77 to i64
store i64 %78, i64* %5
%79 = load i64, i64* %5
%80 = add i64 %79, 1
store i64 %80, i64* %4
%81 = load i64, i64* %2
%82 = call i32 @sqrt(i64 %81)
%83 = add nsw i32 %82, 1
%84 = sext i32 %83 to i64
store i64 %84, i64* %6
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%86 = call i32 @pipe(i32* %85)
store i32 %86, i32* %10
%87 = load i32, i32* %10
%88 = icmp slt i32 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %74
%90 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%91 = load i32, i32* @EXIT_FAILURE
%92 = call i32 @exit(i32 %91)
unreachable
93: ; preds = %74
%94 = call i32 (...) @fork()
store i32 %94, i32* %10
store i32 %94, i32* %14
%95 = load i32, i32* %10
%96 = icmp slt i32 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%99 = load i32, i32* @EXIT_FAILURE
%100 = call i32 @exit(i32 %99)
unreachable
101: ; preds = %93
%102 = load i32, i32* %14
%103 = icmp sgt i32 %102, 0
br i1 %103, label %104, label %164
104: ; preds = %101
%105 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
%106 = load i32, i32* %105
%107 = call i32 @close(i32 %106)
%108 = load i64, i64* %3
store i64 %108, i64* %7
br label %109
109: ; preds = %120, %104
%110 = load i64, i64* %7
%111 = load i64, i64* %5
%112 = icmp ule i64 %110, %111
br i1 %112, label %113, label %123
113: ; preds = %109
%114 = load i64, i64* %2
%115 = load i64, i64* %7
%116 = urem i64 %114, %115
%117 = icmp eq i64 %116, 0
br i1 %117, label %118, label %119
118: ; preds = %113
store i32 0, i32* %8
br label %123
119: ; preds = %113
br label %120
120: ; preds = %119
%121 = load i64, i64* %7
%122 = add i64 %121, 2
store i64 %122, i64* %7
br label %109
123: ; preds = %118, %109
%124 = load i32, i32* %14
%125 = call i32 @waitpid(i32 %124, i32* null, i32 0)
store i32 %125, i32* %10
%126 = load i32, i32* %10
%127 = icmp slt i32 %126, 0
br i1 %127, label %128, label %132
128: ; preds = %123
%129 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%130 = load i32, i32* @EXIT_FAILURE
%131 = call i32 @exit(i32 %130)
unreachable
132: ; preds = %123
%133 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%134 = load i32, i32* %133
%135 = call i32 @read(i32 %134, i8* %18, i32 4)
%136 = getelementptr inbounds i8, i8* %18, i64 0
%137 = load i8, i8* %136
%138 = sext i8 %137 to i32
%139 = shl i32 %138, 24
%140 = getelementptr inbounds i8, i8* %18, i64 1
%141 = load i8, i8* %140
%142 = sext i8 %141 to i32
%143 = shl i32 %142, 16
%144 = add nsw i32 %139, %143
%145 = getelementptr inbounds i8, i8* %18, i64 2
%146 = load i8, i8* %145
%147 = sext i8 %146 to i32
%148 = shl i32 %147, 8
%149 = add nsw i32 %144, %148
%150 = getelementptr inbounds i8, i8* %18, i64 3
%151 = load i8, i8* %150
%152 = sext i8 %151 to i32
%153 = add nsw i32 %149, %152
%154 = icmp ne i32 %153, 0
br i1 %154, label %155, label %156
155: ; preds = %132
store i32 0, i32* %8
br label %156
156: ; preds = %155, %132
%157 = load i32, i32* %8
%158 = icmp ne i32 %157, 0
br i1 %158, label %159, label %161
159: ; preds = %156
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %163
161: ; preds = %156
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %163
163: ; preds = %161, %159
br label %220
164: ; preds = %101
%165 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%166 = load i32, i32* %165
%167 = call i32 @close(i32 %166)
%168 = load i64, i64* %4
%169 = urem i64 %168, 2
%170 = icmp eq i64 %169, 0
br i1 %170, label %171, label %174
171: ; preds = %164
%172 = load i64, i64* %4
%173 = add i64 %172, 1
store i64 %173, i64* %4
br label %174
174: ; preds = %171, %164
%175 = load i64, i64* %4
store i64 %175, i64* %7
br label %176
176: ; preds = %187, %174
%177 = load i64, i64* %7
%178 = load i64, i64* %6
%179 = icmp ult i64 %177, %178
br i1 %179, label %180, label %190
180: ; preds = %176
%181 = load i64, i64* %2
%182 = load i64, i64* %7
%183 = urem i64 %181, %182
%184 = icmp eq i64 %183, 0
br i1 %184, label %185, label %186
185: ; preds = %180
store i32 1, i32* %9
br label %190
186: ; preds = %180
br label %187
187: ; preds = %186
%188 = load i64, i64* %7
%189 = add i64 %188, 2
store i64 %189, i64* %7
br label %176
190: ; preds = %185, %176
%191 = load i32, i32* %9
%192 = ashr i32 %191, 24
%193 = and i32 %192, 255
%194 = trunc i32 %193 to i8
%195 = getelementptr inbounds i8, i8* %18, i64 0
store i8 %194, i8* %195
%196 = load i32, i32* %9
%197 = ashr i32 %196, 16
%198 = and i32 %197, 255
%199 = trunc i32 %198 to i8
%200 = getelementptr inbounds i8, i8* %18, i64 1
store i8 %199, i8* %200
%201 = load i32, i32* %9
%202 = ashr i32 %201, 8
%203 = and i32 %202, 255
%204 = trunc i32 %203 to i8
%205 = getelementptr inbounds i8, i8* %18, i64 2
store i8 %204, i8* %205
%206 = load i32, i32* %9
%207 = and i32 %206, 255
%208 = trunc i32 %207 to i8
%209 = getelementptr inbounds i8, i8* %18, i64 3
store i8 %208, i8* %209
%210 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
%211 = load i32, i32* %210
%212 = call i32 @write(i32 %211, i8* %18, i32 4)
store i32 %212, i32* %10
%213 = load i32, i32* %10
%214 = icmp ne i32 %213, 4
br i1 %214, label %215, label %219
215: ; preds = %190
%216 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%217 = load i32, i32* @EXIT_FAILURE
%218 = call i32 @exit(i32 %217)
unreachable
219: ; preds = %190
br label %220
220: ; preds = %219, %163
%221 = load i32, i32* @EXIT_SUCCESS
store i32 %221, i32* %1
store i32 1, i32* %16
br label %222
222: ; preds = %220, %71, %63, %54
%223 = load i8*, i8** %12
%224 = load i32, i32* %1
ret i32 %224
}

LLVM IR (-O2):
@.str = [40 x i8] c"Bitte gibt eine zu pruefende Zahl ein: \00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [56 x i8] c"Fehler bei der Eingabe. Bitte versuche es noch einmal: \00"
@EOF = global i32 0
@.str.3 = [13 x i8] c"%llu ist... \00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
@.str.6 = [33 x i8] c"Fehler beim Einrichten der Pipe.\00"
@EXIT_FAILURE = global i32 0
@.str.7 = [19 x i8] c"Fehler bei fork().\00"
@.str.8 = [36 x i8] c"Fehler beim Warten auf Kindprozess.\00"
@.str.9 = [20 x i8] c"Fehler bei write().\00"
@str.12 = [15 x i8] c"eine Primzahl.\00"
@str.13 = [16 x i8] c"keine Primzahl.\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [2 x i32]
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = tail call i8* @llvm.stacksave()
%5 = alloca i32
%6 = bitcast i32* %5 to [4 x i8]*
%7 = bitcast i32* %5 to i8*
%8 = bitcast [2 x i32]* %2 to i8*
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store i32 0, i32* %9
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 0, i32* %10
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 3
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 2
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 1
store i32 2021161080, i32* %5
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%15 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%16 = icmp slt i64 %15, 1
br i1 %16, label %20, label %33
17: ; preds = %27, %20
%18 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%19 = icmp slt i64 %18, 1
br i1 %19, label %20, label %33
20: ; preds = %0, %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (...) @getchar()
%23 = icmp ne i32 %22, 10
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %22, %24
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %27, label %17
27: ; preds = %20, %27
%28 = call i32 (...) @getchar()
%29 = icmp ne i32 %28, 10
%30 = load i32, i32* @EOF
%31 = icmp ne i32 %28, %30
%32 = select i1 %29, i1 %31, i1 false
br i1 %32, label %27, label %17
33: ; preds = %17, %0
%34 = load i64, i64* %1
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i64 %34)
%36 = load i32, i32* @stdout
%37 = call i32 @fflush(i32 %36)
%38 = load i64, i64* %1
%39 = icmp ult i64 %38, 2
br i1 %39, label %137, label %40
40: ; preds = %33
%41 = and i64 %38, -2
%42 = icmp eq i64 %41, 2
br i1 %42, label %137, label %43
43: ; preds = %40
%44 = and i64 %38, 1
%45 = icmp eq i64 %44, 0
br i1 %45, label %137, label %46
46: ; preds = %43
%47 = call i32 @sqrt(i64 %38)
%48 = sdiv i32 %47, 2
%49 = sext i32 %48 to i64
%50 = add nsw i64 %49, 1
%51 = load i64, i64* %1
%52 = call i32 @sqrt(i64 %51)
%53 = add nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = call i32 @pipe(i32* %10)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %46
%58 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%59 = load i32, i32* @EXIT_FAILURE
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %46
%62 = call i32 (...) @fork()
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %61
%65 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %61
%69 = icmp eq i32 %62, 0
br i1 %69, label %111, label %70
70: ; preds = %68
%71 = load i32, i32* %9
%72 = call i32 @close(i32 %71)
%73 = icmp ult i32 %48, 3
br i1 %73, label %83, label %74
74: ; preds = %70
%75 = load i64, i64* %1
br label %76
76: ; preds = %76, %74
%77 = phi i64 [ 3, %74 ], [ %80, %76 ]
%78 = urem i64 %75, %77
%79 = icmp eq i64 %78, 0
%80 = add i64 %77, 2
%81 = icmp ugt i64 %80, %49
%82 = select i1 %79, i1 true, i1 %81
br i1 %82, label %83, label %76
83: ; preds = %76, %70
%84 = phi i1 [ false, %70 ], [ %79, %76 ]
%85 = call i32 @waitpid(i32 %62, i32* null, i32 0)
%86 = icmp slt i32 %85, 0
br i1 %86, label %87, label %91
87: ; preds = %83
%88 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%89 = load i32, i32* @EXIT_FAILURE
%90 = call i32 @exit(i32 %89)
unreachable
91: ; preds = %83
%92 = load i32, i32* %10
%93 = call i32 @read(i32 %92, i8* %7, i32 4)
%94 = load i8, i8* %7
%95 = zext i8 %94 to i32
%96 = shl nuw i32 %95, 24
%97 = load i8, i8* %13
%98 = sext i8 %97 to i32
%99 = shl nsw i32 %98, 16
%100 = add nsw i32 %99, %96
%101 = load i8, i8* %12
%102 = sext i8 %101 to i32
%103 = shl nsw i32 %102, 8
%104 = add nsw i32 %100, %103
%105 = load i8, i8* %11
%106 = sext i8 %105 to i32
%107 = sub nsw i32 0, %106
%108 = icmp ne i32 %104, %107
%109 = or i1 %108, %84
%110 = select i1 %109, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0)
br label %137
111: ; preds = %68
%112 = load i32, i32* %10
%113 = call i32 @close(i32 %112)
%114 = and i64 %50, 1
%115 = icmp eq i64 %114, 0
%116 = add nsw i64 %49, 2
%117 = select i1 %115, i64 %116, i64 %50
%118 = icmp ult i64 %117, %54
br i1 %118, label %119, label %128
119: ; preds = %111
%120 = load i64, i64* %1
br label %123
121: ; preds = %123
%122 = icmp ult i64 %127, %54
br i1 %122, label %123, label %128
123: ; preds = %119, %121
%124 = phi i64 [ %117, %119 ], [ %127, %121 ]
%125 = urem i64 %120, %124
%126 = icmp eq i64 %125, 0
%127 = add i64 %124, 2
br i1 %126, label %128, label %121
128: ; preds = %121, %123, %111
%129 = phi i8 [ 0, %111 ], [ 1, %123 ], [ 0, %121 ]
store i8 0, i8* %7
store i8 0, i8* %13
store i8 0, i8* %12
store i8 %129, i8* %11
%130 = load i32, i32* %9
%131 = call i32 @write(i32 %130, i8* %7, i32 4)
%132 = icmp eq i32 %131, 4
br i1 %132, label %140, label %133
133: ; preds = %128
%134 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%135 = load i32, i32* @EXIT_FAILURE
%136 = call i32 @exit(i32 %135)
unreachable
137: ; preds = %91, %43, %40, %33
%138 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0), %33 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0), %40 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0), %43 ], [ %110, %91 ]
%139 = call i32 @puts(i8* dereferenceable(1) %138)
br label %140
140: ; preds = %137, %128
%141 = load i32, i32* @EXIT_SUCCESS
ret i32 %141
}