#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*/ sendCmd(int, char *, ...);
void sketchTextCentred(int fd, char const *text, int x, int y, int centreX,
                       int centreY) {
  if (centreX && centreY) {
    sendCmd(fd, "text c c \"%s\"\n", text);
  } else if (centreX) {
    sendCmd(fd, "text c %i \"%s\"\n", y, text);
  } else if (centreY) {
    sendCmd(fd, "text %i c \"%s\"\n", x, text);
  } else {
    sendCmd(fd, "text %i %i \"%s\"\n", x, y, text);
  }
}


x86 assembly (clang, -O0):
<sketchTextCentred>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     115b <sketchTextCentred+0x4b>
cmpl   $0x0,-0x20(%rbp)
je     115b <sketchTextCentred+0x4b>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <sendCmd@plt>
jmp    11ce <sketchTextCentred+0xbe>
cmpl   $0x0,-0x1c(%rbp)
je     1182 <sketchTextCentred+0x72>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1030 <sendCmd@plt>
jmp    11c9 <sketchTextCentred+0xb9>
cmpl   $0x0,-0x20(%rbp)
je     11a9 <sketchTextCentred+0x99>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1030 <sendCmd@plt>
jmp    11c4 <sketchTextCentred+0xb4>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%r8
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1030 <sendCmd@plt>
jmp    11c9 <sketchTextCentred+0xb9>
jmp    11ce <sketchTextCentred+0xbe>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sketchTextCentred>:
mov    %rsi,%rax
test   %r8d,%r8d
je     112e <sketchTextCentred+0x1e>
test   %r9d,%r9d
je     112e <sketchTextCentred+0x1e>
lea    0xedc(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
jmp    1030 <sendCmd@plt>
test   %r8d,%r8d
je     113e <sketchTextCentred+0x2e>
lea    0xed5(%rip),%rsi
mov    %ecx,%edx
jmp    114a <sketchTextCentred+0x3a>
test   %r9d,%r9d
je     1154 <sketchTextCentred+0x44>
lea    0xed5(%rip),%rsi
mov    %rax,%rcx
xor    %eax,%eax
jmp    1030 <sendCmd@plt>
lea    0xed4(%rip),%rsi
mov    %rax,%r8
xor    %eax,%eax
jmp    1030 <sendCmd@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"text c c \22%s\22\0A\00"
@.str.1 = [16 x i8] c"text c %i \22%s\22\0A\00"
@.str.2 = [16 x i8] c"text %i c \22%s\22\0A\00"
@.str.3 = [17 x i8] c"text %i %i \22%s\22\0A\00"
define void @sketchTextCentred(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %11
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %6
%16 = load i32, i32* %12
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %7
%20 = load i8*, i8** %8
%21 = call i32 (i32, i8*, ...) @sendCmd(i32 %19, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %46
22: ; preds = %15, %6
%23 = load i32, i32* %11
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i32, i32* %7
%27 = load i32, i32* %10
%28 = load i8*, i8** %8
%29 = call i32 (i32, i8*, ...) @sendCmd(i32 %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %27, i8* %28)
br label %45
30: ; preds = %22
%31 = load i32, i32* %12
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* %7
%35 = load i32, i32* %9
%36 = load i8*, i8** %8
%37 = call i32 (i32, i8*, ...) @sendCmd(i32 %34, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %35, i8* %36)
br label %44
38: ; preds = %30
%39 = load i32, i32* %7
%40 = load i32, i32* %9
%41 = load i32, i32* %10
%42 = load i8*, i8** %8
%43 = call i32 (i32, i8*, ...) @sendCmd(i32 %39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %40, i32 %41, i8* %42)
br label %44
44: ; preds = %38, %33
br label %45
45: ; preds = %44, %25
br label %46
46: ; preds = %45, %18
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"text c c \22%s\22\0A\00"
@.str.1 = [16 x i8] c"text c %i \22%s\22\0A\00"
@.str.2 = [16 x i8] c"text %i c \22%s\22\0A\00"
@.str.3 = [17 x i8] c"text %i %i \22%s\22\0A\00"
define void @sketchTextCentred(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp ne i32 %4, 0
%8 = icmp ne i32 %5, 0
%9 = and i1 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 (i32, i8*, ...) @sendCmd(i32 %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %20
12: ; preds = %6
br i1 %7, label %13, label %15
13: ; preds = %12
%14 = tail call i32 (i32, i8*, ...) @sendCmd(i32 %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %3, i8* %1)
br label %20
15: ; preds = %12
br i1 %8, label %16, label %18
16: ; preds = %15
%17 = tail call i32 (i32, i8*, ...) @sendCmd(i32 %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %2, i8* %1)
br label %20
18: ; preds = %15
%19 = tail call i32 (i32, i8*, ...) @sendCmd(i32 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %2, i32 %3, i8* %1)
br label %20
20: ; preds = %13, %18, %16, %10
ret void
}