#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*/ close(int);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ perror(char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ write(int, ...);
int main() {
  int p_pipe[2];
  int c_pipe[2];
  if (pipe(p_pipe) == -1) {
    perror("pipe(p_pipe)");
    exit(1);
  }
  if (pipe(c_pipe) == -1) {
    perror("pipe(c_pipe)");
    exit(1);
  }
  int frk = fork();
  if (frk < 0) {
    perror("fork()");
    exit(1);
  }
  if (frk != 0) {
    close(p_pipe[0]);
    close(c_pipe[1]);
    int num = 0;
    while (num != -1) {
      printf("(par) Give num (-1 to stop) > ");
      scanf("%d", &num);
      write(p_pipe[1], &num, sizeof(int));
    }
    int sum;
    double avg;
    read(c_pipe[0], &sum, sizeof(int));
    printf("(par) sum = %d\n", sum);
    read(c_pipe[0], &avg, sizeof(double));
    printf("(par) avg = %f\n", avg);
  } else {
    close(c_pipe[0]);
    close(p_pipe[1]);
    int n = 0;
    int sum = 0;
    int num = 0;
    while (num != -1) {
      read(p_pipe[0], &num, sizeof(int));
      if (num != -1) {
        n++;
        sum += num;
      }
    }
    printf("(sub) Sum = %d\n", sum);
    write(c_pipe[1], &sum, sizeof(int));
    double avg;
    if (n == 0) {
      avg = 0;
    } else {
      avg = sum / (double)n;
    }
    printf("(sub) avg = %f\n", avg);
    write(c_pipe[1], &avg, sizeof(double));
    printf("(sub) exit\n");
    exit(3);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1060 <pipe@plt>
cmp    $0xffffffff,%eax
jne    11c7 <main+0x37>
lea    0xe48(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    -0x14(%rbp),%rdi
call   1060 <pipe@plt>
cmp    $0xffffffff,%eax
jne    11ef <main+0x5f>
lea    0xe2d(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1219 <main+0x89>
lea    0xe10(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x18(%rbp)
je     12c9 <main+0x139>
mov    -0xc(%rbp),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     127a <main+0xea>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xde7(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
jmp    123a <main+0xaa>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1070 <read@plt>
mov    -0x20(%rbp),%esi
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1070 <read@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xd96(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    13b8 <main+0x228>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
je     132c <main+0x19c>
mov    -0xc(%rbp),%edi
lea    -0x34(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1070 <read@plt>
cmpl   $0xffffffff,-0x34(%rbp)
je     1327 <main+0x197>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x34(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    12ee <main+0x15e>
mov    -0x30(%rbp),%esi
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    1367 <main+0x1d7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    137a <main+0x1ea>
cvtsi2sdl -0x30(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xced(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <write@plt>
lea    0xcdc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x3,%edi
call   10a0 <exit@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0x18(%rsp),%rdi
call   1070 <pipe@plt>
cmp    $0xffffffff,%eax
je     12ac <main+0x10c>
lea    0x10(%rsp),%rdi
call   1070 <pipe@plt>
cmp    $0xffffffff,%eax
je     12b5 <main+0x115>
xor    %eax,%eax
call   10c0 <fork@plt>
test   %eax,%eax
js     12be <main+0x11e>
je     12d4 <main+0x134>
mov    0x18(%rsp),%edi
call   1060 <close@plt>
mov    0x14(%rsp),%edi
call   1060 <close@plt>
movl   $0x0,0xc(%rsp)
lea    0xe1b(%rip),%r14
lea    0xe33(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    0x1c(%rsp),%edi
mov    $0x4,%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <write@plt>
cmpl   $0xffffffff,0xc(%rsp)
jne    1220 <main+0x80>
mov    0x10(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1080 <read@plt>
mov    0x8(%rsp),%esi
lea    0xdd4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1080 <read@plt>
movsd  0x20(%rsp),%xmm0
lea    0xdbb(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd4d(%rip),%rdi
jmp    12c5 <main+0x125>
lea    0xd51(%rip),%rdi
jmp    12c5 <main+0x125>
lea    0xd55(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x10(%rsp),%edi
call   1060 <close@plt>
mov    0x1c(%rsp),%edi
call   1060 <close@plt>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x18(%rsp),%edi
xor    %ebx,%ebx
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1080 <read@plt>
mov    0x8(%rsp),%eax
mov    $0x0,%ebp
cmp    $0xffffffff,%eax
je     1355 <main+0x1b5>
lea    0x8(%rsp),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %eax,%ebx
add    $0x1,%ebp
mov    %ebx,0xc(%rsp)
mov    0x18(%rsp),%edi
mov    $0x4,%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <read@plt>
mov    0x8(%rsp),%eax
cmp    $0xffffffff,%eax
jne    1330 <main+0x190>
lea    0xd07(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <write@plt>
xorpd  %xmm0,%xmm0
test   %ebp,%ebp
je     1393 <main+0x1f3>
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
cvtsi2sd %ebp,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xcd3(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x14(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <write@plt>
lea    0xcc0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"pipe(p_pipe)\00"
@.str.1 = [13 x i8] c"pipe(c_pipe)\00"
@.str.2 = [7 x i8] c"fork()\00"
@.str.3 = [31 x i8] c"(par) Give num (-1 to stop) > \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [16 x i8] c"(par) sum = %d\0A\00"
@.str.6 = [16 x i8] c"(par) avg = %f\0A\00"
@.str.7 = [16 x i8] c"(sub) Sum = %d\0A\00"
@.str.8 = [16 x i8] c"(sub) avg = %f\0A\00"
@.str.9 = [12 x i8] c"(sub) exit\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
store i32 0, i32* %1
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%13 = call i32 @pipe(i32* %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%20 = call i32 @pipe(i32* %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %18
%26 = call i32 (...) @fork()
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %25
%33 = load i32, i32* %4
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %62
35: ; preds = %32
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%37 = load i32, i32* %36
%38 = call i32 @close(i32 %37)
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%40 = load i32, i32* %39
%41 = call i32 @close(i32 %40)
store i32 0, i32* %5
br label %42
42: ; preds = %45, %35
%43 = load i32, i32* %5
%44 = icmp ne i32 %43, -1
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%49 = load i32, i32* %48
%50 = call i32 (i32, ...) @write(i32 %49, i32* %5, i64 4)
br label %42
51: ; preds = %42
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%53 = load i32, i32* %52
%54 = call i32 (i32, ...) @read(i32 %53, i32* %6, i64 4)
%55 = load i32, i32* %6
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%58 = load i32, i32* %57
%59 = call i32 (i32, ...) @read(i32 %58, double* %7, i64 8)
%60 = load double, double* %7
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %60)
br label %108
62: ; preds = %32
%63 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%64 = load i32, i32* %63
%65 = call i32 @close(i32 %64)
%66 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%67 = load i32, i32* %66
%68 = call i32 @close(i32 %67)
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
br label %69
69: ; preds = %84, %62
%70 = load i32, i32* %10
%71 = icmp ne i32 %70, -1
br i1 %71, label %72, label %85
72: ; preds = %69
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%74 = load i32, i32* %73
%75 = call i32 (i32, ...) @read(i32 %74, i32* %10, i64 4)
%76 = load i32, i32* %10
%77 = icmp ne i32 %76, -1
br i1 %77, label %78, label %84
78: ; preds = %72
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
%81 = load i32, i32* %10
%82 = load i32, i32* %9
%83 = add nsw i32 %82, %81
store i32 %83, i32* %9
br label %84
84: ; preds = %78, %72
br label %69
85: ; preds = %69
%86 = load i32, i32* %9
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%89 = load i32, i32* %88
%90 = call i32 (i32, ...) @write(i32 %89, i32* %9, i64 4)
%91 = load i32, i32* %8
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %85
store double 0.000000e+00, double* %11
br label %100
94: ; preds = %85
%95 = load i32, i32* %9
%96 = sitofp i32 %95 to double
%97 = load i32, i32* %8
%98 = sitofp i32 %97 to double
%99 = fdiv double %96, %98
store double %99, double* %11
br label %100
100: ; preds = %94, %93
%101 = load double, double* %11
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), double %101)
%103 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%104 = load i32, i32* %103
%105 = call i32 (i32, ...) @write(i32 %104, double* %11, i64 8)
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%107 = call i32 @exit(i32 3)
unreachable
108: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"pipe(p_pipe)\00"
@.str.1 = [13 x i8] c"pipe(c_pipe)\00"
@.str.2 = [7 x i8] c"fork()\00"
@.str.3 = [31 x i8] c"(par) Give num (-1 to stop) > \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [16 x i8] c"(par) sum = %d\0A\00"
@.str.6 = [16 x i8] c"(par) avg = %f\0A\00"
@.str.7 = [16 x i8] c"(sub) Sum = %d\0A\00"
@.str.8 = [16 x i8] c"(sub) avg = %f\0A\00"
@str = [11 x i8] c"(sub) exit\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [2 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = bitcast [2 x i32]* %1 to i8*
%10 = bitcast [2 x i32]* %2 to i8*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%12 = call i32 @pipe(i32* %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%19 = call i32 @pipe(i32* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %17
%25 = call i32 (...) @fork()
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %24
%31 = icmp eq i32 %25, 0
br i1 %31, label %58, label %32
32: ; preds = %30
%33 = load i32, i32* %11
%34 = call i32 @close(i32 %33)
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%36 = load i32, i32* %35
%37 = call i32 @close(i32 %36)
%38 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
br label %40
40: ; preds = %32, %40
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%43 = load i32, i32* %39
%44 = call i32 (i32, ...) @write(i32 %43, i32* %3, i64 4)
%45 = load i32, i32* %3
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %40
47: ; preds = %40
%48 = bitcast i32* %4 to i8*
%49 = bitcast double* %5 to i8*
%50 = load i32, i32* %18
%51 = call i32 (i32, ...) @read(i32 %50, i32* %4, i64 4)
%52 = load i32, i32* %4
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %18
%55 = call i32 (i32, ...) @read(i32 %54, double* %5, i64 8)
%56 = load double, double* %5
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %56)
ret i32 0
58: ; preds = %30
%59 = load i32, i32* %18
%60 = call i32 @close(i32 %59)
%61 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%62 = load i32, i32* %61
%63 = call i32 @close(i32 %62)
%64 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%65 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%66 = load i32, i32* %11
%67 = call i32 (i32, ...) @read(i32 %66, i32* %7, i64 4)
%68 = load i32, i32* %7
%69 = icmp eq i32 %68, -1
br i1 %69, label %80, label %70
70: ; preds = %58, %70
%71 = phi i32 [ %78, %70 ], [ %68, %58 ]
%72 = phi i32 [ %74, %70 ], [ 0, %58 ]
%73 = phi i32 [ %75, %70 ], [ 0, %58 ]
%74 = add nuw nsw i32 %72, 1
%75 = add nsw i32 %73, %71
store i32 %75, i32* %6
%76 = load i32, i32* %11
%77 = call i32 (i32, ...) @read(i32 %76, i32* %7, i64 4)
%78 = load i32, i32* %7
%79 = icmp eq i32 %78, -1
br i1 %79, label %80, label %70
80: ; preds = %70, %58
%81 = phi i32 [ 0, %58 ], [ %75, %70 ]
%82 = phi i32 [ 0, %58 ], [ %74, %70 ]
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %81)
%84 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%85 = load i32, i32* %84
%86 = call i32 (i32, ...) @write(i32 %85, i32* %6, i64 4)
%87 = bitcast double* %8 to i8*
%88 = icmp eq i32 %82, 0
br i1 %88, label %94, label %89
89: ; preds = %80
%90 = load i32, i32* %6
%91 = sitofp i32 %90 to double
%92 = sitofp i32 %82 to double
%93 = fdiv double %91, %92
br label %94
94: ; preds = %80, %89
%95 = phi double [ %93, %89 ], [ 0.000000e+00, %80 ]
store double %95, double* %8
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), double %95)
%97 = load i32, i32* %84
%98 = call i32 (i32, ...) @write(i32 %97, double* %8, i64 8)
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%100 = call i32 @exit(i32 3)
unreachable
}