#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int fd;
};
struct epoll_event {
  TYPE_1__ data;
  int /*<<< orphan*/ events;
};

/* Variables and functions */
int /*<<< orphan*/ EPOLLIN;
int /*<<< orphan*/ EPOLL_CTL_ADD;
int /*<<< orphan*/ attach_bpf(int);
int /*<<< orphan*/ build_rcv_group(int *, int, int, int);
int /*<<< orphan*/ close(int);
int epoll_create(int);
scalar_t__ epoll_ctl(int, int /*<<< orphan*/, int, struct epoll_event *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ receive_on_cpu(int *, int, int, int, int);
int /*<<< orphan*/ send_from_cpu(int, int, int);
void test(int *rcv_fd, int len, int family, int proto) {
  struct epoll_event ev;
  int epfd, cpu;
  build_rcv_group(rcv_fd, len, family, proto);
  attach_bpf(rcv_fd[0]);
  epfd = epoll_create(1);
  if (epfd < 0)
    error(1, errno, "failed to create epoll");
  for (cpu = 0; cpu < len; ++cpu) {
    ev.events = EPOLLIN;
    ev.data.fd = rcv_fd[cpu];
    if (epoll_ctl(epfd, EPOLL_CTL_ADD, rcv_fd[cpu], &ev))
      error(1, errno, "failed to register sock epoll");
  }
  for (cpu = 0; cpu < len; ++cpu) {
    send_from_cpu(cpu, family, proto);
    receive_on_cpu(rcv_fd, len, epfd, cpu, proto);
  }
  for (cpu = len - 1; cpu >= 0; --cpu) {
    send_from_cpu(cpu, family, proto);
    receive_on_cpu(rcv_fd, len, epfd, cpu, proto);
  }
  for (cpu = 0; cpu < len; cpu += 2) {
    send_from_cpu(cpu, family, proto);
    receive_on_cpu(rcv_fd, len, epfd, cpu, proto);
  }
  for (cpu = 1; cpu < len; cpu += 2) {
    send_from_cpu(cpu, family, proto);
    receive_on_cpu(rcv_fd, len, epfd, cpu, proto);
  }
  close(epfd);
  for (cpu = 0; cpu < len; ++cpu)
    close(rcv_fd[cpu]);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <build_rcv_group@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <attach_bpf@plt>
mov    $0x1,%edi
call   10a0 <epoll_create@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    11e3 <test+0x63>
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    0xe22(%rip),%rdx
call   1090 <error@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1267 <test+0xe7>
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    -0x20(%rbp),%rcx
call   1070 <epoll_ctl@plt>
cmp    $0x0,%rax
je     1254 <test+0xd4>
mov    0x2d8f(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    0xdc8(%rip),%rdx
call   1090 <error@plt>
jmp    1259 <test+0xd9>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ea <test+0x6a>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12ac <test+0x12c>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <send_from_cpu@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1080 <receive_on_cpu@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    126e <test+0xee>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     12f1 <test+0x171>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <send_from_cpu@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1080 <receive_on_cpu@plt>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    12b5 <test+0x135>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1336 <test+0x1b6>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <send_from_cpu@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1080 <receive_on_cpu@plt>
mov    -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
jmp    12f8 <test+0x178>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    137b <test+0x1fb>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <send_from_cpu@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1080 <receive_on_cpu@plt>
mov    -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
jmp    133d <test+0x1bd>
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13b4 <test+0x234>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <close@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    138a <test+0x20a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r13d
mov    %edx,%ebx
mov    %esi,%r12d
mov    %rdi,%r14
call   1040 <build_rcv_group@plt>
mov    (%r14),%edi
call   1030 <attach_bpf@plt>
mov    $0x1,%edi
call   10a0 <epoll_create@plt>
mov    %eax,%r15d
test   %eax,%eax
js     11c1 <test+0x41>
test   %r12d,%r12d
jg     11e4 <test+0x64>
jmp    1384 <test+0x204>
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
lea    0xe2f(%rip),%rdx
mov    $0x1,%edi
call   1090 <error@plt>
test   %r12d,%r12d
jle    1384 <test+0x204>
mov    %ebx,0x4(%rsp)
mov    %r12d,%eax
mov    %rax,0x8(%rsp)
xor    %ebx,%ebx
lea    0x10(%rsp),%rbp
jmp    120b <test+0x8b>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,0x8(%rsp)
je     1255 <test+0xd5>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    (%r14,%rbx,4),%edx
mov    %edx,0x10(%rsp)
mov    0x2db9(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    %rbp,%rcx
call   1070 <epoll_ctl@plt>
test   %rax,%rax
je     1200 <test+0x80>
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    0xdc9(%rip),%rdx
call   1090 <error@plt>
jmp    1200 <test+0x80>
test   %r12d,%r12d
mov    0x4(%rsp),%ebp
jle    1384 <test+0x204>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r13d,%edx
call   1050 <send_from_cpu@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r13d,%r8d
call   1080 <receive_on_cpu@plt>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    1270 <test+0xf0>
test   %r12d,%r12d
jle    1384 <test+0x204>
lea    0x1(%r12),%ebp
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x2(%rbp),%ebx
mov    %ebx,%edi
mov    0x4(%rsp),%esi
mov    %r13d,%edx
call   1050 <send_from_cpu@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r13d,%r8d
call   1080 <receive_on_cpu@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     12b0 <test+0x130>
test   %r12d,%r12d
mov    0x4(%rsp),%ebp
jle    1384 <test+0x204>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r13d,%edx
call   1050 <send_from_cpu@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r13d,%r8d
call   1080 <receive_on_cpu@plt>
add    $0x2,%ebx
cmp    %r12d,%ebx
jl     12f0 <test+0x170>
cmp    $0x2,%r12d
jl     1357 <test+0x1d7>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r13d,%edx
call   1050 <send_from_cpu@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r13d,%r8d
call   1080 <receive_on_cpu@plt>
add    $0x2,%ebx
cmp    %r12d,%ebx
jl     1330 <test+0x1b0>
mov    %r15d,%edi
call   1060 <close@plt>
test   %r12d,%r12d
mov    0x8(%rsp),%rbp
jle    138c <test+0x20c>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
call   1060 <close@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1370 <test+0x1f0>
jmp    138c <test+0x20c>
mov    %r15d,%edi
call   1060 <close@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.epoll_event = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@errno = global i32 0
@.str = [23 x i8] c"failed to create epoll\00"
@EPOLLIN = global i32 0
@EPOLL_CTL_ADD = global i32 0
@.str.1 = [30 x i8] c"failed to register sock epoll\00"
define void @test(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.epoll_event
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32*, i32** %5
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 @build_rcv_group(i32* %12, i32 %13, i32 %14, i32 %15)
%17 = load i32*, i32** %5
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = call i32 @attach_bpf(i32 %19)
%21 = call i32 @epoll_create(i32 1)
store i32 %21, i32* %10
%22 = load i32, i32* %10
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %4
%25 = load i32, i32* @errno
%26 = call i32 @error(i32 1, i32 %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %24, %4
store i32 0, i32* %11
br label %28
28: ; preds = %55, %27
%29 = load i32, i32* %11
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %58
32: ; preds = %28
%33 = load i32, i32* @EPOLLIN
%34 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %9, i32 0, i32 1
store i32 %33, i32* %34
%35 = load i32*, i32** %5
%36 = load i32, i32* %11
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = load i32, i32* %38
%40 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %9, i32 0, i32 0
%41 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %40, i32 0, i32 0
store i32 %39, i32* %41
%42 = load i32, i32* %10
%43 = load i32, i32* @EPOLL_CTL_ADD
%44 = load i32*, i32** %5
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
%49 = call i64 @epoll_ctl(i32 %42, i32 %43, i32 %48, %struct.epoll_event* %9)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %32
%52 = load i32, i32* @errno
%53 = call i32 @error(i32 1, i32 %52, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %54
54: ; preds = %51, %32
br label %55
55: ; preds = %54
%56 = load i32, i32* %11
%57 = add nsw i32 %56, 1
store i32 %57, i32* %11
br label %28
58: ; preds = %28
store i32 0, i32* %11
br label %59
59: ; preds = %74, %58
%60 = load i32, i32* %11
%61 = load i32, i32* %6
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %77
63: ; preds = %59
%64 = load i32, i32* %11
%65 = load i32, i32* %7
%66 = load i32, i32* %8
%67 = call i32 @send_from_cpu(i32 %64, i32 %65, i32 %66)
%68 = load i32*, i32** %5
%69 = load i32, i32* %6
%70 = load i32, i32* %10
%71 = load i32, i32* %11
%72 = load i32, i32* %8
%73 = call i32 @receive_on_cpu(i32* %68, i32 %69, i32 %70, i32 %71, i32 %72)
br label %74
74: ; preds = %63
%75 = load i32, i32* %11
%76 = add nsw i32 %75, 1
store i32 %76, i32* %11
br label %59
77: ; preds = %59
%78 = load i32, i32* %6
%79 = sub nsw i32 %78, 1
store i32 %79, i32* %11
br label %80
80: ; preds = %94, %77
%81 = load i32, i32* %11
%82 = icmp sge i32 %81, 0
br i1 %82, label %83, label %97
83: ; preds = %80
%84 = load i32, i32* %11
%85 = load i32, i32* %7
%86 = load i32, i32* %8
%87 = call i32 @send_from_cpu(i32 %84, i32 %85, i32 %86)
%88 = load i32*, i32** %5
%89 = load i32, i32* %6
%90 = load i32, i32* %10
%91 = load i32, i32* %11
%92 = load i32, i32* %8
%93 = call i32 @receive_on_cpu(i32* %88, i32 %89, i32 %90, i32 %91, i32 %92)
br label %94
94: ; preds = %83
%95 = load i32, i32* %11
%96 = add nsw i32 %95, -1
store i32 %96, i32* %11
br label %80
97: ; preds = %80
store i32 0, i32* %11
br label %98
98: ; preds = %113, %97
%99 = load i32, i32* %11
%100 = load i32, i32* %6
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %116
102: ; preds = %98
%103 = load i32, i32* %11
%104 = load i32, i32* %7
%105 = load i32, i32* %8
%106 = call i32 @send_from_cpu(i32 %103, i32 %104, i32 %105)
%107 = load i32*, i32** %5
%108 = load i32, i32* %6
%109 = load i32, i32* %10
%110 = load i32, i32* %11
%111 = load i32, i32* %8
%112 = call i32 @receive_on_cpu(i32* %107, i32 %108, i32 %109, i32 %110, i32 %111)
br label %113
113: ; preds = %102
%114 = load i32, i32* %11
%115 = add nsw i32 %114, 2
store i32 %115, i32* %11
br label %98
116: ; preds = %98
store i32 1, i32* %11
br label %117
117: ; preds = %132, %116
%118 = load i32, i32* %11
%119 = load i32, i32* %6
%120 = icmp slt i32 %118, %119
br i1 %120, label %121, label %135
121: ; preds = %117
%122 = load i32, i32* %11
%123 = load i32, i32* %7
%124 = load i32, i32* %8
%125 = call i32 @send_from_cpu(i32 %122, i32 %123, i32 %124)
%126 = load i32*, i32** %5
%127 = load i32, i32* %6
%128 = load i32, i32* %10
%129 = load i32, i32* %11
%130 = load i32, i32* %8
%131 = call i32 @receive_on_cpu(i32* %126, i32 %127, i32 %128, i32 %129, i32 %130)
br label %132
132: ; preds = %121
%133 = load i32, i32* %11
%134 = add nsw i32 %133, 2
store i32 %134, i32* %11
br label %117
135: ; preds = %117
%136 = load i32, i32* %10
%137 = call i32 @close(i32 %136)
store i32 0, i32* %11
br label %138
138: ; preds = %149, %135
%139 = load i32, i32* %11
%140 = load i32, i32* %6
%141 = icmp slt i32 %139, %140
br i1 %141, label %142, label %152
142: ; preds = %138
%143 = load i32*, i32** %5
%144 = load i32, i32* %11
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %143, i64 %145
%147 = load i32, i32* %146
%148 = call i32 @close(i32 %147)
br label %149
149: ; preds = %142
%150 = load i32, i32* %11
%151 = add nsw i32 %150, 1
store i32 %151, i32* %11
br label %138
152: ; preds = %138
ret void
}

LLVM IR (-O2):
%struct.epoll_event = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@errno = global i32 0
@.str = [23 x i8] c"failed to create epoll\00"
@EPOLLIN = global i32 0
@EPOLL_CTL_ADD = global i32 0
@.str.1 = [30 x i8] c"failed to register sock epoll\00"
define void @test(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.epoll_event
%6 = bitcast %struct.epoll_event* %5 to i8*
%7 = tail call i32 @build_rcv_group(i32* %0, i32 %1, i32 %2, i32 %3)
%8 = load i32, i32* %0
%9 = tail call i32 @attach_bpf(i32 %8)
%10 = tail call i32 @epoll_create(i32 1)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* @errno
%14 = tail call i32 @error(i32 1, i32 %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %12, %4
%16 = icmp sgt i32 %1, 0
br i1 %16, label %17, label %50
17: ; preds = %15
%18 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %5, i64 0, i32 1
%19 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %5, i64 0, i32 0, i32 0
%20 = zext i32 %1 to i64
br label %22
21: ; preds = %33
br i1 %16, label %37, label %50
22: ; preds = %17, %33
%23 = phi i64 [ 0, %17 ], [ %34, %33 ]
%24 = load i32, i32* @EPOLLIN
store i32 %24, i32* %18
%25 = getelementptr inbounds i32, i32* %0, i64 %23
%26 = load i32, i32* %25
store i32 %26, i32* %19
%27 = load i32, i32* @EPOLL_CTL_ADD
%28 = call i64 @epoll_ctl(i32 %10, i32 %27, i32 %26, %struct.epoll_event* %5)
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %22
%31 = load i32, i32* @errno
%32 = call i32 @error(i32 1, i32 %31, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %22, %30
%34 = add nuw nsw i64 %23, 1
%35 = icmp eq i64 %34, %20
br i1 %35, label %21, label %22
36: ; preds = %37
br i1 %16, label %44, label %50
37: ; preds = %21, %37
%38 = phi i32 [ %41, %37 ], [ 0, %21 ]
%39 = call i32 @send_from_cpu(i32 %38, i32 %2, i32 %3)
%40 = call i32 @receive_on_cpu(i32* %0, i32 %1, i32 %10, i32 %38, i32 %3)
%41 = add nuw nsw i32 %38, 1
%42 = icmp eq i32 %41, %1
br i1 %42, label %36, label %37
43: ; preds = %44
br i1 %16, label %54, label %50
44: ; preds = %36, %44
%45 = phi i32 [ %46, %44 ], [ %1, %36 ]
%46 = add nsw i32 %45, -1
%47 = call i32 @send_from_cpu(i32 %46, i32 %2, i32 %3)
%48 = call i32 @receive_on_cpu(i32* %0, i32 %1, i32 %10, i32 %46, i32 %3)
%49 = icmp ugt i32 %45, 1
br i1 %49, label %44, label %43
50: ; preds = %15, %21, %36, %43
%51 = call i32 @close(i32 %10)
br label %77
52: ; preds = %54
%53 = icmp sgt i32 %1, 1
br i1 %53, label %60, label %66
54: ; preds = %43, %54
%55 = phi i32 [ %58, %54 ], [ 0, %43 ]
%56 = call i32 @send_from_cpu(i32 %55, i32 %2, i32 %3)
%57 = call i32 @receive_on_cpu(i32* %0, i32 %1, i32 %10, i32 %55, i32 %3)
%58 = add nuw nsw i32 %55, 2
%59 = icmp slt i32 %58, %1
br i1 %59, label %54, label %52
60: ; preds = %52, %60
%61 = phi i32 [ %64, %60 ], [ 1, %52 ]
%62 = call i32 @send_from_cpu(i32 %61, i32 %2, i32 %3)
%63 = call i32 @receive_on_cpu(i32* %0, i32 %1, i32 %10, i32 %61, i32 %3)
%64 = add nuw nsw i32 %61, 2
%65 = icmp slt i32 %64, %1
br i1 %65, label %60, label %66
66: ; preds = %60, %52
%67 = call i32 @close(i32 %10)
br i1 %16, label %68, label %77
68: ; preds = %66
%69 = zext i32 %1 to i64
br label %70
70: ; preds = %68, %70
%71 = phi i64 [ 0, %68 ], [ %75, %70 ]
%72 = getelementptr inbounds i32, i32* %0, i64 %71
%73 = load i32, i32* %72
%74 = call i32 @close(i32 %73)
%75 = add nuw nsw i64 %71, 1
%76 = icmp eq i64 %75, %69
br i1 %76, label %77, label %70
77: ; preds = %70, %50, %66
ret void
}