#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_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  scalar_t__ y;
  scalar_t__ x;
};
typedef TYPE_1__ XPoint;

/* Variables and functions */
int /*<<< orphan*/ myline_polygon(int, TYPE_1__ *, int);
int /*<<< orphan*/ mypolygon(int, TYPE_1__ *, int);
int /*<<< orphan*/ printf(char *, int);
void DrawSquare(int mycolor, XPoint *myp, int no, double size, int fill) {
  int i;
  XPoint points[5];
  for (i = 0; i < no; i++) {
    points[0].x = myp[i].x - size;
    points[0].y = myp[i].y - size;
    points[1].x = myp[i].x + size;
    points[1].y = myp[i].y - size;
    points[2].x = myp[i].x + size;
    points[2].y = myp[i].y + size;
    points[3].x = myp[i].x - size;
    points[3].y = myp[i].y + size;
    switch (fill) {
    case 0:
      points[4].x = points[0].x;
      points[4].y = points[0].y;
      myline_polygon(mycolor, points, 5);
      break;
    case 1:
      mypolygon(mycolor, points, 4);
      break;
    default:
      printf("draw2dgraph:DrawSquare: fill type %i not defined\n", fill);
    }
  }
}


x86 assembly (clang, -O0):
<DrawSquare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    130c <DrawSquare+0x1dc>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq 0x8(%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq (%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x80(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq 0x8(%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq (%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq 0x8(%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq (%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq 0x8(%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
cvtsi2sdq (%rax,%rcx,1),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x84(%rbp)
test   %eax,%eax
je     12ae <DrawSquare+0x17e>
jmp    129a <DrawSquare+0x16a>
mov    -0x84(%rbp),%eax
sub    $0x1,%eax
je     12d4 <DrawSquare+0x1a4>
jmp    12ea <DrawSquare+0x1ba>
mov    -0x78(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x5,%edx
call   1030 <myline_polygon@plt>
jmp    12f9 <DrawSquare+0x1c9>
mov    -0x4(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x4,%edx
call   1050 <mypolygon@plt>
jmp    12f9 <DrawSquare+0x1c9>
mov    -0x24(%rbp),%esi
lea    0xd0c(%rip),%rdi
call   1040 <printf@plt>
jmp    12fe <DrawSquare+0x1ce>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1154 <DrawSquare+0x24>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawSquare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movsd  %xmm0,0x8(%rsp)
test   %edx,%edx
jle    1245 <DrawSquare+0x115>
mov    %ecx,%ebp
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %edx,%r13d
shl    $0x4,%r13
xor    %r12d,%r12d
lea    0x10(%rsp),%r15
jmp    118b <DrawSquare+0x5b>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe89(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
add    $0x10,%r12
cmp    %r12,%r13
je     1245 <DrawSquare+0x115>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x8(%rbx,%r12,1),%xmm0
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm3
subsd  %xmm3,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,0x18(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx,%r12,1),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm3,%xmm2
cvttsd2si %xmm2,%rcx
mov    %rcx,0x10(%rsp)
addsd  %xmm3,%xmm0
cvttsd2si %xmm0,%rdx
mov    %rdx,0x28(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rdx,0x38(%rsp)
addsd  %xmm3,%xmm1
cvttsd2si %xmm1,%rdx
mov    %rdx,0x30(%rsp)
mov    %rax,0x48(%rsp)
mov    %rdx,0x40(%rsp)
cmp    $0x1,%ebp
je     1230 <DrawSquare+0x100>
test   %ebp,%ebp
jne    1170 <DrawSquare+0x40>
mov    %rax,0x58(%rsp)
mov    %rcx,0x50(%rsp)
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x5,%edx
call   1030 <myline_polygon@plt>
jmp    117e <DrawSquare+0x4e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x4,%edx
call   1050 <mypolygon@plt>
jmp    117e <DrawSquare+0x4e>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, i64 }
@.str = [50 x i8] c"draw2dgraph:DrawSquare: fill type %i not defined\0A\00"
define void @DrawSquare(i32 %0, %struct.TYPE_5__* %1, i32 %2, double %3, i32 %4) {
%6 = alloca i32
%7 = alloca %struct.TYPE_5__*
%8 = alloca i32
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca [5 x %struct.TYPE_5__]
store i32 %0, i32* %6
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %7
store i32 %2, i32* %8
store double %3, double* %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %13
13: ; preds = %137, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %140
17: ; preds = %13
%18 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%19 = load i32, i32* %11
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %18, i64 %20
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %21, i32 0, i32 1
%23 = load i64, i64* %22
%24 = sitofp i64 %23 to double
%25 = load double, double* %9
%26 = fsub double %24, %25
%27 = fptosi double %26 to i64
%28 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 0
%29 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %28, i32 0, i32 1
store i64 %27, i64* %29
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %30, i64 %32
%34 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i32 0, i32 0
%35 = load i64, i64* %34
%36 = sitofp i64 %35 to double
%37 = load double, double* %9
%38 = fsub double %36, %37
%39 = fptosi double %38 to i64
%40 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 0
%41 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %40, i32 0, i32 0
store i64 %39, i64* %41
%42 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %42, i64 %44
%46 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %45, i32 0, i32 1
%47 = load i64, i64* %46
%48 = sitofp i64 %47 to double
%49 = load double, double* %9
%50 = fadd double %48, %49
%51 = fptosi double %50 to i64
%52 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 1
%53 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %52, i32 0, i32 1
store i64 %51, i64* %53
%54 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%55 = load i32, i32* %11
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %54, i64 %56
%58 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %57, i32 0, i32 0
%59 = load i64, i64* %58
%60 = sitofp i64 %59 to double
%61 = load double, double* %9
%62 = fsub double %60, %61
%63 = fptosi double %62 to i64
%64 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 1
%65 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %64, i32 0, i32 0
store i64 %63, i64* %65
%66 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%67 = load i32, i32* %11
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %66, i64 %68
%70 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %69, i32 0, i32 1
%71 = load i64, i64* %70
%72 = sitofp i64 %71 to double
%73 = load double, double* %9
%74 = fadd double %72, %73
%75 = fptosi double %74 to i64
%76 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 2
%77 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %76, i32 0, i32 1
store i64 %75, i64* %77
%78 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%79 = load i32, i32* %11
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %78, i64 %80
%82 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %81, i32 0, i32 0
%83 = load i64, i64* %82
%84 = sitofp i64 %83 to double
%85 = load double, double* %9
%86 = fadd double %84, %85
%87 = fptosi double %86 to i64
%88 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 2
%89 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %88, i32 0, i32 0
store i64 %87, i64* %89
%90 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%91 = load i32, i32* %11
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %90, i64 %92
%94 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %93, i32 0, i32 1
%95 = load i64, i64* %94
%96 = sitofp i64 %95 to double
%97 = load double, double* %9
%98 = fsub double %96, %97
%99 = fptosi double %98 to i64
%100 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 3
%101 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %100, i32 0, i32 1
store i64 %99, i64* %101
%102 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%103 = load i32, i32* %11
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %102, i64 %104
%106 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %105, i32 0, i32 0
%107 = load i64, i64* %106
%108 = sitofp i64 %107 to double
%109 = load double, double* %9
%110 = fadd double %108, %109
%111 = fptosi double %110 to i64
%112 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 3
%113 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %112, i32 0, i32 0
store i64 %111, i64* %113
%114 = load i32, i32* %10
switch i32 %114, label %133 [
i32 0, label %115
i32 1, label %129
]
115: ; preds = %17
%116 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 0
%117 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %116, i32 0, i32 1
%118 = load i64, i64* %117
%119 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 4
%120 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %119, i32 0, i32 1
store i64 %118, i64* %120
%121 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 0
%122 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %121, i32 0, i32 0
%123 = load i64, i64* %122
%124 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 4
%125 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %124, i32 0, i32 0
store i64 %123, i64* %125
%126 = load i32, i32* %6
%127 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 0
%128 = call i32 @myline_polygon(i32 %126, %struct.TYPE_5__* %127, i32 5)
br label %136
129: ; preds = %17
%130 = load i32, i32* %6
%131 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %12, i64 0, i64 0
%132 = call i32 @mypolygon(i32 %130, %struct.TYPE_5__* %131, i32 4)
br label %136
133: ; preds = %17
%134 = load i32, i32* %10
%135 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %134)
br label %136
136: ; preds = %133, %129, %115
br label %137
137: ; preds = %136
%138 = load i32, i32* %11
%139 = add nsw i32 %138, 1
store i32 %139, i32* %11
br label %13
140: ; preds = %13
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, i64 }
@.str = [50 x i8] c"draw2dgraph:DrawSquare: fill type %i not defined\0A\00"
define void @DrawSquare(i32 %0, %struct.TYPE_5__* nocapture %1, i32 %2, double %3, i32 %4) {
%6 = alloca [5 x %struct.TYPE_5__]
%7 = bitcast [5 x %struct.TYPE_5__]* %6 to i8*
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %47
9: ; preds = %5
%10 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 0
%11 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 0, i32 1
%12 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 0, i32 0
%13 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 1, i32 1
%14 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 1, i32 0
%15 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 2, i32 1
%16 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 2, i32 0
%17 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 3, i32 1
%18 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 3, i32 0
%19 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 4, i32 1
%20 = getelementptr inbounds [5 x %struct.TYPE_5__], [5 x %struct.TYPE_5__]* %6, i64 0, i64 4, i32 0
%21 = zext i32 %2 to i64
br label %22
22: ; preds = %9, %44
%23 = phi i64 [ 0, %9 ], [ %45, %44 ]
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 %23, i32 1
%25 = load i64, i64* %24
%26 = sitofp i64 %25 to double
%27 = fsub double %26, %3
%28 = fptosi double %27 to i64
store i64 %28, i64* %11
%29 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 %23, i32 0
%30 = load i64, i64* %29
%31 = sitofp i64 %30 to double
%32 = fsub double %31, %3
%33 = fptosi double %32 to i64
store i64 %33, i64* %12
%34 = fadd double %26, %3
%35 = fptosi double %34 to i64
store i64 %35, i64* %13
store i64 %33, i64* %14
store i64 %35, i64* %15
%36 = fadd double %31, %3
%37 = fptosi double %36 to i64
store i64 %37, i64* %16
store i64 %28, i64* %17
store i64 %37, i64* %18
switch i32 %4, label %42 [
i32 0, label %38
i32 1, label %40
]
38: ; preds = %22
store i64 %28, i64* %19
store i64 %33, i64* %20
%39 = call i32 @myline_polygon(i32 %0, %struct.TYPE_5__* %10, i32 5)
br label %44
40: ; preds = %22
%41 = call i32 @mypolygon(i32 %0, %struct.TYPE_5__* %10, i32 4)
br label %44
42: ; preds = %22
%43 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %44
44: ; preds = %38, %40, %42
%45 = add nuw nsw i64 %23, 1
%46 = icmp eq i64 %45, %21
br i1 %46, label %47, label %22
47: ; preds = %44, %5
ret void
}