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

/* Type definitions */
typedef int /*<<< orphan*/ xcb_window_t;
typedef int /*<<< orphan*/ xcb_void_cookie_t;
typedef int /*<<< orphan*/ xcb_screen_t;
struct TYPE_3__ {
  int x;
  int y;
};
typedef TYPE_1__ xcb_point_t;
typedef int /*<<< orphan*/ xcb_gcontext_t;
typedef int /*<<< orphan*/ xcb_connection_t;
typedef int uint8_t;
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ XCB_COORD_MODE_ORIGIN;
int /*<<< orphan*/ getFontGC(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/, char *);
int strlen(char const *);
int /*<<< orphan*/ testCookie(int /*<<< orphan*/, int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ xcb_free_gc(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ xcb_image_text_8_checked(int /*<<< orphan*/ *, int,
                                            int /*<<< orphan*/,
                                            int /*<<< orphan*/, int, int,
                                            char const *);
int /*<<< orphan*/ xcb_poly_line_checked(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/, int, TYPE_1__ *);
void drawButton(xcb_connection_t *connection, xcb_screen_t *screen,
                xcb_window_t window, int16_t x1, int16_t y1,
                const char *label) {
  uint8_t length = strlen(label);
  int16_t inset = 2;
  int16_t width = 7 * length + 2 * (inset + 1);
  int16_t height = 13 + 2 * (inset + 1);
  xcb_point_t points[5];
  points[0].x = x1;
  points[0].y = y1;
  points[1].x = x1 + width;
  points[1].y = y1;
  points[2].x = x1 + width;
  points[2].y = y1 - height;
  points[3].x = x1;
  points[3].y = y1 - height;
  points[4].x = x1;
  points[4].y = y1;
  xcb_gcontext_t gc = getFontGC(connection, screen, window, "fixed");
  xcb_void_cookie_t lineCookie = xcb_poly_line_checked(
      connection, XCB_COORD_MODE_ORIGIN, window, gc, 5, points);
  testCookie(lineCookie, connection, "can't draw lines");
  xcb_void_cookie_t textCookie = xcb_image_text_8_checked(
      connection, length, window, gc, x1 + inset + 1, y1 - inset - 1, label);
  testCookie(textCookie, connection, "can't paste text");
  xcb_void_cookie_t gcCookie = xcb_free_gc(connection, gc);
  testCookie(gcCookie, connection, "can't free gc");
}


x86 assembly (clang, -O0):
<drawButton>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
imul   $0x7,-0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
shl    $0x1,%eax
add    $0xd,%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x38(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xdf1(%rip),%rcx
call   1080 <getFontGC@plt>
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
mov    -0x64(%rbp),%ecx
lea    -0x60(%rbp),%r9
mov    $0x5,%r8d
call   1070 <xcb_poly_line_checked@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%edi
mov    -0x8(%rbp),%rsi
lea    0xdbc(%rip),%rdx
call   1060 <testCookie@plt>
mov    -0x8(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x64(%rbp),%ecx
mov    -0x18(%rbp),%r8d
add    -0x30(%rbp),%r8d
add    $0x1,%r8d
mov    -0x1c(%rbp),%r9d
sub    -0x30(%rbp),%r9d
sub    $0x1,%r9d
mov    -0x28(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <xcb_image_text_8_checked@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x8(%rbp),%rsi
lea    0xd85(%rip),%rdx
call   1060 <testCookie@plt>
mov    -0x8(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1050 <xcb_free_gc@plt>
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%edi
mov    -0x8(%rbp),%rsi
lea    0xd74(%rip),%rdx
call   1060 <testCookie@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawButton>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x40(%rsp)
mov    %r8d,%r15d
mov    %ecx,%ebx
mov    %edx,%r13d
mov    %rsi,%r12
mov    %rdi,%r14
mov    %r9,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
lea    0x0(,%rbp,8),%eax
sub    %ebp,%eax
mov    %ebx,0x10(%rsp)
mov    %r15d,0x14(%rsp)
add    %ebx,%eax
add    $0x6,%eax
mov    %eax,0x18(%rsp)
mov    %r15d,0x1c(%rsp)
mov    %eax,0x20(%rsp)
lea    -0x13(%r15),%eax
mov    %eax,0x24(%rsp)
mov    %ebx,0x28(%rsp)
mov    %eax,0x2c(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r15d,0x34(%rsp)
lea    0xe31(%rip),%rcx
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1080 <getFontGC@plt>
mov    %eax,%r12d
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%r9
mov    %r14,%rdi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    $0x5,%r8d
call   1070 <xcb_poly_line_checked@plt>
lea    0xdfd(%rip),%rdx
mov    %eax,%edi
mov    %r14,%rsi
call   1060 <testCookie@plt>
add    $0x3,%ebx
add    $0xfffffffd,%r15d
mov    0x40(%rsp),%rax
mov    %rax,(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %ebx,%r8d
mov    %r15d,%r9d
call   1030 <xcb_image_text_8_checked@plt>
lea    0xdd7(%rip),%rdx
mov    %eax,%edi
mov    %r14,%rsi
call   1060 <testCookie@plt>
mov    %r14,%rdi
mov    %r12d,%esi
call   1050 <xcb_free_gc@plt>
lea    0xdcc(%rip),%rdx
mov    %eax,%edi
mov    %r14,%rsi
call   1060 <testCookie@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@.str = [6 x i8] c"fixed\00"
@XCB_COORD_MODE_ORIGIN = global i32 0
@.str.1 = [17 x i8] c"can't draw lines\00"
@.str.2 = [17 x i8] c"can't paste text\00"
@.str.3 = [14 x i8] c"can't free gc\00"
define void @drawButton(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [5 x %struct.TYPE_3__]
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%22 = load i8*, i8** %12
%23 = call i32 @strlen(i8* %22)
store i32 %23, i32* %13
store i32 2, i32* %14
%24 = load i32, i32* %13
%25 = mul nsw i32 7, %24
%26 = load i32, i32* %14
%27 = add nsw i32 %26, 1
%28 = mul nsw i32 2, %27
%29 = add nsw i32 %25, %28
store i32 %29, i32* %15
%30 = load i32, i32* %14
%31 = add nsw i32 %30, 1
%32 = mul nsw i32 2, %31
%33 = add nsw i32 13, %32
store i32 %33, i32* %16
%34 = load i32, i32* %10
%35 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 0
%36 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %35, i32 0, i32 0
store i32 %34, i32* %36
%37 = load i32, i32* %11
%38 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 0
%39 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %38, i32 0, i32 1
store i32 %37, i32* %39
%40 = load i32, i32* %10
%41 = load i32, i32* %15
%42 = add nsw i32 %40, %41
%43 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 1
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %43, i32 0, i32 0
store i32 %42, i32* %44
%45 = load i32, i32* %11
%46 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 1
%47 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %46, i32 0, i32 1
store i32 %45, i32* %47
%48 = load i32, i32* %10
%49 = load i32, i32* %15
%50 = add nsw i32 %48, %49
%51 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 2
%52 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %51, i32 0, i32 0
store i32 %50, i32* %52
%53 = load i32, i32* %11
%54 = load i32, i32* %16
%55 = sub nsw i32 %53, %54
%56 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 2
%57 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %56, i32 0, i32 1
store i32 %55, i32* %57
%58 = load i32, i32* %10
%59 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 3
%60 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %59, i32 0, i32 0
store i32 %58, i32* %60
%61 = load i32, i32* %11
%62 = load i32, i32* %16
%63 = sub nsw i32 %61, %62
%64 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 3
%65 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %64, i32 0, i32 1
store i32 %63, i32* %65
%66 = load i32, i32* %10
%67 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 4
%68 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %67, i32 0, i32 0
store i32 %66, i32* %68
%69 = load i32, i32* %11
%70 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 4
%71 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %70, i32 0, i32 1
store i32 %69, i32* %71
%72 = load i32*, i32** %7
%73 = load i32*, i32** %8
%74 = load i32, i32* %9
%75 = call i32 @getFontGC(i32* %72, i32* %73, i32 %74, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %75, i32* %18
%76 = load i32*, i32** %7
%77 = load i32, i32* @XCB_COORD_MODE_ORIGIN
%78 = load i32, i32* %9
%79 = load i32, i32* %18
%80 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %17, i64 0, i64 0
%81 = call i32 @xcb_poly_line_checked(i32* %76, i32 %77, i32 %78, i32 %79, i32 5, %struct.TYPE_3__* %80)
store i32 %81, i32* %19
%82 = load i32, i32* %19
%83 = load i32*, i32** %7
%84 = call i32 @testCookie(i32 %82, i32* %83, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%85 = load i32*, i32** %7
%86 = load i32, i32* %13
%87 = load i32, i32* %9
%88 = load i32, i32* %18
%89 = load i32, i32* %10
%90 = load i32, i32* %14
%91 = add nsw i32 %89, %90
%92 = add nsw i32 %91, 1
%93 = load i32, i32* %11
%94 = load i32, i32* %14
%95 = sub nsw i32 %93, %94
%96 = sub nsw i32 %95, 1
%97 = load i8*, i8** %12
%98 = call i32 @xcb_image_text_8_checked(i32* %85, i32 %86, i32 %87, i32 %88, i32 %92, i32 %96, i8* %97)
store i32 %98, i32* %20
%99 = load i32, i32* %20
%100 = load i32*, i32** %7
%101 = call i32 @testCookie(i32 %99, i32* %100, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%102 = load i32*, i32** %7
%103 = load i32, i32* %18
%104 = call i32 @xcb_free_gc(i32* %102, i32 %103)
store i32 %104, i32* %21
%105 = load i32, i32* %21
%106 = load i32*, i32** %7
%107 = call i32 @testCookie(i32 %105, i32* %106, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@.str = [6 x i8] c"fixed\00"
@XCB_COORD_MODE_ORIGIN = global i32 0
@.str.1 = [17 x i8] c"can't draw lines\00"
@.str.2 = [17 x i8] c"can't paste text\00"
@.str.3 = [14 x i8] c"can't free gc\00"
define void @drawButton(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca [5 x %struct.TYPE_3__]
%8 = tail call i32 @strlen(i8* %5)
%9 = mul nsw i32 %8, 7
%10 = bitcast [5 x %struct.TYPE_3__]* %7 to i8*
%11 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 0
%12 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 0, i32 0
store i32 %3, i32* %12
%13 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 0, i32 1
store i32 %4, i32* %13
%14 = add i32 %3, 6
%15 = add i32 %14, %9
%16 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 1, i32 0
store i32 %15, i32* %16
%17 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 1, i32 1
store i32 %4, i32* %17
%18 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 2, i32 0
store i32 %15, i32* %18
%19 = add nsw i32 %4, -19
%20 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 2, i32 1
store i32 %19, i32* %20
%21 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 3, i32 0
store i32 %3, i32* %21
%22 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 3, i32 1
store i32 %19, i32* %22
%23 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 4, i32 0
store i32 %3, i32* %23
%24 = getelementptr inbounds [5 x %struct.TYPE_3__], [5 x %struct.TYPE_3__]* %7, i64 0, i64 4, i32 1
store i32 %4, i32* %24
%25 = tail call i32 @getFontGC(i32* %0, i32* %1, i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%26 = load i32, i32* @XCB_COORD_MODE_ORIGIN
%27 = call i32 @xcb_poly_line_checked(i32* %0, i32 %26, i32 %2, i32 %25, i32 5, %struct.TYPE_3__* %11)
%28 = call i32 @testCookie(i32 %27, i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%29 = add nsw i32 %3, 3
%30 = add nsw i32 %4, -3
%31 = call i32 @xcb_image_text_8_checked(i32* %0, i32 %8, i32 %2, i32 %25, i32 %29, i32 %30, i8* %5)
%32 = call i32 @testCookie(i32 %31, i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 @xcb_free_gc(i32* %0, i32 %25)
%34 = call i32 @testCookie(i32 %33, i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret void
}