#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 */
int /*<<< orphan*/ fillCircleHelper(short, short, short, int, short, short);
int /*<<< orphan*/ fillRect(short, short, short, short, short);
void fillRoundRect(short x, short y, short w, short h, short r, short color) {
  fillRect(x + r, y, w - 2 * r, h, color);
  fillCircleHelper(x + w - r - 1, y + r, r, 1, h - 2 * r - 1, color);
  fillCircleHelper(x + r, y + r, r, 2, h - 2 * r - 1, color);
}


x86 assembly (clang, -O0):
<fillRoundRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8d,-0x1c(%rbp)
mov    %ecx,%eax
mov    -0x1c(%rbp),%ecx
mov    %eax,-0x18(%rbp)
mov    %edx,%eax
mov    -0x18(%rbp),%edx
mov    %eax,-0x14(%rbp)
mov    %esi,%eax
mov    -0x14(%rbp),%esi
mov    %eax,-0x10(%rbp)
mov    %edi,%r8d
mov    -0x10(%rbp),%edi
mov    %r9w,%ax
mov    %r8w,-0x2(%rbp)
mov    %di,-0x4(%rbp)
mov    %si,-0x6(%rbp)
mov    %dx,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
movswl -0x2(%rbp),%eax
movswl -0xa(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%si
mov    -0x4(%rbp),%dx
movswl -0x6(%rbp),%eax
movswl -0xa(%rbp),%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%ax
movswl %si,%edi
movswl %dx,%esi
movswl %cx,%edx
movswl %ax,%ecx
movswl -0xc(%rbp),%r8d
call   1040 <fillRect@plt>
movswl -0x2(%rbp),%eax
movswl -0x6(%rbp),%ecx
add    %ecx,%eax
movswl -0xa(%rbp),%ecx
sub    %ecx,%eax
sub    $0x1,%eax
mov    %ax,%di
movswl -0x4(%rbp),%eax
movswl -0xa(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%si
mov    -0xa(%rbp),%dx
movswl -0x8(%rbp),%eax
movswl -0xa(%rbp),%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
sub    $0x1,%eax
mov    $0x1,%ecx
movswl %di,%edi
movswl %si,%esi
movswl %dx,%edx
movswl %ax,%r8d
movswl -0xc(%rbp),%r9d
call   1030 <fillCircleHelper@plt>
movswl -0x2(%rbp),%eax
movswl -0xa(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%di
movswl -0x4(%rbp),%eax
movswl -0xa(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%si
mov    -0xa(%rbp),%dx
movswl -0x8(%rbp),%eax
movswl -0xa(%rbp),%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
sub    $0x1,%eax
mov    $0x2,%ecx
movswl %di,%edi
movswl %si,%esi
movswl %dx,%edx
movswl %ax,%r8d
movswl -0xc(%rbp),%r9d
call   1030 <fillCircleHelper@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillRoundRect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,(%rsp)
mov    %r8d,%ebx
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %esi,%r13d
mov    %edi,%r14d
lea    (%rbx,%r14,1),%eax
lea    (%rbx,%rbx,1),%r15d
mov    %edx,%ecx
sub    %r15d,%ecx
movswl %ax,%edi
mov    %edi,0x4(%rsp)
movswl %cx,%edx
mov    %r12d,%ecx
mov    %r9d,%r8d
call   1040 <fillRect@plt>
add    %r14d,%ebp
mov    %ebx,%eax
not    %eax
add    %ebp,%eax
add    %ebx,%r13d
not    %r15d
add    %r12d,%r15d
movswl %r13w,%r14d
movswl %ax,%edi
movswl %r15w,%r15d
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
mov    %r15d,%r8d
mov    (%rsp),%ebp
mov    %ebp,%r9d
call   1030 <fillCircleHelper@plt>
mov    0x4(%rsp),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0x2,%ecx
mov    %r15d,%r8d
mov    %ebp,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fillCircleHelper@plt>

LLVM IR (-O0):
define void @fillRoundRect(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i16 signext %4, i16 signext %5) {
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
%10 = alloca i16
%11 = alloca i16
%12 = alloca i16
store i16 %0, i16* %7
store i16 %1, i16* %8
store i16 %2, i16* %9
store i16 %3, i16* %10
store i16 %4, i16* %11
store i16 %5, i16* %12
%13 = load i16, i16* %7
%14 = sext i16 %13 to i32
%15 = load i16, i16* %11
%16 = sext i16 %15 to i32
%17 = add nsw i32 %14, %16
%18 = trunc i32 %17 to i16
%19 = load i16, i16* %8
%20 = load i16, i16* %9
%21 = sext i16 %20 to i32
%22 = load i16, i16* %11
%23 = sext i16 %22 to i32
%24 = mul nsw i32 2, %23
%25 = sub nsw i32 %21, %24
%26 = trunc i32 %25 to i16
%27 = load i16, i16* %10
%28 = load i16, i16* %12
%29 = call i32 @fillRect(i16 signext %18, i16 signext %19, i16 signext %26, i16 signext %27, i16 signext %28)
%30 = load i16, i16* %7
%31 = sext i16 %30 to i32
%32 = load i16, i16* %9
%33 = sext i16 %32 to i32
%34 = add nsw i32 %31, %33
%35 = load i16, i16* %11
%36 = sext i16 %35 to i32
%37 = sub nsw i32 %34, %36
%38 = sub nsw i32 %37, 1
%39 = trunc i32 %38 to i16
%40 = load i16, i16* %8
%41 = sext i16 %40 to i32
%42 = load i16, i16* %11
%43 = sext i16 %42 to i32
%44 = add nsw i32 %41, %43
%45 = trunc i32 %44 to i16
%46 = load i16, i16* %11
%47 = load i16, i16* %10
%48 = sext i16 %47 to i32
%49 = load i16, i16* %11
%50 = sext i16 %49 to i32
%51 = mul nsw i32 2, %50
%52 = sub nsw i32 %48, %51
%53 = sub nsw i32 %52, 1
%54 = trunc i32 %53 to i16
%55 = load i16, i16* %12
%56 = call i32 @fillCircleHelper(i16 signext %39, i16 signext %45, i16 signext %46, i32 1, i16 signext %54, i16 signext %55)
%57 = load i16, i16* %7
%58 = sext i16 %57 to i32
%59 = load i16, i16* %11
%60 = sext i16 %59 to i32
%61 = add nsw i32 %58, %60
%62 = trunc i32 %61 to i16
%63 = load i16, i16* %8
%64 = sext i16 %63 to i32
%65 = load i16, i16* %11
%66 = sext i16 %65 to i32
%67 = add nsw i32 %64, %66
%68 = trunc i32 %67 to i16
%69 = load i16, i16* %11
%70 = load i16, i16* %10
%71 = sext i16 %70 to i32
%72 = load i16, i16* %11
%73 = sext i16 %72 to i32
%74 = mul nsw i32 2, %73
%75 = sub nsw i32 %71, %74
%76 = sub nsw i32 %75, 1
%77 = trunc i32 %76 to i16
%78 = load i16, i16* %12
%79 = call i32 @fillCircleHelper(i16 signext %62, i16 signext %68, i16 signext %69, i32 2, i16 signext %77, i16 signext %78)
ret void
}

LLVM IR (-O2):
define void @fillRoundRect(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i16 signext %4, i16 signext %5) {
%7 = add i16 %4, %0
%8 = shl i16 %4, 1
%9 = sub i16 %2, %8
%10 = tail call i32 @fillRect(i16 signext %7, i16 signext %1, i16 signext %9, i16 signext %3, i16 signext %5)
%11 = add i16 %2, %0
%12 = xor i16 %4, -1
%13 = add i16 %11, %12
%14 = add i16 %4, %1
%15 = xor i16 %8, -1
%16 = add i16 %15, %3
%17 = tail call i32 @fillCircleHelper(i16 signext %13, i16 signext %14, i16 signext %4, i32 1, i16 signext %16, i16 signext %5)
%18 = tail call i32 @fillCircleHelper(i16 signext %7, i16 signext %14, i16 signext %4, i32 2, i16 signext %16, i16 signext %5)
ret void
}