#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 char wchar_t;

/* Variables and functions */
int COLS;
int LINES;
float cos(float);
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ mvaddwstr(int, int, char const *);
int /*<<< orphan*/ refresh();
float sin(float);
int draw_terminal_bcircle(int virt, int h, int w, int f[200]) {
  const wchar_t *bars[] = {L"\u2581", L"\u2582", L"\u2583", L"\u2584",
                           L"\u2585", L"\u2586", L"\u2587", L"\u2588"};
  if (virt != 0) {
    if (LINES != h || COLS != w) {
      return -1;
    }
  }
  float deg, width, height;
  int y, x;
  width = f[1] / 10;
  height = f[1] / 15;
  int oy, ox;
  oy = LINES / 2 - height / 2;
  ox = COLS / 2 - width / 2;
  for (x = 0; x < COLS; x++) {
    for (y = 0; y < LINES; y++) {
      mvaddstr(y, x, " ");
    }
  }
  for (deg = 0; deg < 360.0f; deg += 1.0f) {
    x = ox + width + (int)(width * cos((deg * (180.0f / 3.141))));
    y = oy + height + (int)(height * sin((deg * (180.0f / 3.141))));
    mvaddwstr(y, x, bars[7]);
  }
  refresh();
  return 0;
}


x86 assembly (clang, -O0):
<draw_terminal_bcircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2c4d(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
cmpl   $0x0,-0x8(%rbp)
je     11cc <draw_terminal_bcircle+0x6c>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    11bb <draw_terminal_bcircle+0x5b>
mov    0x2e30(%rip),%rax
mov    (%rax),%eax
cmp    -0x10(%rbp),%eax
je     11c7 <draw_terminal_bcircle+0x67>
movl   $0xffffffff,-0x4(%rbp)
jmp    13d9 <draw_terminal_bcircle+0x279>
jmp    11cc <draw_terminal_bcircle+0x6c>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x6c(%rbp)
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  -0x6c(%rbp),%xmm1
movss  0xde2(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x78(%rbp)
mov    0x2dac(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  -0x68(%rbp),%xmm1
movss  0xdb1(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    0x2d71(%rip),%rcx
cmp    (%rcx),%eax
jge    12c3 <draw_terminal_bcircle+0x163>
movl   $0x0,-0x70(%rbp)
mov    -0x70(%rbp),%eax
mov    0x2d60(%rip),%rcx
cmp    (%rcx),%eax
jge    12b0 <draw_terminal_bcircle+0x150>
mov    -0x70(%rbp),%edi
mov    -0x74(%rbp),%esi
lea    0xdbb(%rip),%rdx
call   1080 <mvaddstr@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    127e <draw_terminal_bcircle+0x11e>
jmp    12b5 <draw_terminal_bcircle+0x155>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1265 <draw_terminal_bcircle+0x105>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
movss  0xd31(%rip),%xmm0
ucomiss -0x64(%rbp),%xmm0
jbe    13cb <draw_terminal_bcircle+0x26b>
cvtsi2ssl -0x7c(%rbp),%xmm0
addss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x88(%rbp)
ff
movss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
movss  -0x64(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd03(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1070 <cos@plt>
movss  -0x8c(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movss  -0x88(%rbp),%xmm0
ff
mulss  %xmm2,%xmm1
cvttss2si %xmm1,%eax
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x74(%rbp)
cvtsi2ssl -0x78(%rbp),%xmm0
addss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x80(%rbp)
movss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x64(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc9f(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <sin@plt>
movss  -0x84(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movss  -0x80(%rbp),%xmm0
mulss  %xmm2,%xmm1
cvttss2si %xmm1,%eax
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1050 <mvaddwstr@plt>
movss  0xc4c(%rip),%xmm0
addss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
jmp    12cb <draw_terminal_bcircle+0x16b>
mov    $0x0,%al
call   1060 <refresh@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_terminal_bcircle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e83(%rip),%r15
mov    (%r15),%eax
test   %edi,%edi
je     1189 <draw_terminal_bcircle+0x39>
mov    $0xffffffff,%ebx
cmp    %esi,%eax
jne    1329 <draw_terminal_bcircle+0x1d9>
mov    0x2e60(%rip),%rax
cmp    %edx,(%rax)
je     1194 <draw_terminal_bcircle+0x44>
jmp    1329 <draw_terminal_bcircle+0x1d9>
mov    0x2e50(%rip),%rdx
mov    (%rdx),%edx
mov    %eax,%esi
movslq 0x4(%rcx),%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edi,%ecx
cvtsi2ss %ecx,%xmm3
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x3,%ecx
add    %eax,%ecx
cvtsi2ss %ecx,%xmm4
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
cvtsi2ss %eax,%xmm0
movss  0xe1d(%rip),%xmm1
movaps %xmm4,%xmm2
mulss  %xmm1,%xmm2
subss  %xmm2,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,0x4(%rsp)
mov    %edx,%eax
shr    $0x1f,%eax
add    %edx,%eax
sar    %eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm3,%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%r13d
test   %edx,%edx
movss  %xmm3,0xc(%rsp)
movss  %xmm4,0x8(%rsp)
jle    1278 <draw_terminal_bcircle+0x128>
xor    %ebx,%ebx
lea    0xdec(%rip),%r14
mov    0x2dad(%rip),%r12
jmp    1247 <draw_terminal_bcircle+0xf7>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
cmp    %edx,%ebx
jge    1278 <draw_terminal_bcircle+0x128>
test   %esi,%esi
jle    1240 <draw_terminal_bcircle+0xf0>
xor    %ebp,%ebp
nopl   (%rax)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1070 <mvaddstr@plt>
add    $0x1,%ebp
mov    (%r15),%esi
cmp    %esi,%ebp
jl     1250 <draw_terminal_bcircle+0x100>
mov    (%r12),%edx
movss  0xc(%rsp),%xmm3
movss  0x8(%rsp),%xmm4
jmp    1240 <draw_terminal_bcircle+0xf0>
xorps  %xmm0,%xmm0
cvtsi2ss %r13d,%xmm0
addss  %xmm3,%xmm0
movss  %xmm0,0x14(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ssl 0x4(%rsp),%xmm0
addss  %xmm4,%xmm0
movss  %xmm0,0x10(%rsp)
xor    %ebx,%ebx
lea    0xd6a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xd45(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
call   1060 <cos@plt>
mulss  0xc(%rsp),%xmm0
cvttps2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
addss  0x14(%rsp),%xmm0
cvttss2si %xmm0,%ebp
movss  0x4(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x8(%rsp),%xmm0
cvttps2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
addss  0x10(%rsp),%xmm0
cvttss2si %xmm0,%edi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <mvaddwstr@plt>
add    $0x1,%ebx
cmp    $0x168,%ebx
jne    12b0 <draw_terminal_bcircle+0x160>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <refresh@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i32] [i32 9601, i32 0]
@.str.1 = [2 x i32] [i32 9602, i32 0]
@.str.2 = [2 x i32] [i32 9603, i32 0]
@.str.3 = [2 x i32] [i32 9604, i32 0]
@.str.4 = [2 x i32] [i32 9605, i32 0]
@.str.5 = [2 x i32] [i32 9606, i32 0]
@.str.6 = [2 x i32] [i32 9607, i32 0]
@.str.7 = [2 x i32] [i32 9608, i32 0]
@__const.draw_terminal_bcircle.bars = [8 x i8*] [i8* bitcast ([2 x i32]* @.str to i8*), i8* bitcast ([2 x i32]* @.str.1 to i8*), i8* bitcast ([2 x i32]* @.str.2 to i8*), i8* bitcast ([2 x i32]* @.str.3 to i8*), i8* bitcast ([2 x i32]* @.str.4 to i8*), i8* bitcast ([2 x i32]* @.str.5 to i8*), i8* bitcast ([2 x i32]* @.str.6 to i8*), i8* bitcast ([2 x i32]* @.str.7 to i8*)]
@LINES = global i32 0
@COLS = global i32 0
@.str.8 = [2 x i8] c" \00"
define i32 @draw_terminal_bcircle(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [8 x i8*]
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%18 = bitcast [8 x i8*]* %10 to i8*
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %31
21: ; preds = %4
%22 = load i32, i32* @LINES
%23 = load i32, i32* %7
%24 = icmp ne i32 %22, %23
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i32, i32* @COLS
%27 = load i32, i32* %8
%28 = icmp ne i32 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %25, %21
store i32 -1, i32* %5
br label %121
30: ; preds = %25
br label %31
31: ; preds = %30, %4
%32 = load i32*, i32** %9
%33 = getelementptr inbounds i32, i32* %32, i64 1
%34 = load i32, i32* %33
%35 = sdiv i32 %34, 10
%36 = sitofp i32 %35 to float
store float %36, float* %12
%37 = load i32*, i32** %9
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* %38
%40 = sdiv i32 %39, 15
%41 = sitofp i32 %40 to float
store float %41, float* %13
%42 = load i32, i32* @LINES
%43 = sdiv i32 %42, 2
%44 = sitofp i32 %43 to float
%45 = load float, float* %13
%46 = fdiv float %45, 2.000000e+00
%47 = fsub float %44, %46
%48 = fptosi float %47 to i32
store i32 %48, i32* %16
%49 = load i32, i32* @COLS
%50 = sdiv i32 %49, 2
%51 = sitofp i32 %50 to float
%52 = load float, float* %12
%53 = fdiv float %52, 2.000000e+00
%54 = fsub float %51, %53
%55 = fptosi float %54 to i32
store i32 %55, i32* %17
store i32 0, i32* %15
br label %56
56: ; preds = %73, %31
%57 = load i32, i32* %15
%58 = load i32, i32* @COLS
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %76
60: ; preds = %56
store i32 0, i32* %14
br label %61
61: ; preds = %69, %60
%62 = load i32, i32* %14
%63 = load i32, i32* @LINES
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %72
65: ; preds = %61
%66 = load i32, i32* %14
%67 = load i32, i32* %15
%68 = call i32 @mvaddstr(i32 %66, i32 %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %69
69: ; preds = %65
%70 = load i32, i32* %14
%71 = add nsw i32 %70, 1
store i32 %71, i32* %14
br label %61
72: ; preds = %61
br label %73
73: ; preds = %72
%74 = load i32, i32* %15
%75 = add nsw i32 %74, 1
store i32 %75, i32* %15
br label %56
76: ; preds = %56
store float 0.000000e+00, float* %11
br label %77
77: ; preds = %116, %76
%78 = load float, float* %11
%79 = fcmp olt float %78, 3.600000e+02
br i1 %79, label %80, label %119
80: ; preds = %77
%81 = load i32, i32* %17
%82 = sitofp i32 %81 to float
%83 = load float, float* %12
%84 = fadd float %82, %83
%85 = load float, float* %12
%86 = load float, float* %11
%87 = fpext float %86 to double
%88 = fmul double %87, 0x404CA73E597D6EC3
%89 = fptrunc double %88 to float
%90 = call float @cos(float %89)
%91 = fmul float %85, %90
%92 = fptosi float %91 to i32
%93 = sitofp i32 %92 to float
%94 = fadd float %84, %93
%95 = fptosi float %94 to i32
store i32 %95, i32* %15
%96 = load i32, i32* %16
%97 = sitofp i32 %96 to float
%98 = load float, float* %13
%99 = fadd float %97, %98
%100 = load float, float* %13
%101 = load float, float* %11
%102 = fpext float %101 to double
%103 = fmul double %102, 0x404CA73E597D6EC3
%104 = fptrunc double %103 to float
%105 = call float @sin(float %104)
%106 = fmul float %100, %105
%107 = fptosi float %106 to i32
%108 = sitofp i32 %107 to float
%109 = fadd float %99, %108
%110 = fptosi float %109 to i32
store i32 %110, i32* %14
%111 = load i32, i32* %14
%112 = load i32, i32* %15
%113 = getelementptr inbounds [8 x i8*], [8 x i8*]* %10, i64 0, i64 7
%114 = load i8*, i8** %113
%115 = call i32 @mvaddwstr(i32 %111, i32 %112, i8* %114)
br label %116
116: ; preds = %80
%117 = load float, float* %11
%118 = fadd float %117, 1.000000e+00
store float %118, float* %11
br label %77
119: ; preds = %77
%120 = call i32 (...) @refresh()
store i32 0, i32* %5
br label %121
121: ; preds = %119, %29
%122 = load i32, i32* %5
ret i32 %122
}

LLVM IR (-O2):
@.str.7 = [2 x i32] [i32 9608, i32 0]
@LINES = global i32 0
@COLS = global i32 0
@.str.8 = [2 x i8] c" \00"
define i32 @draw_terminal_bcircle(i32 %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = icmp eq i32 %0, 0
%6 = load i32, i32* @LINES
br i1 %5, label %7, label %9
7: ; preds = %4
%8 = load i32, i32* @COLS
br label %14
9: ; preds = %4
%10 = icmp eq i32 %6, %1
%11 = load i32, i32* @COLS
%12 = icmp eq i32 %11, %2
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %14, label %80
14: ; preds = %7, %9
%15 = phi i32 [ %8, %7 ], [ %2, %9 ]
%16 = phi i32 [ %6, %7 ], [ %1, %9 ]
%17 = getelementptr inbounds i32, i32* %3, i64 1
%18 = load i32, i32* %17
%19 = sdiv i32 %18, 10
%20 = sitofp i32 %19 to float
%21 = sdiv i32 %18, 15
%22 = sitofp i32 %21 to float
%23 = sdiv i32 %16, 2
%24 = sitofp i32 %23 to float
%25 = fmul float %22, 5.000000e-01
%26 = fsub float %24, %25
%27 = fptosi float %26 to i32
%28 = sdiv i32 %15, 2
%29 = sitofp i32 %28 to float
%30 = fmul float %20, 5.000000e-01
%31 = fsub float %29, %30
%32 = fptosi float %31 to i32
%33 = icmp sgt i32 %15, 0
br i1 %33, label %34, label %39
34: ; preds = %14, %52
%35 = phi i32 [ %53, %52 ], [ %15, %14 ]
%36 = phi i32 [ %54, %52 ], [ %16, %14 ]
%37 = phi i32 [ %55, %52 ], [ 0, %14 ]
%38 = icmp sgt i32 %36, 0
br i1 %38, label %44, label %52
39: ; preds = %52, %14
%40 = sitofp i32 %32 to float
%41 = fadd float %20, %40
%42 = sitofp i32 %27 to float
%43 = fadd float %22, %42
br label %57
44: ; preds = %34, %44
%45 = phi i32 [ %47, %44 ], [ 0, %34 ]
%46 = tail call i32 @mvaddstr(i32 %45, i32 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%47 = add nuw nsw i32 %45, 1
%48 = load i32, i32* @LINES
%49 = icmp slt i32 %47, %48
br i1 %49, label %44, label %50
50: ; preds = %44
%51 = load i32, i32* @COLS
br label %52
52: ; preds = %50, %34
%53 = phi i32 [ %51, %50 ], [ %35, %34 ]
%54 = phi i32 [ %48, %50 ], [ %36, %34 ]
%55 = add nuw nsw i32 %37, 1
%56 = icmp slt i32 %55, %53
br i1 %56, label %34, label %39
57: ; preds = %39, %57
%58 = phi i32 [ 0, %39 ], [ %76, %57 ]
%59 = sitofp i32 %58 to float
%60 = fpext float %59 to double
%61 = fmul double %60, 0x404CA73E597D6EC3
%62 = fptrunc double %61 to float
%63 = tail call float @cos(float %62)
%64 = fmul float %63, %20
%65 = fptosi float %64 to i32
%66 = sitofp i32 %65 to float
%67 = fadd float %41, %66
%68 = fptosi float %67 to i32
%69 = tail call float @sin(float %62)
%70 = fmul float %69, %22
%71 = fptosi float %70 to i32
%72 = sitofp i32 %71 to float
%73 = fadd float %43, %72
%74 = fptosi float %73 to i32
%75 = tail call i32 @mvaddwstr(i32 %74, i32 %68, i8* bitcast ([2 x i32]* @.str.7 to i8*))
%76 = add nuw nsw i32 %58, 1
%77 = icmp eq i32 %76, 360
br i1 %77, label %78, label %57
78: ; preds = %57
%79 = tail call i32 (...) @refresh()
br label %80
80: ; preds = %9, %78
%81 = phi i32 [ 0, %78 ], [ -1, %9 ]
ret i32 %81
}