#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*/ gds_write_endel(int);
int /*<<< orphan*/ gds_write_layer(int, int);
int /*<<< orphan*/ gds_write_presentation(int, int /*<<< orphan*/, int,
                                          int /*<<< orphan*/);
int /*<<< orphan*/ gds_write_strans(int, int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/);
int /*<<< orphan*/ gds_write_string(int, char *);
int /*<<< orphan*/ gds_write_text(int);
int /*<<< orphan*/ gds_write_texttype(int, int /*<<< orphan*/);
int /*<<< orphan*/ gds_write_width(int, int);
int /*<<< orphan*/ gds_write_xy(int, int *, int *, int);
void gds_create_text(int fd, char *str, int x, int y, int layer, int size) {
  static int xx[1], yy[1];
  gds_write_text(fd);
  gds_write_layer(fd, layer);
  gds_write_texttype(fd, 0);
  gds_write_presentation(fd, 0, 1, 0);
  gds_write_width(fd, size);
  gds_write_strans(fd, 0, 0, 0);
  xx[0] = x;
  yy[0] = y;
  gds_write_xy(fd, xx, yy, 1);
  gds_write_string(fd, str);
  gds_write_endel(fd);
}


x86 assembly (clang, -O0):
<gds_create_text>:
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)
mov    -0x4(%rbp),%edi
call   1070 <gds_write_text@plt>
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10b0 <gds_write_layer@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1080 <gds_write_texttype@plt>
mov    -0x4(%rbp),%edi
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1060 <gds_write_presentation@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10a0 <gds_write_width@plt>
mov    -0x4(%rbp),%edi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1050 <gds_write_strans@plt>
mov    -0x14(%rbp),%eax
mov    %eax,0x2e6f(%rip)
mov    -0x18(%rbp),%eax
mov    %eax,0x2e6a(%rip)
mov    -0x4(%rbp),%edi
lea    0x2e5c(%rip),%rsi
lea    0x2e59(%rip),%rdx
mov    $0x1,%ecx
call   1090 <gds_write_xy@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <gds_write_string@plt>
mov    -0x4(%rbp),%edi
call   1040 <gds_write_endel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gds_create_text>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r13d
mov    %r8d,%ebp
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %rsi,%r14
mov    %edi,%ebx
call   1070 <gds_write_text@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   10b0 <gds_write_layer@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1080 <gds_write_texttype@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1060 <gds_write_presentation@plt>
mov    %ebx,%edi
mov    %r13d,%esi
call   10a0 <gds_write_width@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <gds_write_strans@plt>
mov    %r12d,0x2e7b(%rip)
lea    0x2e74(%rip),%rsi
mov    %r15d,0x2e71(%rip)
lea    0x2e6a(%rip),%rdx
mov    %ebx,%edi
mov    $0x1,%ecx
call   1090 <gds_write_xy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <gds_write_string@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <gds_write_endel@plt>

LLVM IR (-O0):
@gds_create_text.xx = internal global [1 x i32] zeroinitializer
@gds_create_text.yy = internal global [1 x i32] zeroinitializer
define void @gds_create_text(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* %7
%14 = call i32 @gds_write_text(i32 %13)
%15 = load i32, i32* %7
%16 = load i32, i32* %11
%17 = call i32 @gds_write_layer(i32 %15, i32 %16)
%18 = load i32, i32* %7
%19 = call i32 @gds_write_texttype(i32 %18, i32 0)
%20 = load i32, i32* %7
%21 = call i32 @gds_write_presentation(i32 %20, i32 0, i32 1, i32 0)
%22 = load i32, i32* %7
%23 = load i32, i32* %12
%24 = call i32 @gds_write_width(i32 %22, i32 %23)
%25 = load i32, i32* %7
%26 = call i32 @gds_write_strans(i32 %25, i32 0, i32 0, i32 0)
%27 = load i32, i32* %9
store i32 %27, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.xx, i64 0, i64 0)
%28 = load i32, i32* %10
store i32 %28, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.yy, i64 0, i64 0)
%29 = load i32, i32* %7
%30 = call i32 @gds_write_xy(i32 %29, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.xx, i64 0, i64 0), i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.yy, i64 0, i64 0), i32 1)
%31 = load i32, i32* %7
%32 = load i8*, i8** %8
%33 = call i32 @gds_write_string(i32 %31, i8* %32)
%34 = load i32, i32* %7
%35 = call i32 @gds_write_endel(i32 %34)
ret void
}

LLVM IR (-O2):
@gds_create_text.xx = internal global [1 x i32] zeroinitializer
@gds_create_text.yy = internal global [1 x i32] zeroinitializer
define void @gds_create_text(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @gds_write_text(i32 %0)
%8 = tail call i32 @gds_write_layer(i32 %0, i32 %4)
%9 = tail call i32 @gds_write_texttype(i32 %0, i32 0)
%10 = tail call i32 @gds_write_presentation(i32 %0, i32 0, i32 1, i32 0)
%11 = tail call i32 @gds_write_width(i32 %0, i32 %5)
%12 = tail call i32 @gds_write_strans(i32 %0, i32 0, i32 0, i32 0)
store i32 %2, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.xx, i64 0, i64 0)
store i32 %3, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.yy, i64 0, i64 0)
%13 = tail call i32 @gds_write_xy(i32 %0, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.xx, i64 0, i64 0), i32* getelementptr inbounds ([1 x i32], [1 x i32]* @gds_create_text.yy, i64 0, i64 0), i32 1)
%14 = tail call i32 @gds_write_string(i32 %0, i8* %1)
%15 = tail call i32 @gds_write_endel(i32 %0)
ret void
}