#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*/ bmp_draw_rect_chamfer(int, int, int, int, int, int,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ bmp_fill(int, int, int, int, int);
void round_box(int c, int x, int y, int w, int h) {
  bmp_draw_rect_chamfer(c, x - 1, y - 1, w + 2, h + 2, 2, 0);
  bmp_draw_rect_chamfer(c, x, y, w, h, 1, 0);
  if (w >= 4)
    bmp_fill(c, x + 1, y + 1, w - 1, h - 1);
}


x86 assembly (clang, -O0):
<round_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    -0x10(%rbp),%ecx
add    $0x2,%ecx
mov    -0x14(%rbp),%r8d
add    $0x2,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1040 <bmp_draw_rect_chamfer@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    $0x1,%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1040 <bmp_draw_rect_chamfer@plt>
cmpl   $0x4,-0x10(%rbp)
jl     11b9 <round_box+0x99>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x14(%rbp),%r8d
sub    $0x1,%r8d
call   1030 <bmp_fill@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_box>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8d,%r14d
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%r12d
mov    %edi,%ebp
lea    -0x1(%r12),%esi
lea    -0x1(%r15),%edx
lea    0x2(%rbx),%ecx
lea    0x2(%r14),%r8d
movl   $0x0,(%rsp)
mov    $0x2,%r9d
call   1040 <bmp_draw_rect_chamfer@plt>
movl   $0x0,(%rsp)
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    $0x1,%r9d
call   1040 <bmp_draw_rect_chamfer@plt>
cmp    $0x4,%ebx
jl     11ac <round_box+0x8c>
add    $0x1,%r12d
add    $0x1,%r15d
add    $0xffffffff,%ebx
add    $0xffffffff,%r14d
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <bmp_fill@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @round_box(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = sub nsw i32 %12, 1
%14 = load i32, i32* %8
%15 = sub nsw i32 %14, 1
%16 = load i32, i32* %9
%17 = add nsw i32 %16, 2
%18 = load i32, i32* %10
%19 = add nsw i32 %18, 2
%20 = call i32 @bmp_draw_rect_chamfer(i32 %11, i32 %13, i32 %15, i32 %17, i32 %19, i32 2, i32 0)
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load i32, i32* %9
%25 = load i32, i32* %10
%26 = call i32 @bmp_draw_rect_chamfer(i32 %21, i32 %22, i32 %23, i32 %24, i32 %25, i32 1, i32 0)
%27 = load i32, i32* %9
%28 = icmp sge i32 %27, 4
br i1 %28, label %29, label %40
29: ; preds = %5
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
%35 = load i32, i32* %9
%36 = sub nsw i32 %35, 1
%37 = load i32, i32* %10
%38 = sub nsw i32 %37, 1
%39 = call i32 @bmp_fill(i32 %30, i32 %32, i32 %34, i32 %36, i32 %38)
br label %40
40: ; preds = %29, %5
ret void
}

LLVM IR (-O2):
define void @round_box(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %1, -1
%7 = add nsw i32 %2, -1
%8 = add nsw i32 %3, 2
%9 = add nsw i32 %4, 2
%10 = tail call i32 @bmp_draw_rect_chamfer(i32 %0, i32 %6, i32 %7, i32 %8, i32 %9, i32 2, i32 0)
%11 = tail call i32 @bmp_draw_rect_chamfer(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 1, i32 0)
%12 = icmp sgt i32 %3, 3
br i1 %12, label %13, label %19
13: ; preds = %5
%14 = add nsw i32 %1, 1
%15 = add nsw i32 %2, 1
%16 = add nsw i32 %3, -1
%17 = add nsw i32 %4, -1
%18 = tail call i32 @bmp_fill(i32 %0, i32 %14, i32 %15, i32 %16, i32 %17)
br label %19
19: ; preds = %13, %5
ret void
}