#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 */

/* Variables and functions */
scalar_t__ ceilf(int const);
int /*<<< orphan*/ draw_mp_circle(unsigned char *, int const, int const,
                                  int const, int const, int const, char);
scalar_t__ floorf(float);
void draw_bullseye(unsigned char *pixelbuf, const int image_width,
                   const int image_height, const int hex_width,
                   const int hex_height, const int hx_start, const int hx_end,
                   const int hex_image_height, const int xoffset,
                   const int yoffset, const float scaler) {
  const int x = (int)floorf(14.5f * hex_width - hx_start + xoffset * scaler);
  const int y = (int)ceilf(hex_image_height / 2 + yoffset * scaler);
  const int r1 = (int)ceilf(hex_height / 2.0f);
  int r_incr = ((hex_width * 9 - r1) / 5) / 2;
  if (r_incr > hx_end) {
    r_incr -= hx_end;
  }
  draw_mp_circle(pixelbuf, image_width, image_height, x, y, r1 + r_incr * 5,
                 '1');
  draw_mp_circle(pixelbuf, image_width, image_height, x, y, r1 + r_incr * 4,
                 '0');
  draw_mp_circle(pixelbuf, image_width, image_height, x, y, r1 + r_incr * 3,
                 '1');
  draw_mp_circle(pixelbuf, image_width, image_height, x, y, r1 + r_incr * 2,
                 '0');
  draw_mp_circle(pixelbuf, image_width, image_height, x, y, r1 + r_incr, '1');
  draw_mp_circle(pixelbuf, image_width, image_height, x, y, r1, '0');
}


x86 assembly (clang, -O0):
<draw_bullseye>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
movss  %xmm0,-0x20(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm1
cvtsi2ssl -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe87(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
cvtsi2ssl 0x20(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <floorf@plt>
mov    %eax,-0x24(%rbp)
mov    0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
cvtsi2ssl 0x28(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1050 <ceilf@plt>
mov    %eax,-0x28(%rbp)
cvtsi2ssl -0x18(%rbp),%xmm0
movss  0xe27(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1050 <ceilf@plt>
mov    %eax,-0x2c(%rbp)
imul   $0x9,-0x14(%rbp),%eax
sub    -0x2c(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jle    121a <draw_bullseye+0xea>
mov    0x10(%rbp),%ecx
mov    -0x30(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
imul   $0x5,-0x30(%rbp),%eax
add    %eax,%r9d
movl   $0x31,(%rsp)
call   1040 <draw_mp_circle@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%eax
shl    $0x2,%eax
add    %eax,%r9d
movl   $0x30,(%rsp)
call   1040 <draw_mp_circle@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
imul   $0x3,-0x30(%rbp),%eax
add    %eax,%r9d
movl   $0x31,(%rsp)
call   1040 <draw_mp_circle@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%eax
shl    $0x1,%eax
add    %eax,%r9d
movl   $0x30,(%rsp)
call   1040 <draw_mp_circle@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
add    -0x30(%rbp),%r9d
movl   $0x31,(%rsp)
call   1040 <draw_mp_circle@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
movl   $0x30,(%rsp)
call   1040 <draw_mp_circle@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_bullseye>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%r14d
cvtsi2ss %ecx,%xmm1
cvtsi2ss %r9d,%xmm2
movaps %xmm0,%xmm3
movss  %xmm0,0x8(%rsp)
mov    %r8d,%ebp
mov    %edx,0x1c(%rsp)
mov    %esi,%r15d
mov    %rdi,%r12
mulss  0xe98(%rip),%xmm1
subss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssl 0x70(%rsp),%xmm0
mov    0x60(%rsp),%r13d
mov    0x68(%rsp),%ebx
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
call   1030 <floorf@plt>
mov    %ebx,%ecx
shr    $0x1f,%ecx
add    %ebx,%ecx
sar    %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
mov    %rax,%rbx
xorps  %xmm1,%xmm1
cvtsi2ssl 0x78(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
cvttss2si %xmm1,%edi
call   1050 <ceilf@plt>
mov    %rax,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
mulss  0xe36(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1050 <ceilf@plt>
lea    (%r14,%r14,8),%ecx
sub    %eax,%ecx
mov    %rax,%rdx
mov    %rax,0x8(%rsp)
movslq %ecx,%rax
imul   $0x66666667,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
sar    $0x22,%r14
add    %eax,%r14d
xor    %eax,%eax
cmp    %r13d,%r14d
cmovg  %r13d,%eax
sub    %eax,%r14d
lea    (%r14,%r14,4),%r9d
add    %edx,%r9d
movl   $0x31,(%rsp)
mov    %r12,%r13
mov    %r12,%rdi
mov    %r15d,%r12d
mov    %r15d,%esi
mov    0x1c(%rsp),%r15d
mov    %r15d,%edx
mov    %rbx,0x20(%rsp)
mov    %ebx,%ecx
mov    0x10(%rsp),%rbp
mov    %ebp,%r8d
call   1040 <draw_mp_circle@plt>
mov    0x8(%rsp),%rax
lea    (%rax,%r14,4),%r9d
movl   $0x30,(%rsp)
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
call   1040 <draw_mp_circle@plt>
lea    (%r14,%r14,2),%r9d
mov    0x8(%rsp),%rbx
add    %ebx,%r9d
movl   $0x31,(%rsp)
mov    %r13,%rdi
mov    %r12d,%ebp
mov    %r12d,%esi
mov    %r15d,%edx
mov    0x20(%rsp),%r12
mov    %r12d,%ecx
mov    0x10(%rsp),%r8
call   1040 <draw_mp_circle@plt>
lea    (%rbx,%r14,2),%r9d
movl   $0x30,(%rsp)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %r12,%rbx
mov    %ebx,%ecx
mov    0x10(%rsp),%r12
mov    %r12d,%r8d
call   1040 <draw_mp_circle@plt>
add    0x8(%rsp),%r14d
movl   $0x31,(%rsp)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1040 <draw_mp_circle@plt>
movl   $0x30,(%rsp)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r12d,%r8d
mov    0x8(%rsp),%r9
call   1040 <draw_mp_circle@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @draw_bullseye(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, float %10) {
%12 = alloca i8*
%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 float
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i8* %0, i8** %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32 %3, i32* %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store float %10, float* %22
%27 = load i32, i32* %15
%28 = sitofp i32 %27 to float
%29 = load i32, i32* %17
%30 = sitofp i32 %29 to float
%31 = fneg float %30
%32 = call float @llvm.fmuladd.f32(float 1.450000e+01, float %28, float %31)
%33 = load i32, i32* %20
%34 = sitofp i32 %33 to float
%35 = load float, float* %22
%36 = call float @llvm.fmuladd.f32(float %34, float %35, float %32)
%37 = call i64 @floorf(float %36)
%38 = trunc i64 %37 to i32
store i32 %38, i32* %23
%39 = load i32, i32* %19
%40 = sdiv i32 %39, 2
%41 = sitofp i32 %40 to float
%42 = load i32, i32* %21
%43 = sitofp i32 %42 to float
%44 = load float, float* %22
%45 = call float @llvm.fmuladd.f32(float %43, float %44, float %41)
%46 = fptosi float %45 to i32
%47 = call i64 @ceilf(i32 %46)
%48 = trunc i64 %47 to i32
store i32 %48, i32* %24
%49 = load i32, i32* %16
%50 = sitofp i32 %49 to float
%51 = fdiv float %50, 2.000000e+00
%52 = fptosi float %51 to i32
%53 = call i64 @ceilf(i32 %52)
%54 = trunc i64 %53 to i32
store i32 %54, i32* %25
%55 = load i32, i32* %15
%56 = mul nsw i32 %55, 9
%57 = load i32, i32* %25
%58 = sub nsw i32 %56, %57
%59 = sdiv i32 %58, 5
%60 = sdiv i32 %59, 2
store i32 %60, i32* %26
%61 = load i32, i32* %26
%62 = load i32, i32* %18
%63 = icmp sgt i32 %61, %62
br i1 %63, label %64, label %68
64: ; preds = %11
%65 = load i32, i32* %18
%66 = load i32, i32* %26
%67 = sub nsw i32 %66, %65
store i32 %67, i32* %26
br label %68
68: ; preds = %64, %11
%69 = load i8*, i8** %12
%70 = load i32, i32* %13
%71 = load i32, i32* %14
%72 = load i32, i32* %23
%73 = load i32, i32* %24
%74 = load i32, i32* %25
%75 = load i32, i32* %26
%76 = mul nsw i32 %75, 5
%77 = add nsw i32 %74, %76
%78 = call i32 @draw_mp_circle(i8* %69, i32 %70, i32 %71, i32 %72, i32 %73, i32 %77, i8 signext 49)
%79 = load i8*, i8** %12
%80 = load i32, i32* %13
%81 = load i32, i32* %14
%82 = load i32, i32* %23
%83 = load i32, i32* %24
%84 = load i32, i32* %25
%85 = load i32, i32* %26
%86 = mul nsw i32 %85, 4
%87 = add nsw i32 %84, %86
%88 = call i32 @draw_mp_circle(i8* %79, i32 %80, i32 %81, i32 %82, i32 %83, i32 %87, i8 signext 48)
%89 = load i8*, i8** %12
%90 = load i32, i32* %13
%91 = load i32, i32* %14
%92 = load i32, i32* %23
%93 = load i32, i32* %24
%94 = load i32, i32* %25
%95 = load i32, i32* %26
%96 = mul nsw i32 %95, 3
%97 = add nsw i32 %94, %96
%98 = call i32 @draw_mp_circle(i8* %89, i32 %90, i32 %91, i32 %92, i32 %93, i32 %97, i8 signext 49)
%99 = load i8*, i8** %12
%100 = load i32, i32* %13
%101 = load i32, i32* %14
%102 = load i32, i32* %23
%103 = load i32, i32* %24
%104 = load i32, i32* %25
%105 = load i32, i32* %26
%106 = mul nsw i32 %105, 2
%107 = add nsw i32 %104, %106
%108 = call i32 @draw_mp_circle(i8* %99, i32 %100, i32 %101, i32 %102, i32 %103, i32 %107, i8 signext 48)
%109 = load i8*, i8** %12
%110 = load i32, i32* %13
%111 = load i32, i32* %14
%112 = load i32, i32* %23
%113 = load i32, i32* %24
%114 = load i32, i32* %25
%115 = load i32, i32* %26
%116 = add nsw i32 %114, %115
%117 = call i32 @draw_mp_circle(i8* %109, i32 %110, i32 %111, i32 %112, i32 %113, i32 %116, i8 signext 49)
%118 = load i8*, i8** %12
%119 = load i32, i32* %13
%120 = load i32, i32* %14
%121 = load i32, i32* %23
%122 = load i32, i32* %24
%123 = load i32, i32* %25
%124 = call i32 @draw_mp_circle(i8* %118, i32 %119, i32 %120, i32 %121, i32 %122, i32 %123, i8 signext 48)
ret void
}

LLVM IR (-O2):
define void @draw_bullseye(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, float %10) {
%12 = sitofp i32 %3 to float
%13 = sitofp i32 %5 to float
%14 = fneg float %13
%15 = tail call float @llvm.fmuladd.f32(float %12, float 1.450000e+01, float %14)
%16 = sitofp i32 %8 to float
%17 = tail call float @llvm.fmuladd.f32(float %16, float %10, float %15)
%18 = tail call i64 @floorf(float %17)
%19 = trunc i64 %18 to i32
%20 = sdiv i32 %7, 2
%21 = sitofp i32 %20 to float
%22 = sitofp i32 %9 to float
%23 = tail call float @llvm.fmuladd.f32(float %22, float %10, float %21)
%24 = fptosi float %23 to i32
%25 = tail call i64 @ceilf(i32 %24)
%26 = trunc i64 %25 to i32
%27 = sitofp i32 %4 to float
%28 = fmul float %27, 5.000000e-01
%29 = fptosi float %28 to i32
%30 = tail call i64 @ceilf(i32 %29)
%31 = trunc i64 %30 to i32
%32 = mul nsw i32 %3, 9
%33 = sub nsw i32 %32, %31
%34 = sdiv i32 %33, 10
%35 = icmp sgt i32 %34, %6
%36 = select i1 %35, i32 %6, i32 0
%37 = sub nsw i32 %34, %36
%38 = mul nsw i32 %37, 5
%39 = add nsw i32 %38, %31
%40 = tail call i32 @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %19, i32 %26, i32 %39, i8 signext 49)
%41 = shl nsw i32 %37, 2
%42 = add nsw i32 %41, %31
%43 = tail call i32 @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %19, i32 %26, i32 %42, i8 signext 48)
%44 = mul nsw i32 %37, 3
%45 = add nsw i32 %44, %31
%46 = tail call i32 @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %19, i32 %26, i32 %45, i8 signext 49)
%47 = shl nsw i32 %37, 1
%48 = add nsw i32 %47, %31
%49 = tail call i32 @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %19, i32 %26, i32 %48, i8 signext 48)
%50 = add nsw i32 %37, %31
%51 = tail call i32 @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %19, i32 %26, i32 %50, i8 signext 49)
%52 = tail call i32 @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %19, i32 %26, i32 %31, i8 signext 48)
ret void
}