#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__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int sq(int);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *, int *, int *);
int main(int argc, char *argv[]) {
  FILE *fp;
  int a[4], x, y, d;
  char line[27];
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fgets(line, 27, fp) != 0) {
    sscanf(line, "(%d, %d) (%d, %d)", &a[0], &a[1], &a[2], &a[3]);
    x = a[0] - a[2];
    y = a[1] - a[3];
    d = sq(x * x + y * y);
    printf("%d\n", d);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1191 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1243 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe67(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1b,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     123c <main+0xec>
lea    -0x60(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x30(%rbp),%rcx
add    $0x4,%rcx
lea    -0x30(%rbp),%r8
add    $0x8,%r8
lea    -0x30(%rbp),%r9
add    $0xc,%r9
lea    0xe1d(%rip),%rsi
call   1050 <sscanf@plt>
mov    -0x30(%rbp),%eax
sub    -0x28(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%edi
imul   -0x34(%rbp),%edi
mov    -0x38(%rbp),%eax
imul   -0x38(%rbp),%eax
add    %eax,%edi
call   1060 <sq@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x2,%edi
jne    120c <main+0xbc>
mov    0x8(%rsi),%rdi
lea    0xea0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
mov    $0x1b,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1225 <main+0xd5>
lea    0xe78(%rip),%r13
lea    0x10(%rsp),%rbp
mov    %rsp,%r14
lea    0xe7b(%rip),%r15
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
lea    0x4(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0xc(%rsp),%r9
call   1050 <sscanf@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%edi
sub    0x8(%rsp),%eax
sub    0xc(%rsp),%edi
imul   %eax,%eax
imul   %edi,%edi
add    %eax,%edi
call   1060 <sq@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x1b,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    11b0 <main+0x60>
jmp    1228 <main+0xd8>
mov    (%rsi),%rsi
lea    0xdea(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%r12d
jmp    1228 <main+0xd8>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"(%d, %d) (%d, %d)\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [4 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [27 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %17)
store i32 1, i32* %3
br label %57
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i32 1
store i8** %21, i8*** %5
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %6
br label %24
24: ; preds = %29, %19
%25 = getelementptr inbounds [27 x i8], [27 x i8]* %11, i64 0, i64 0
%26 = load i32*, i32** %6
%27 = call i64 @fgets(i8* %25, i32 27, i32* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %56
29: ; preds = %24
%30 = getelementptr inbounds [27 x i8], [27 x i8]* %11, i64 0, i64 0
%31 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 1
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 2
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
%35 = call i32 @sscanf(i8* %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %31, i32* %32, i32* %33, i32* %34)
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%37 = load i32, i32* %36
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 2
%39 = load i32, i32* %38
%40 = sub nsw i32 %37, %39
store i32 %40, i32* %8
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 1
%42 = load i32, i32* %41
%43 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
%44 = load i32, i32* %43
%45 = sub nsw i32 %42, %44
store i32 %45, i32* %9
%46 = load i32, i32* %8
%47 = load i32, i32* %8
%48 = mul nsw i32 %46, %47
%49 = load i32, i32* %9
%50 = load i32, i32* %9
%51 = mul nsw i32 %49, %50
%52 = add nsw i32 %48, %51
%53 = call i32 @sq(i32 %52)
store i32 %53, i32* %10
%54 = load i32, i32* %10
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %24
56: ; preds = %24
store i32 0, i32* %3
br label %57
57: ; preds = %56, %14
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"(%d, %d) (%d, %d)\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4 x i32]
%4 = alloca [27 x i8]
%5 = bitcast [4 x i32]* %3 to i8*
%6 = getelementptr inbounds [27 x i8], [27 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %37
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = call i64 @fgets(i8* %6, i32 27, i32* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %37, label %17
17: ; preds = %11
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
br label %22
22: ; preds = %17, %22
%23 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %18, i32* %19, i32* %20, i32* %21)
%24 = load i32, i32* %18
%25 = load i32, i32* %20
%26 = sub nsw i32 %24, %25
%27 = load i32, i32* %19
%28 = load i32, i32* %21
%29 = sub nsw i32 %27, %28
%30 = mul nsw i32 %26, %26
%31 = mul nsw i32 %29, %29
%32 = add nuw nsw i32 %31, %30
%33 = call i32 @sq(i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = call i64 @fgets(i8* %6, i32 27, i32* %14)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %22
37: ; preds = %22, %11, %8
%38 = phi i32 [ 1, %8 ], [ 0, %11 ], [ 0, %22 ]
ret i32 %38
}