#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 uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int numa_max_node();
int numa_num_configured_cpus();
int *placement(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main(int argc, char **argv) {
  uint32_t num_cores = numa_num_configured_cpus();
  uint32_t num_nodes = numa_max_node() + 1;
  bool hyper = false;
  if (argc == 2) {
    num_cores = num_cores / 2;
    hyper = true;
  }
  FILE *f;
  char name[128];
  for (int j = 2; j < num_cores + 1; j++) {
    uint32_t *rr = placement(j, false, hyper);
    uint32_t *fill = placement(j, true, hyper);
    sprintf(name, "rank_files/rfile_fill_%d", j);
    f = fopen(name, "w+");
    for (int i = 0; i < j; i++) {
      if (i + 1 < j) {
        fprintf(f, "rank %d=localhost slot=%d \n", i, fill[i]);
        printf("%d,", fill[i]);
      } else {
        printf("%d", fill[i]);
        fprintf(f, "rank %d=localhost slot=%d \n", i, fill[i]);
      }
    }
    printf("\n");
    fprintf(f, "\n");
    fflush(f);
    fclose(f);
    sprintf(name, "rank_files/rfile_rr_%d", j);
    f = fopen(name, "w+");
    for (int i = 0; i < j; i++) {
      if (i + 1 < j) {
        fprintf(f, "rank %d=localhost slot=%d \n", i, rr[i]);
        printf("%d,", rr[i]);
      } else {
        printf("%d", rr[i]);
        fprintf(f, "rank %d=localhost slot=%d \n", i, rr[i]);
      }
    }
    printf("\n");
    fflush(f);
    fclose(f);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <numa_num_configured_cpus@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   10b0 <numa_max_node@plt>
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11e6 <main+0x56>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x2,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    14b9 <main+0x329>
mov    -0xb4(%rbp),%edi
mov    -0x1c(%rbp),%edx
xor    %esi,%esi
call   1080 <placement@plt>
mov    %rax,-0xc0(%rbp)
mov    -0xb4(%rbp),%edi
mov    -0x1c(%rbp),%edx
mov    $0x1,%esi
call   1080 <placement@plt>
mov    %rax,-0xc8(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%edx
lea    0xdb7(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    1344 <main+0x1b4>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
cmp    -0xb4(%rbp),%eax
jge    12e3 <main+0x153>
mov    -0x28(%rbp),%rdi
mov    -0xcc(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xd64(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0xc8(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    132b <main+0x19b>
mov    -0xc8(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xcc(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xcf8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1330 <main+0x1a0>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    126f <main+0xdf>
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
lea    0xcd9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fflush@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%edx
lea    0xcb2(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
lea    0xc7c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    1485 <main+0x2f5>
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
cmp    -0xb4(%rbp),%eax
jge    1424 <main+0x294>
mov    -0x28(%rbp),%rdi
mov    -0xd0(%rbp),%edx
mov    -0xc0(%rbp),%rax
movslq -0xd0(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xc23(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0xc0(%rbp),%rax
movslq -0xd0(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    146c <main+0x2dc>
mov    -0xc0(%rbp),%rax
movslq -0xd0(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xbda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xd0(%rbp),%edx
mov    -0xc0(%rbp),%rax
movslq -0xd0(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xbb7(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1471 <main+0x2e1>
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    13b0 <main+0x220>
lea    0xbaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fflush@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    11f0 <main+0x60>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1070 <numa_num_configured_cpus@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10d0 <numa_max_node@plt>
mov    %ebp,%ecx
shr    $0x1f,%ecx
add    %ebp,%ecx
sar    %ecx
movl   $0x0,0xc(%rsp)
cmp    $0x2,%ebx
sete   %al
cmovne %ebp,%ecx
mov    %rcx,0x18(%rsp)
cmp    $0x2,%ecx
jge    120b <main+0x5b>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc(%rsp),%ecx
mov    %al,%cl
mov    %ecx,0xc(%rsp)
mov    0x18(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x18(%rsp)
mov    $0x2,%r15d
lea    0x20(%rsp),%r12
lea    0xde5(%rip),%r13
jmp    1265 <main+0xb5>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1090 <fflush@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x1,%r15
cmp    0x18(%rsp),%r15
je     11f7 <main+0x47>
mov    %r15d,%edi
xor    %esi,%esi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
call   10a0 <placement@plt>
mov    %rax,0x10(%rsp)
mov    %r15d,%edi
mov    $0x1,%esi
mov    %ebx,%edx
call   10a0 <placement@plt>
mov    %rax,%r14
mov    %r12,%rdi
lea    0xd6a(%rip),%rsi
mov    %r15d,%edx
call   10c0 <sprintf@plt>
mov    %r12,%rbx
mov    %r12,%rdi
mov    %r13,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r13
xor    %ebp,%ebp
jmp    12ef <main+0x13f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xd4f(%rip),%rdi
mov    %ecx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14,%rbp,4),%ecx
mov    %r13,%rdi
lea    0xd3e(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rbp
cmp    %r12,%r15
je     1330 <main+0x180>
lea    0x1(%rbp),%r12
mov    (%r14,%rbp,4),%ecx
cmp    %r15,%r12
jae    12c0 <main+0x110>
mov    %r13,%rdi
lea    0xd16(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r14,%rbp,4),%esi
lea    0xd1e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12e7 <main+0x137>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    %r13,%rdi
call   1090 <fflush@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %rbx,%r12
mov    %rbx,%rdi
lea    0xcd8(%rip),%rsi
mov    %r15d,%edx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
lea    0xca3(%rip),%r13
mov    %r13,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r14
xor    %ebp,%ebp
mov    0x10(%rsp),%rax
jmp    13cc <main+0x21c>
nopw   0x0(%rax,%rax,1)
lea    0xc7f(%rip),%rdi
mov    %ecx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rax
mov    (%rax,%rbp,4),%ecx
mov    %r14,%rdi
lea    0xc6a(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x10(%rsp),%rax
mov    %rbx,%rbp
cmp    %rbx,%r15
je     1240 <main+0x90>
lea    0x1(%rbp),%rbx
mov    (%rax,%rbp,4),%ecx
cmp    %r15,%rbx
jae    1390 <main+0x1e0>
mov    %r14,%rdi
lea    0xc3a(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x10(%rsp),%rax
mov    (%rax,%rbp,4),%esi
lea    0xc3e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    13bb <main+0x20b>

LLVM IR (-O0):
@.str = [25 x i8] c"rank_files/rfile_fill_%d\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [28 x i8] c"rank %d=localhost slot=%d \0A\00"
@.str.3 = [4 x i8] c"%d,\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [23 x i8] c"rank_files/rfile_rr_%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [128 x i8]
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = call i32 (...) @numa_num_configured_cpus()
store i32 %16, i32* %6
%17 = call i32 (...) @numa_max_node()
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
store i32 0, i32* %8
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = load i32, i32* %6
%23 = sdiv i32 %22, 2
store i32 %23, i32* %6
store i32 1, i32* %8
br label %24
24: ; preds = %21, %2
store i32 2, i32* %11
br label %25
25: ; preds = %147, %24
%26 = load i32, i32* %11
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %150
30: ; preds = %25
%31 = load i32, i32* %11
%32 = load i32, i32* %8
%33 = call i32* @placement(i32 %31, i32 0, i32 %32)
store i32* %33, i32** %12
%34 = load i32, i32* %11
%35 = load i32, i32* %8
%36 = call i32* @placement(i32 %34, i32 1, i32 %35)
store i32* %36, i32** %13
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%38 = load i32, i32* %11
%39 = call i32 @sprintf(i8* %37, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %41, i32** %9
store i32 0, i32* %14
br label %42
42: ; preds = %82, %30
%43 = load i32, i32* %14
%44 = load i32, i32* %11
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %85
46: ; preds = %42
%47 = load i32, i32* %14
%48 = add nsw i32 %47, 1
%49 = load i32, i32* %11
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %66
51: ; preds = %46
%52 = load i32*, i32** %9
%53 = load i32, i32* %14
%54 = load i32*, i32** %13
%55 = load i32, i32* %14
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
%58 = load i32, i32* %57
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %52, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %53, i32 %58)
%60 = load i32*, i32** %13
%61 = load i32, i32* %14
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %64)
br label %81
66: ; preds = %46
%67 = load i32*, i32** %13
%68 = load i32, i32* %14
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %67, i64 %69
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %71)
%73 = load i32*, i32** %9
%74 = load i32, i32* %14
%75 = load i32*, i32** %13
%76 = load i32, i32* %14
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
%79 = load i32, i32* %78
%80 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %74, i32 %79)
br label %81
81: ; preds = %66, %51
br label %82
82: ; preds = %81
%83 = load i32, i32* %14
%84 = add nsw i32 %83, 1
store i32 %84, i32* %14
br label %42
85: ; preds = %42
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%87 = load i32*, i32** %9
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%89 = load i32*, i32** %9
%90 = call i32 @fflush(i32* %89)
%91 = load i32*, i32** %9
%92 = call i32 @fclose(i32* %91)
%93 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%94 = load i32, i32* %11
%95 = call i32 @sprintf(i8* %93, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %94)
%96 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%97 = call i32* @fopen(i8* %96, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %97, i32** %9
store i32 0, i32* %15
br label %98
98: ; preds = %138, %85
%99 = load i32, i32* %15
%100 = load i32, i32* %11
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %141
102: ; preds = %98
%103 = load i32, i32* %15
%104 = add nsw i32 %103, 1
%105 = load i32, i32* %11
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %122
107: ; preds = %102
%108 = load i32*, i32** %9
%109 = load i32, i32* %15
%110 = load i32*, i32** %12
%111 = load i32, i32* %15
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %110, i64 %112
%114 = load i32, i32* %113
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %108, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %109, i32 %114)
%116 = load i32*, i32** %12
%117 = load i32, i32* %15
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32, i32* %116, i64 %118
%120 = load i32, i32* %119
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %120)
br label %137
122: ; preds = %102
%123 = load i32*, i32** %12
%124 = load i32, i32* %15
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i32, i32* %123, i64 %125
%127 = load i32, i32* %126
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %127)
%129 = load i32*, i32** %9
%130 = load i32, i32* %15
%131 = load i32*, i32** %12
%132 = load i32, i32* %15
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i32, i32* %131, i64 %133
%135 = load i32, i32* %134
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %129, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %130, i32 %135)
br label %137
137: ; preds = %122, %107
br label %138
138: ; preds = %137
%139 = load i32, i32* %15
%140 = add nsw i32 %139, 1
store i32 %140, i32* %15
br label %98
141: ; preds = %98
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%143 = load i32*, i32** %9
%144 = call i32 @fflush(i32* %143)
%145 = load i32*, i32** %9
%146 = call i32 @fclose(i32* %145)
br label %147
147: ; preds = %141
%148 = load i32, i32* %11
%149 = add nsw i32 %148, 1
store i32 %149, i32* %11
br label %25
150: ; preds = %25
%151 = load i32, i32* %3
ret i32 %151
}

LLVM IR (-O2):
@.str = [25 x i8] c"rank_files/rfile_fill_%d\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [28 x i8] c"rank %d=localhost slot=%d \0A\00"
@.str.3 = [4 x i8] c"%d,\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.6 = [23 x i8] c"rank_files/rfile_rr_%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = tail call i32 (...) @numa_num_configured_cpus()
%5 = tail call i32 (...) @numa_max_node()
%6 = icmp eq i32 %0, 2
%7 = sdiv i32 %4, 2
%8 = zext i1 %6 to i32
%9 = select i1 %6, i32 %7, i32 %4
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%11 = icmp slt i32 %9, 2
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = add nuw i32 %9, 1
%14 = zext i32 %13 to i64
br label %16
15: ; preds = %48, %2
ret i32 0
16: ; preds = %12, %48
%17 = phi i64 [ 2, %12 ], [ %52, %48 ]
%18 = trunc i64 %17 to i32
%19 = tail call i32* @placement(i32 %18, i32 0, i32 %8)
%20 = tail call i32* @placement(i32 %18, i32 1, i32 %8)
%21 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %18)
%22 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %30
23: ; preds = %46
%24 = tail call i32 @putchar(i32 10)
%25 = tail call i32 @fputc(i32 10, i32* %22)
%26 = tail call i32 @fflush(i32* %22)
%27 = tail call i32 @fclose(i32* %22)
%28 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %18)
%29 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %54
30: ; preds = %16, %46
%31 = phi i64 [ 0, %16 ], [ %32, %46 ]
%32 = add nuw nsw i64 %31, 1
%33 = icmp ult i64 %32, %17
%34 = getelementptr inbounds i32, i32* %20, i64 %31
%35 = load i32, i32* %34
br i1 %33, label %36, label %41
36: ; preds = %30
%37 = trunc i64 %31 to i32
%38 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %35)
%39 = load i32, i32* %34
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %39)
br label %46
41: ; preds = %30
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%43 = load i32, i32* %34
%44 = trunc i64 %31 to i32
%45 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %44, i32 %43)
br label %46
46: ; preds = %36, %41
%47 = icmp eq i64 %32, %17
br i1 %47, label %23, label %30
48: ; preds = %70
%49 = tail call i32 @putchar(i32 10)
%50 = tail call i32 @fflush(i32* %29)
%51 = tail call i32 @fclose(i32* %29)
%52 = add nuw nsw i64 %17, 1
%53 = icmp eq i64 %52, %14
br i1 %53, label %15, label %16
54: ; preds = %23, %70
%55 = phi i64 [ 0, %23 ], [ %56, %70 ]
%56 = add nuw nsw i64 %55, 1
%57 = icmp ult i64 %56, %17
%58 = getelementptr inbounds i32, i32* %19, i64 %55
%59 = load i32, i32* %58
br i1 %57, label %60, label %65
60: ; preds = %54
%61 = trunc i64 %55 to i32
%62 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %61, i32 %59)
%63 = load i32, i32* %58
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %63)
br label %70
65: ; preds = %54
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %59)
%67 = load i32, i32* %58
%68 = trunc i64 %55 to i32
%69 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %68, i32 %67)
br label %70
70: ; preds = %60, %65
%71 = icmp eq i64 %56, %17
br i1 %71, label %48, label %54
}