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

/* Variables and functions */
scalar_t__ AreCirclesTangent(int, int, int, int, int, int);
int CalculateDistance(int, int, int, int);
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, ...);
size_t fread(char *, int, size_t const, int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, size_t, int /*<<< orphan*/ *);
char *malloc(size_t const);
int /*<<< orphan*/ remove(char *);
main() {
  int MinimumRadius = 0;
  int CurrentRadius = 0;
  FILE *InputFile = fopen("dane.txt", "r");
  if (InputFile == NULL) {
    exit(255);
  }
  fscanf(InputFile, "%*d %*d %d", &MinimumRadius);
  while (!feof(InputFile)) {
    fscanf(InputFile, "%*d %*d %d", &CurrentRadius);
    if (CurrentRadius < MinimumRadius) {
      MinimumRadius = CurrentRadius;
    }
  }
  int CircleX = 0;
  int CircleY = 0;
  int CirclesCount = 0;
  int CirclesTotal = 0;
  fseek(InputFile, 0, SEEK_SET);
  FILE *OutputFile = fopen("wynik1.txt", "w");
  if (OutputFile == NULL) {
    exit(254);
  }
  while (!feof(InputFile)) {
    fscanf(InputFile, "%d %d %d", &CircleX, &CircleY, &CurrentRadius);
    if (CurrentRadius == MinimumRadius) {
      fprintf(OutputFile, "%d %d %d\n", CircleX, CircleY, CurrentRadius);
      CirclesCount = CirclesCount + 1;
    }
    CirclesTotal = CirclesTotal + 1;
  }
  fprintf(OutputFile, "%d\n", CirclesCount);
  fclose(OutputFile);
  int ResultX = 0;
  int ResultY = 0;
  int ResultRadius = 0;
  int ResultVolume = 0;
  int TemporaryX = 0;
  int TemporaryY = 0;
  int TemporaryRadius = 0;
  int TemporaryVolume = 0;
  fseek(InputFile, 0, SEEK_SET);
  fscanf(InputFile, "%d %d %d", &ResultX, &ResultX, &ResultRadius);
  while (!feof(InputFile)) {
    fscanf(InputFile, "%d %d %*d", &CircleX, &CircleY);
    if (CalculateDistance(ResultX, ResultY, CircleX, CircleY) <=
        (ResultRadius * ResultRadius)) {
      ResultVolume = ResultVolume + 1;
    }
  }
  int CurrentIndex = 0;
  int CurrentOffset = 0;
  int OffsetIndex = 1;
  while (CurrentIndex < CirclesTotal) {
    CurrentOffset = OffsetIndex;
    fseek(InputFile, 0, SEEK_SET);
    while (CurrentOffset > 0) {
      fscanf(InputFile, "%*d %*d %*d");
      CurrentOffset = CurrentOffset - 1;
    }
    TemporaryVolume = -1;
    fscanf(InputFile, "%d %d %d", &TemporaryX, &TemporaryY, &TemporaryRadius);
    fseek(InputFile, 0, SEEK_SET);
    while (!feof(InputFile)) {
      fscanf(InputFile, "%d %d %*d", &CircleX, &CircleY);
      if (CalculateDistance(TemporaryX, TemporaryY, CircleX, CircleY) <=
          (TemporaryRadius * TemporaryRadius)) {
        TemporaryVolume = TemporaryVolume + 1;
      }
    }
    if (TemporaryVolume > ResultVolume) {
      ResultX = TemporaryX;
      ResultY = TemporaryY;
      ResultRadius = TemporaryRadius;
      ResultVolume = TemporaryVolume;
    }
    OffsetIndex = OffsetIndex + 1;
    CurrentIndex = CurrentIndex + 1;
  }
  OutputFile = fopen("wynik2.txt", "w");
  if (OutputFile == NULL) {
    exit(253);
  }
  fprintf(OutputFile, "%d %d %d\n", ResultX, ResultY, ResultRadius);
  fprintf(OutputFile, "%d\n", ResultVolume);
  fclose(OutputFile);
  CurrentIndex = 0;
  CurrentOffset = 0;
  OffsetIndex = 0;
  int CircleRadius = 0;
  int TangentCount = 0;
  FILE *TemporaryFile = fopen("plik pomocniczy.txt", "w+");
  if (TemporaryFile == NULL) {
    exit(252);
  }
  while (CurrentIndex < CirclesTotal) {
    CurrentOffset = OffsetIndex;
    fseek(InputFile, 0, SEEK_SET);
    while (CurrentOffset > 0) {
      fscanf(InputFile, "%*d %*d %*d");
      CurrentOffset = CurrentOffset - 1;
    }
    fscanf(InputFile, "%d %d %d", &TemporaryX, &TemporaryY, &TemporaryRadius);
    fseek(InputFile, 0, SEEK_SET);
    while (!feof(InputFile)) {
      fscanf(InputFile, "%d %d %d", &CircleX, &CircleY, &CircleRadius);
      if (AreCirclesTangent(TemporaryX, TemporaryY, TemporaryRadius, CircleX,
                            CircleY, CircleRadius)) {
        TangentCount = TangentCount + 1;
        fprintf(TemporaryFile, "%d %d %d %d %d %d\n", TemporaryX, TemporaryY,
                TemporaryRadius, CircleX, CircleY, CircleRadius);
      }
    }
    OffsetIndex = OffsetIndex + 1;
    CurrentIndex = CurrentIndex + 1;
  }
  OutputFile = fopen("wynik3.txt", "w");
  if (OutputFile == NULL) {
    exit(251);
  }
  size_t BytesRead = 0;
  const size_t BufferSize = 1024;
  char *FileBuffer = malloc(BufferSize);
  fseek(TemporaryFile, 0, SEEK_SET);
  fprintf(OutputFile, "%d\n", TangentCount);
  while ((BytesRead = fread(FileBuffer, 1, BufferSize, TemporaryFile)) > 0) {
    fwrite(FileBuffer, 1, BytesRead, OutputFile);
  }
  fclose(OutputFile);
  fclose(TemporaryFile);
  remove("plik pomocniczy.txt");
  fclose(InputFile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe09(%rip),%rdi
lea    0xe0b(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    121c <main+0x4c>
mov    $0xff,%edi
call   10d0 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xde4(%rip),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1250 <main+0x80>
jmp    127d <main+0xad>
mov    -0x18(%rbp),%rdi
lea    0xdb0(%rip),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1278 <main+0xa8>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1232 <main+0x62>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d3c(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
lea    0xd62(%rip),%rdi
lea    0xd66(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12d9 <main+0x109>
mov    $0xfe,%edi
call   10d0 <exit@plt>
jmp    12de <main+0x10e>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12fc <main+0x12c>
jmp    1359 <main+0x189>
mov    -0x18(%rbp),%rdi
lea    0xd1c(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0xc(%rbp),%r8
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    134b <main+0x17b>
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xd32(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12de <main+0x10e>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xd0c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2c26(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
lea    0xc55(%rip),%rsi
lea    -0x34(%rbp),%rcx
lea    -0x3c(%rbp),%r8
mov    %rcx,%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13fe <main+0x22e>
jmp    1446 <main+0x276>
mov    -0x18(%rbp),%rdi
lea    0xc23(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   10f0 <CalculateDistance@plt>
mov    -0x3c(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
cmp    %ecx,%eax
jg     1441 <main+0x271>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13e0 <main+0x210>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x1,-0x5c(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1585 <main+0x3b5>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2b68(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
cmpl   $0x0,-0x58(%rbp)
jle    14ab <main+0x2db>
mov    -0x18(%rbp),%rdi
lea    0xba0(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1481 <main+0x2b1>
movl   $0xffffffff,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xb66(%rip),%rsi
lea    -0x44(%rbp),%rdx
lea    -0x48(%rbp),%rcx
lea    -0x4c(%rbp),%r8
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2b05(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1502 <main+0x332>
jmp    154a <main+0x37a>
mov    -0x18(%rbp),%rdi
lea    0xb1f(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   10f0 <CalculateDistance@plt>
mov    -0x4c(%rbp),%ecx
imul   -0x4c(%rbp),%ecx
cmp    %ecx,%eax
jg     1545 <main+0x375>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    14e4 <main+0x314>
mov    -0x50(%rbp),%eax
cmp    -0x40(%rbp),%eax
jle    156e <main+0x39e>
mov    -0x44(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    145b <main+0x28b>
lea    0xab6(%rip),%rdi
lea    0xa8e(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    15b1 <main+0x3e1>
mov    $0xfd,%edi
call   10d0 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
lea    0xaa7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%edx
lea    0xa98(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
lea    0xa38(%rip),%rdi
lea    0xa45(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    163a <main+0x46a>
mov    $0xfc,%edi
call   10d0 <exit@plt>
jmp    163f <main+0x46f>
mov    -0x54(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1774 <main+0x5a4>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2984(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
cmpl   $0x0,-0x58(%rbp)
jle    168f <main+0x4bf>
mov    -0x18(%rbp),%rdi
lea    0x9bc(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1665 <main+0x495>
mov    -0x18(%rbp),%rdi
lea    0x989(%rip),%rsi
lea    -0x44(%rbp),%rdx
lea    -0x48(%rbp),%rcx
lea    -0x4c(%rbp),%r8
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2928(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    16df <main+0x50f>
jmp    175d <main+0x58d>
mov    -0x18(%rbp),%rdi
lea    0x939(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x60(%rbp),%r8
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x60(%rbp),%r9d
call   1030 <AreCirclesTangent@plt>
cmp    $0x0,%rax
je     1758 <main+0x588>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%r10d
mov    -0x60(%rbp),%eax
lea    0x91b(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    16c1 <main+0x4f1>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    163f <main+0x46f>
lea    0x8fc(%rip),%rdi
lea    0x89f(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    17a0 <main+0x5d0>
mov    $0xfb,%edi
call   10d0 <exit@plt>
movq   $0x0,-0x78(%rbp)
movq   $0x400,-0x80(%rbp)
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x70(%rbp),%rdi
mov    0x2814(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x30(%rbp),%rdi
mov    -0x64(%rbp),%edx
lea    0x890(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x70(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1050 <fread@plt>
mov    %rax,-0x78(%rbp)
cmp    $0x0,%rax
jbe    1830 <main+0x660>
mov    -0x88(%rbp),%rdi
mov    -0x78(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x1,%esi
call   10e0 <fwrite@plt>
jmp    17ea <main+0x61a>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x70(%rbp),%rdi
call   1060 <fclose@plt>
lea    0x804(%rip),%rdi
call   1040 <remove@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movl   $0x0,0x30(%rsp)
movl   $0x0,0x2c(%rsp)
lea    0xe0b(%rip),%rdi
lea    0xe0d(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1834 <main+0x664>
mov    %rax,%r15
lea    0xdf7(%rip),%rsi
lea    0x30(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     14d2 <main+0x302>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x2d96(%rip),%rax
mov    (%rax),%edx
movl   $0x0,0x10(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
lea    0xdb1(%rip),%rdi
lea    0xdb5(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     183e <main+0x66e>
mov    %rax,%r14
mov    %r15,%rdi
call   1090 <feof@plt>
mov    $0x0,%ebp
test   %eax,%eax
je     1510 <main+0x340>
lea    0xdda(%rip),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
movl   $0x0,0x28(%rsp)
movl   $0x0,0x24(%rsp)
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
mov    0x2d04(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
lea    0xd34(%rip),%rsi
lea    0x28(%rsp),%rcx
lea    0x24(%rsp),%r8
mov    %r15,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r15,%rdi
call   1090 <feof@plt>
mov    $0x0,%ebx
test   %eax,%eax
jne    1372 <main+0x1a2>
lea    0xd0e(%rip),%r14
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x28(%rsp),%edi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
xor    %esi,%esi
call   10f0 <CalculateDistance@plt>
mov    0x24(%rsp),%ecx
imul   %ecx,%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setle  %dl
add    %edx,%ebx
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     1330 <main+0x160>
mov    %ebx,0x38(%rsp)
cmpl   $0x0,0x10(%rsp)
je     1589 <main+0x3b9>
mov    $0x1,%eax
mov    $0x2,%ebp
lea    0xca4(%rip),%r14
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%rbx
movl   $0x0,0x34(%rsp)
jmp    13c9 <main+0x1f9>
cs nopw 0x0(%rax,%rax,1)
mov    0x40(%rsp),%rcx
lea    0x1(%rcx),%eax
mov    0x20(%rsp),%ebp
add    $0x1,%ebp
cmp    0x10(%rsp),%ecx
je     1591 <main+0x3c1>
mov    %rax,0x40(%rsp)
mov    0x2c0b(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %ebp,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     13f0 <main+0x220>
mov    %r15,%rdi
lea    0xc14(%rip),%rsi
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x2bb4(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r15,%rdi
call   1090 <feof@plt>
mov    $0xffffffff,%r13d
test   %eax,%eax
lea    0xbdd(%rip),%rbp
jne    14a5 <main+0x2d5>
mov    $0xffffffff,%r13d
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x1c(%rsp),%edi
mov    0x18(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
call   10f0 <CalculateDistance@plt>
mov    0x14(%rsp),%ecx
imul   %ecx,%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setle  %dl
add    %edx,%r13d
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     1460 <main+0x290>
cmp    0x38(%rsp),%r13d
jle    13b0 <main+0x1e0>
mov    0x1c(%rsp),%eax
mov    %eax,0x28(%rsp)
mov    0x18(%rsp),%eax
mov    %eax,0x34(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,0x24(%rsp)
mov    %r13d,0x38(%rsp)
jmp    13b0 <main+0x1e0>
lea    0xb32(%rip),%r14
lea    0x2c(%rsp),%rbp
jmp    14f0 <main+0x320>
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    1233 <main+0x63>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x2c(%rsp),%eax
cmp    0x30(%rsp),%eax
jge    14e0 <main+0x310>
mov    %eax,0x30(%rsp)
jmp    14e0 <main+0x310>
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x2c(%rsp),%rbx
xor    %ebp,%ebp
movl   $0x0,0x10(%rsp)
jmp    1545 <main+0x375>
nopl   0x0(%rax,%rax,1)
addl   $0x1,0x10(%rsp)
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    1292 <main+0xc2>
mov    %r15,%rdi
lea    0xad4(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x2c(%rsp),%r8d
cmp    0x30(%rsp),%r8d
jne    1530 <main+0x360>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %r14,%rdi
lea    0xaf0(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%ebp
jmp    1530 <main+0x360>
movl   $0x0,0x34(%rsp)
lea    0xaaa(%rip),%rdi
lea    0xa82(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1848 <main+0x678>
mov    %rax,%rbx
mov    0x28(%rsp),%edx
mov    0x24(%rsp),%r8d
lea    0xaad(%rip),%rsi
xor    %r14d,%r14d
mov    %rax,%rdi
mov    0x34(%rsp),%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xa9b(%rip),%rsi
mov    %rbx,%rdi
mov    0x38(%rsp),%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
movl   $0x0,0x3c(%rsp)
lea    0xa50(%rip),%rdi
lea    0xa5d(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1852 <main+0x682>
mov    %rax,%r12
cmpl   $0x0,0x10(%rsp)
je     176e <main+0x59e>
movl   $0x1,0x20(%rsp)
lea    0xa07(%rip),%r13
xor    %r14d,%r14d
xor    %eax,%eax
jmp    1656 <main+0x486>
cs nopw 0x0(%rax,%rax,1)
mov    0x40(%rsp),%eax
add    $0x1,%eax
addl   $0x1,0x20(%rsp)
cmp    0x10(%rsp),%eax
je     176e <main+0x59e>
mov    %r12,%rbx
mov    %eax,%ebp
mov    0x297e(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %ebp,0x40(%rsp)
test   %ebp,%ebp
je     1697 <main+0x4c7>
mov    0x20(%rsp),%r12d
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0xffffffff,%r12d
cmp    $0x1,%r12d
jg     1680 <main+0x4b0>
mov    %r15,%rdi
lea    0x982(%rip),%rsi
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x2922(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r15,%rdi
call   1090 <feof@plt>
mov    %rbx,%r12
jmp    16e8 <main+0x518>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    1640 <main+0x470>
mov    %r15,%rdi
lea    0x929(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x3c(%rsp),%r8
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x1c(%rsp),%edi
mov    0x18(%rsp),%esi
mov    0x14(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    0x3c(%rsp),%r9d
call   1030 <AreCirclesTangent@plt>
test   %rax,%rax
je     16e0 <main+0x510>
add    $0x1,%r14d
mov    0x1c(%rsp),%edx
mov    0x18(%rsp),%ecx
mov    0x14(%rsp),%r8d
mov    0xc(%rsp),%r9d
mov    0x8(%rsp),%ebp
mov    0x3c(%rsp),%ebx
mov    %r12,%rdi
lea    0x908(%rip),%rsi
xor    %eax,%eax
push   %rbx
push   %rbp
call   1080 <fprintf@plt>
add    $0x10,%rsp
jmp    16e0 <main+0x510>
lea    0x902(%rip),%rdi
lea    0x8a5(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     185c <main+0x68c>
mov    %rax,%rbx
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    0x283f(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
lea    0x8bf(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x400,%edx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %r12,%rcx
call   1050 <fread@plt>
test   %rax,%rax
je     17ff <main+0x62f>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
jmp    17d0 <main+0x600>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %r12,%rdi
call   1060 <fclose@plt>
lea    0x837(%rip),%rdi
call   1040 <remove@plt>
mov    %r15,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xff,%edi
call   10d0 <exit@plt>
mov    $0xfe,%edi
call   10d0 <exit@plt>
mov    $0xfd,%edi
call   10d0 <exit@plt>
mov    $0xfc,%edi
call   10d0 <exit@plt>
mov    $0xfb,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"dane.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"%*d %*d %d\00"
@SEEK_SET = global i32 0
@.str.3 = [11 x i8] c"wynik1.txt\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [9 x i8] c"%d %d %d\00"
@.str.6 = [10 x i8] c"%d %d %d\0A\00"
@.str.7 = [4 x i8] c"%d\0A\00"
@.str.8 = [10 x i8] c"%d %d %*d\00"
@.str.9 = [12 x i8] c"%*d %*d %*d\00"
@.str.10 = [11 x i8] c"wynik2.txt\00"
@.str.11 = [20 x i8] c"plik pomocniczy.txt\00"
@.str.12 = [3 x i8] c"w+\00"
@.str.13 = [19 x i8] c"%d %d %d %d %d %d\0A\00"
@.str.14 = [11 x i8] c"wynik3.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%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
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32*
%24 = alloca i64
%25 = alloca i64
%26 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%27 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %4
%28 = load i32*, i32** %4
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %0
%31 = call i32 @exit(i32 255)
unreachable
32: ; preds = %0
%33 = load i32*, i32** %4
%34 = call i32 (i32*, i8*, ...) @fscanf(i32* %33, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %35
35: ; preds = %48, %32
%36 = load i32*, i32** %4
%37 = call i32 @feof(i32* %36)
%38 = icmp ne i32 %37, 0
%39 = xor i1 %38, true
br i1 %39, label %40, label %49
40: ; preds = %35
%41 = load i32*, i32** %4
%42 = call i32 (i32*, i8*, ...) @fscanf(i32* %41, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%43 = load i32, i32* %3
%44 = load i32, i32* %2
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %48
46: ; preds = %40
%47 = load i32, i32* %3
store i32 %47, i32* %2
br label %48
48: ; preds = %46, %40
br label %35
49: ; preds = %35
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%50 = load i32*, i32** %4
%51 = load i32, i32* @SEEK_SET
%52 = call i32 @fseek(i32* %50, i32 0, i32 %51)
%53 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %53, i32** %9
%54 = load i32*, i32** %9
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = call i32 @exit(i32 254)
unreachable
58: ; preds = %49
br label %59
59: ; preds = %78, %58
%60 = load i32*, i32** %4
%61 = call i32 @feof(i32* %60)
%62 = icmp ne i32 %61, 0
%63 = xor i1 %62, true
br i1 %63, label %64, label %81
64: ; preds = %59
%65 = load i32*, i32** %4
%66 = call i32 (i32*, i8*, ...) @fscanf(i32* %65, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %5, i32* %6, i32* %3)
%67 = load i32, i32* %3
%68 = load i32, i32* %2
%69 = icmp eq i32 %67, %68
br i1 %69, label %70, label %78
70: ; preds = %64
%71 = load i32*, i32** %9
%72 = load i32, i32* %5
%73 = load i32, i32* %6
%74 = load i32, i32* %3
%75 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %72, i32 %73, i32 %74)
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %78
78: ; preds = %70, %64
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
br label %59
81: ; preds = %59
%82 = load i32*, i32** %9
%83 = load i32, i32* %7
%84 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %83)
%85 = load i32*, i32** %9
%86 = call i32 @fclose(i32* %85)
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
%87 = load i32*, i32** %4
%88 = load i32, i32* @SEEK_SET
%89 = call i32 @fseek(i32* %87, i32 0, i32 %88)
%90 = load i32*, i32** %4
%91 = call i32 (i32*, i8*, ...) @fscanf(i32* %90, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %10, i32* %10, i32* %12)
br label %92
92: ; preds = %112, %81
%93 = load i32*, i32** %4
%94 = call i32 @feof(i32* %93)
%95 = icmp ne i32 %94, 0
%96 = xor i1 %95, true
br i1 %96, label %97, label %113
97: ; preds = %92
%98 = load i32*, i32** %4
%99 = call i32 (i32*, i8*, ...) @fscanf(i32* %98, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %5, i32* %6)
%100 = load i32, i32* %10
%101 = load i32, i32* %11
%102 = load i32, i32* %5
%103 = load i32, i32* %6
%104 = call i32 @CalculateDistance(i32 %100, i32 %101, i32 %102, i32 %103)
%105 = load i32, i32* %12
%106 = load i32, i32* %12
%107 = mul nsw i32 %105, %106
%108 = icmp sle i32 %104, %107
br i1 %108, label %109, label %112
109: ; preds = %97
%110 = load i32, i32* %13
%111 = add nsw i32 %110, 1
store i32 %111, i32* %13
br label %112
112: ; preds = %109, %97
br label %92
113: ; preds = %92
store i32 0, i32* %18
store i32 0, i32* %19
store i32 1, i32* %20
br label %114
114: ; preds = %167, %113
%115 = load i32, i32* %18
%116 = load i32, i32* %8
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %172
118: ; preds = %114
%119 = load i32, i32* %20
store i32 %119, i32* %19
%120 = load i32*, i32** %4
%121 = load i32, i32* @SEEK_SET
%122 = call i32 @fseek(i32* %120, i32 0, i32 %121)
br label %123
123: ; preds = %126, %118
%124 = load i32, i32* %19
%125 = icmp sgt i32 %124, 0
br i1 %125, label %126, label %131
126: ; preds = %123
%127 = load i32*, i32** %4
%128 = call i32 (i32*, i8*, ...) @fscanf(i32* %127, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%129 = load i32, i32* %19
%130 = sub nsw i32 %129, 1
store i32 %130, i32* %19
br label %123
131: ; preds = %123
store i32 -1, i32* %17
%132 = load i32*, i32** %4
%133 = call i32 (i32*, i8*, ...) @fscanf(i32* %132, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %14, i32* %15, i32* %16)
%134 = load i32*, i32** %4
%135 = load i32, i32* @SEEK_SET
%136 = call i32 @fseek(i32* %134, i32 0, i32 %135)
br label %137
137: ; preds = %157, %131
%138 = load i32*, i32** %4
%139 = call i32 @feof(i32* %138)
%140 = icmp ne i32 %139, 0
%141 = xor i1 %140, true
br i1 %141, label %142, label %158
142: ; preds = %137
%143 = load i32*, i32** %4
%144 = call i32 (i32*, i8*, ...) @fscanf(i32* %143, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %5, i32* %6)
%145 = load i32, i32* %14
%146 = load i32, i32* %15
%147 = load i32, i32* %5
%148 = load i32, i32* %6
%149 = call i32 @CalculateDistance(i32 %145, i32 %146, i32 %147, i32 %148)
%150 = load i32, i32* %16
%151 = load i32, i32* %16
%152 = mul nsw i32 %150, %151
%153 = icmp sle i32 %149, %152
br i1 %153, label %154, label %157
154: ; preds = %142
%155 = load i32, i32* %17
%156 = add nsw i32 %155, 1
store i32 %156, i32* %17
br label %157
157: ; preds = %154, %142
br label %137
158: ; preds = %137
%159 = load i32, i32* %17
%160 = load i32, i32* %13
%161 = icmp sgt i32 %159, %160
br i1 %161, label %162, label %167
162: ; preds = %158
%163 = load i32, i32* %14
store i32 %163, i32* %10
%164 = load i32, i32* %15
store i32 %164, i32* %11
%165 = load i32, i32* %16
store i32 %165, i32* %12
%166 = load i32, i32* %17
store i32 %166, i32* %13
br label %167
167: ; preds = %162, %158
%168 = load i32, i32* %20
%169 = add nsw i32 %168, 1
store i32 %169, i32* %20
%170 = load i32, i32* %18
%171 = add nsw i32 %170, 1
store i32 %171, i32* %18
br label %114
172: ; preds = %114
%173 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %173, i32** %9
%174 = load i32*, i32** %9
%175 = icmp eq i32* %174, null
br i1 %175, label %176, label %178
176: ; preds = %172
%177 = call i32 @exit(i32 253)
unreachable
178: ; preds = %172
%179 = load i32*, i32** %9
%180 = load i32, i32* %10
%181 = load i32, i32* %11
%182 = load i32, i32* %12
%183 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %179, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %180, i32 %181, i32 %182)
%184 = load i32*, i32** %9
%185 = load i32, i32* %13
%186 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %184, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %185)
%187 = load i32*, i32** %9
%188 = call i32 @fclose(i32* %187)
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
store i32 0, i32* %22
%189 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
store i32* %189, i32** %23
%190 = load i32*, i32** %23
%191 = icmp eq i32* %190, null
br i1 %191, label %192, label %194
192: ; preds = %178
%193 = call i32 @exit(i32 252)
unreachable
194: ; preds = %178
br label %195
195: ; preds = %246, %194
%196 = load i32, i32* %18
%197 = load i32, i32* %8
%198 = icmp slt i32 %196, %197
br i1 %198, label %199, label %251
199: ; preds = %195
%200 = load i32, i32* %20
store i32 %200, i32* %19
%201 = load i32*, i32** %4
%202 = load i32, i32* @SEEK_SET
%203 = call i32 @fseek(i32* %201, i32 0, i32 %202)
br label %204
204: ; preds = %207, %199
%205 = load i32, i32* %19
%206 = icmp sgt i32 %205, 0
br i1 %206, label %207, label %212
207: ; preds = %204
%208 = load i32*, i32** %4
%209 = call i32 (i32*, i8*, ...) @fscanf(i32* %208, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%210 = load i32, i32* %19
%211 = sub nsw i32 %210, 1
store i32 %211, i32* %19
br label %204
212: ; preds = %204
%213 = load i32*, i32** %4
%214 = call i32 (i32*, i8*, ...) @fscanf(i32* %213, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %14, i32* %15, i32* %16)
%215 = load i32*, i32** %4
%216 = load i32, i32* @SEEK_SET
%217 = call i32 @fseek(i32* %215, i32 0, i32 %216)
br label %218
218: ; preds = %245, %212
%219 = load i32*, i32** %4
%220 = call i32 @feof(i32* %219)
%221 = icmp ne i32 %220, 0
%222 = xor i1 %221, true
br i1 %222, label %223, label %246
223: ; preds = %218
%224 = load i32*, i32** %4
%225 = call i32 (i32*, i8*, ...) @fscanf(i32* %224, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %5, i32* %6, i32* %21)
%226 = load i32, i32* %14
%227 = load i32, i32* %15
%228 = load i32, i32* %16
%229 = load i32, i32* %5
%230 = load i32, i32* %6
%231 = load i32, i32* %21
%232 = call i64 @AreCirclesTangent(i32 %226, i32 %227, i32 %228, i32 %229, i32 %230, i32 %231)
%233 = icmp ne i64 %232, 0
br i1 %233, label %234, label %245
234: ; preds = %223
%235 = load i32, i32* %22
%236 = add nsw i32 %235, 1
store i32 %236, i32* %22
%237 = load i32*, i32** %23
%238 = load i32, i32* %14
%239 = load i32, i32* %15
%240 = load i32, i32* %16
%241 = load i32, i32* %5
%242 = load i32, i32* %6
%243 = load i32, i32* %21
%244 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %237, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i32 %238, i32 %239, i32 %240, i32 %241, i32 %242, i32 %243)
br label %245
245: ; preds = %234, %223
br label %218
246: ; preds = %218
%247 = load i32, i32* %20
%248 = add nsw i32 %247, 1
store i32 %248, i32* %20
%249 = load i32, i32* %18
%250 = add nsw i32 %249, 1
store i32 %250, i32* %18
br label %195
251: ; preds = %195
%252 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %252, i32** %9
%253 = load i32*, i32** %9
%254 = icmp eq i32* %253, null
br i1 %254, label %255, label %257
255: ; preds = %251
%256 = call i32 @exit(i32 251)
unreachable
257: ; preds = %251
store i64 0, i64* %24
store i64 1024, i64* %25
%258 = call i8* @malloc(i64 1024)
store i8* %258, i8** %26
%259 = load i32*, i32** %23
%260 = load i32, i32* @SEEK_SET
%261 = call i32 @fseek(i32* %259, i32 0, i32 %260)
%262 = load i32*, i32** %9
%263 = load i32, i32* %22
%264 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %262, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %263)
br label %265
265: ; preds = %270, %257
%266 = load i8*, i8** %26
%267 = load i32*, i32** %23
%268 = call i64 @fread(i8* %266, i32 1, i64 1024, i32* %267)
store i64 %268, i64* %24
%269 = icmp ugt i64 %268, 0
br i1 %269, label %270, label %275
270: ; preds = %265
%271 = load i8*, i8** %26
%272 = load i64, i64* %24
%273 = load i32*, i32** %9
%274 = call i32 @fwrite(i8* %271, i32 1, i64 %272, i32* %273)
br label %265
275: ; preds = %265
%276 = load i32*, i32** %9
%277 = call i32 @fclose(i32* %276)
%278 = load i32*, i32** %23
%279 = call i32 @fclose(i32* %278)
%280 = call i32 @remove(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%281 = load i32*, i32** %4
%282 = call i32 @fclose(i32* %281)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"dane.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"%*d %*d %d\00"
@SEEK_SET = global i32 0
@.str.3 = [11 x i8] c"wynik1.txt\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [9 x i8] c"%d %d %d\00"
@.str.6 = [10 x i8] c"%d %d %d\0A\00"
@.str.7 = [4 x i8] c"%d\0A\00"
@.str.8 = [10 x i8] c"%d %d %*d\00"
@.str.9 = [12 x i8] c"%*d %*d %*d\00"
@.str.10 = [11 x i8] c"wynik2.txt\00"
@.str.11 = [20 x i8] c"plik pomocniczy.txt\00"
@.str.12 = [3 x i8] c"w+\00"
@.str.13 = [19 x i8] c"%d %d %d %d %d %d\0A\00"
@.str.14 = [11 x i8] c"wynik3.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%12 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%13 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = tail call i32 @exit(i32 255)
unreachable
17: ; preds = %0
%18 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%19 = call i32 @feof(i32* %13)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %17, %27
%22 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%23 = load i32, i32* %2
%24 = load i32, i32* %1
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 %23, i32* %1
br label %27
27: ; preds = %26, %21
%28 = call i32 @feof(i32* %13)
%29 = icmp eq i32 %28, 0
br i1 %29, label %21, label %30
30: ; preds = %27, %17
%31 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%32 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%33 = load i32, i32* @SEEK_SET
%34 = call i32 @fseek(i32* %13, i32 0, i32 %33)
%35 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp eq i32* %35, null
br i1 %36, label %40, label %37
37: ; preds = %30
%38 = call i32 @feof(i32* %13)
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %59
40: ; preds = %30
%41 = call i32 @exit(i32 254)
unreachable
42: ; preds = %37, %54
%43 = phi i32 [ %55, %54 ], [ 0, %37 ]
%44 = phi i32 [ %56, %54 ], [ 0, %37 ]
%45 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %3, i32* %4, i32* %2)
%46 = load i32, i32* %2
%47 = load i32, i32* %1
%48 = icmp eq i32 %46, %47
br i1 %48, label %49, label %54
49: ; preds = %42
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %50, i32 %51, i32 %46)
%53 = add nsw i32 %43, 1
br label %54
54: ; preds = %49, %42
%55 = phi i32 [ %53, %49 ], [ %43, %42 ]
%56 = add nuw nsw i32 %44, 1
%57 = call i32 @feof(i32* %13)
%58 = icmp eq i32 %57, 0
br i1 %58, label %42, label %59
59: ; preds = %54, %37
%60 = phi i32 [ 0, %37 ], [ %56, %54 ]
%61 = phi i32 [ 0, %37 ], [ %55, %54 ]
%62 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %61)
%63 = call i32 @fclose(i32* %35)
%64 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%65 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%66 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%67 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%68 = bitcast i32* %9 to i8*
store i32 0, i32* %9
%69 = load i32, i32* @SEEK_SET
%70 = call i32 @fseek(i32* %13, i32 0, i32 %69)
%71 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %5, i32* %5, i32* %6)
%72 = call i32 @feof(i32* %13)
%73 = icmp eq i32 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %77, %59
%75 = phi i32 [ 0, %59 ], [ %88, %77 ]
%76 = icmp eq i32 %60, 0
br i1 %76, label %135, label %91
77: ; preds = %59, %77
%78 = phi i32 [ %88, %77 ], [ 0, %59 ]
%79 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %3, i32* %4)
%80 = load i32, i32* %5
%81 = load i32, i32* %3
%82 = load i32, i32* %4
%83 = call i32 @CalculateDistance(i32 %80, i32 0, i32 %81, i32 %82)
%84 = load i32, i32* %6
%85 = mul nsw i32 %84, %84
%86 = icmp sle i32 %83, %85
%87 = zext i1 %86 to i32
%88 = add nuw nsw i32 %78, %87
%89 = call i32 @feof(i32* %13)
%90 = icmp eq i32 %89, 0
br i1 %90, label %77, label %74
91: ; preds = %74, %130
%92 = phi i32 [ %133, %130 ], [ 1, %74 ]
%93 = phi i32 [ %132, %130 ], [ %75, %74 ]
%94 = phi i32 [ %131, %130 ], [ 0, %74 ]
%95 = load i32, i32* @SEEK_SET
%96 = call i32 @fseek(i32* %13, i32 0, i32 %95)
br label %97
97: ; preds = %91, %97
%98 = phi i32 [ %92, %91 ], [ %100, %97 ]
%99 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%100 = add nsw i32 %98, -1
%101 = icmp sgt i32 %98, 1
br i1 %101, label %97, label %102
102: ; preds = %97
%103 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %7, i32* %8, i32* %9)
%104 = load i32, i32* @SEEK_SET
%105 = call i32 @fseek(i32* %13, i32 0, i32 %104)
%106 = call i32 @feof(i32* %13)
%107 = icmp eq i32 %106, 0
br i1 %107, label %108, label %123
108: ; preds = %102, %108
%109 = phi i32 [ %120, %108 ], [ -1, %102 ]
%110 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %3, i32* %4)
%111 = load i32, i32* %7
%112 = load i32, i32* %8
%113 = load i32, i32* %3
%114 = load i32, i32* %4
%115 = call i32 @CalculateDistance(i32 %111, i32 %112, i32 %113, i32 %114)
%116 = load i32, i32* %9
%117 = mul nsw i32 %116, %116
%118 = icmp sle i32 %115, %117
%119 = zext i1 %118 to i32
%120 = add nsw i32 %109, %119
%121 = call i32 @feof(i32* %13)
%122 = icmp eq i32 %121, 0
br i1 %122, label %108, label %123
123: ; preds = %108, %102
%124 = phi i32 [ -1, %102 ], [ %120, %108 ]
%125 = icmp sgt i32 %124, %93
br i1 %125, label %126, label %130
126: ; preds = %123
%127 = load i32, i32* %7
store i32 %127, i32* %5
%128 = load i32, i32* %8
%129 = load i32, i32* %9
store i32 %129, i32* %6
br label %130
130: ; preds = %126, %123
%131 = phi i32 [ %128, %126 ], [ %94, %123 ]
%132 = phi i32 [ %124, %126 ], [ %93, %123 ]
%133 = add nuw i32 %92, 1
%134 = icmp eq i32 %92, %60
br i1 %134, label %135, label %91
135: ; preds = %130, %74
%136 = phi i32 [ 0, %74 ], [ %131, %130 ]
%137 = phi i32 [ %75, %74 ], [ %132, %130 ]
%138 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%139 = icmp eq i32* %138, null
br i1 %139, label %140, label %142
140: ; preds = %135
%141 = call i32 @exit(i32 253)
unreachable
142: ; preds = %135
%143 = load i32, i32* %5
%144 = load i32, i32* %6
%145 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %143, i32 %136, i32 %144)
%146 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %137)
%147 = call i32 @fclose(i32* %138)
%148 = bitcast i32* %10 to i8*
store i32 0, i32* %10
%149 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%150 = icmp eq i32* %149, null
br i1 %150, label %152, label %151
151: ; preds = %142
br i1 %76, label %199, label %154
152: ; preds = %142
%153 = call i32 @exit(i32 252)
unreachable
154: ; preds = %151, %195
%155 = phi i32 [ %196, %195 ], [ 0, %151 ]
%156 = phi i32 [ %197, %195 ], [ 0, %151 ]
%157 = load i32, i32* @SEEK_SET
%158 = call i32 @fseek(i32* %13, i32 0, i32 %157)
%159 = icmp eq i32 %156, 0
br i1 %159, label %165, label %160
160: ; preds = %154, %160
%161 = phi i32 [ %163, %160 ], [ %156, %154 ]
%162 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%163 = add nsw i32 %161, -1
%164 = icmp sgt i32 %161, 1
br i1 %164, label %160, label %165
165: ; preds = %160, %154
%166 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %7, i32* %8, i32* %9)
%167 = load i32, i32* @SEEK_SET
%168 = call i32 @fseek(i32* %13, i32 0, i32 %167)
%169 = call i32 @feof(i32* %13)
%170 = icmp eq i32 %169, 0
br i1 %170, label %171, label %195
171: ; preds = %165, %191
%172 = phi i32 [ %192, %191 ], [ %155, %165 ]
%173 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %3, i32* %4, i32* %10)
%174 = load i32, i32* %7
%175 = load i32, i32* %8
%176 = load i32, i32* %9
%177 = load i32, i32* %3
%178 = load i32, i32* %4
%179 = load i32, i32* %10
%180 = call i64 @AreCirclesTangent(i32 %174, i32 %175, i32 %176, i32 %177, i32 %178, i32 %179)
%181 = icmp eq i64 %180, 0
br i1 %181, label %191, label %182
182: ; preds = %171
%183 = add nsw i32 %172, 1
%184 = load i32, i32* %7
%185 = load i32, i32* %8
%186 = load i32, i32* %9
%187 = load i32, i32* %3
%188 = load i32, i32* %4
%189 = load i32, i32* %10
%190 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %149, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i32 %184, i32 %185, i32 %186, i32 %187, i32 %188, i32 %189)
br label %191
191: ; preds = %182, %171
%192 = phi i32 [ %183, %182 ], [ %172, %171 ]
%193 = call i32 @feof(i32* %13)
%194 = icmp eq i32 %193, 0
br i1 %194, label %171, label %195
195: ; preds = %191, %165
%196 = phi i32 [ %155, %165 ], [ %192, %191 ]
%197 = add nuw i32 %156, 1
%198 = icmp eq i32 %197, %60
br i1 %198, label %199, label %154
199: ; preds = %195, %151
%200 = phi i32 [ 0, %151 ], [ %196, %195 ]
%201 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%202 = icmp eq i32* %201, null
br i1 %202, label %203, label %205
203: ; preds = %199
%204 = call i32 @exit(i32 251)
unreachable
205: ; preds = %199
%206 = call dereferenceable_or_null(1024) i8* @malloc(i64 1024)
%207 = load i32, i32* @SEEK_SET
%208 = call i32 @fseek(i32* %149, i32 0, i32 %207)
%209 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %201, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %200)
%210 = call i64 @fread(i8* %206, i32 1, i64 1024, i32* %149)
%211 = icmp eq i64 %210, 0
br i1 %211, label %217, label %212
212: ; preds = %205, %212
%213 = phi i64 [ %215, %212 ], [ %210, %205 ]
%214 = call i32 @fwrite(i8* %206, i32 1, i64 %213, i32* %201)
%215 = call i64 @fread(i8* %206, i32 1, i64 1024, i32* %149)
%216 = icmp eq i64 %215, 0
br i1 %216, label %217, label %212
217: ; preds = %212, %205
%218 = call i32 @fclose(i32* %201)
%219 = call i32 @fclose(i32* %149)
%220 = call i32 @remove(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%221 = call i32 @fclose(i32* %13)
ret i32 0
}