#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 */
struct ADrawTag {
  int dummy;
};

/* Variables and functions */
unsigned int INT_MAX;
int /*<<< orphan*/ gdoTextR(struct ADrawTag *, unsigned int, unsigned int,
                            char const *);
scalar_t__ gdoTextWidth(struct ADrawTag *, char const *);
void gdoTextL(struct ADrawTag *ctx, unsigned int x, unsigned int y,
              const char *string) {
  x -= gdoTextWidth(ctx, string);
  if (x <= INT_MAX && y <= INT_MAX) {
    gdoTextR(ctx, x, y, string);
  }
}


x86 assembly (clang, -O0):
<gdoTextL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <gdoTextWidth@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
sub    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%eax
ja     1186 <gdoTextL+0x66>
mov    -0x10(%rbp),%eax
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%eax
ja     1186 <gdoTextL+0x66>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1040 <gdoTextR@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdoTextL>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%rbp
mov    %rcx,%rsi
call   1030 <gdoTextWidth@plt>
mov    0x2ea7(%rip),%rcx
mov    (%rcx),%ecx
cmp    %r15d,%ecx
jb     1168 <gdoTextL+0x48>
sub    %eax,%ebx
cmp    %ecx,%ebx
ja     1168 <gdoTextL+0x48>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <gdoTextR@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ADrawTag = type { i32 }
@INT_MAX = global i32 0
define void @gdoTextL(%struct.ADrawTag* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca %struct.ADrawTag*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store %struct.ADrawTag* %0, %struct.ADrawTag** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load %struct.ADrawTag*, %struct.ADrawTag** %5
%10 = load i8*, i8** %8
%11 = call i64 @gdoTextWidth(%struct.ADrawTag* %9, i8* %10)
%12 = load i32, i32* %6
%13 = zext i32 %12 to i64
%14 = sub nsw i64 %13, %11
%15 = trunc i64 %14 to i32
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = load i32, i32* @INT_MAX
%18 = icmp ule i32 %16, %17
br i1 %18, label %19, label %29
19: ; preds = %4
%20 = load i32, i32* %7
%21 = load i32, i32* @INT_MAX
%22 = icmp ule i32 %20, %21
br i1 %22, label %23, label %29
23: ; preds = %19
%24 = load %struct.ADrawTag*, %struct.ADrawTag** %5
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = load i8*, i8** %8
%28 = call i32 @gdoTextR(%struct.ADrawTag* %24, i32 %25, i32 %26, i8* %27)
br label %29
29: ; preds = %23, %19, %4
ret void
}

LLVM IR (-O2):
%struct.ADrawTag = type { i32 }
@INT_MAX = global i32 0
define void @gdoTextL(%struct.ADrawTag* %0, i32 %1, i32 %2, i8* %3) {
%5 = tail call i64 @gdoTextWidth(%struct.ADrawTag* %0, i8* %3)
%6 = trunc i64 %5 to i32
%7 = sub i32 %1, %6
%8 = load i32, i32* @INT_MAX
%9 = icmp ugt i32 %7, %8
%10 = icmp ult i32 %8, %2
%11 = or i1 %10, %9
br i1 %11, label %14, label %12
12: ; preds = %4
%13 = tail call i32 @gdoTextR(%struct.ADrawTag* %0, i32 %7, i32 %2, i8* %3)
br label %14
14: ; preds = %12, %4
ret void
}