#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*/ dtoi(float);
int /*<<< orphan*/ g2_free(char *);
char *g2_malloc(int);
int /*<<< orphan*/ g2_string(int /*<<< orphan*/, float, float, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void g2_string_(float *dev, float *x, float *y, char *text, int length) {
  char *str;
  str = g2_malloc((length + 1) * sizeof(char));
  strncpy(str, text, length);
  str[length] = '\0';
  g2_string(dtoi(*dev), *x, *y, str);
  g2_free(str);
}


x86 assembly (clang, -O0):
<g2_string_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <g2_malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1060 <dtoi@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x30(%rbp),%rsi
call   1050 <g2_string@plt>
mov    -0x30(%rbp),%rdi
call   1070 <g2_free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2_string_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
lea    0x1(%rbx),%edi
call   1040 <g2_malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
movb   $0x0,0x0(%rbp,%rax,1)
movss  0x0(%r13),%xmm0
call   1060 <dtoi@plt>
movss  (%r12),%xmm0
movss  (%r15),%xmm1
mov    %eax,%edi
mov    %rbp,%rsi
call   1050 <g2_string@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <g2_free@plt>

LLVM IR (-O0):
define void @g2_string_(float* %0, float* %1, float* %2, i8* %3, i32 %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i32, i32* %10
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 1
%16 = trunc i64 %15 to i32
%17 = call i8* @g2_malloc(i32 %16)
store i8* %17, i8** %11
%18 = load i8*, i8** %11
%19 = load i8*, i8** %9
%20 = load i32, i32* %10
%21 = call i32 @strncpy(i8* %18, i8* %19, i32 %20)
%22 = load i8*, i8** %11
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 0, i8* %25
%26 = load float*, float** %6
%27 = load float, float* %26
%28 = call i32 @dtoi(float %27)
%29 = load float*, float** %7
%30 = load float, float* %29
%31 = load float*, float** %8
%32 = load float, float* %31
%33 = load i8*, i8** %11
%34 = call i32 @g2_string(i32 %28, float %30, float %32, i8* %33)
%35 = load i8*, i8** %11
%36 = call i32 @g2_free(i8* %35)
ret void
}

LLVM IR (-O2):
define void @g2_string_(float* nocapture %0, float* nocapture %1, float* nocapture %2, i8* %3, i32 %4) {
%6 = add nsw i32 %4, 1
%7 = tail call i8* @g2_malloc(i32 %6)
%8 = tail call i32 @strncpy(i8* %7, i8* %3, i32 %4)
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8 0, i8* %10
%11 = load float, float* %0
%12 = tail call i32 @dtoi(float %11)
%13 = load float, float* %1
%14 = load float, float* %2
%15 = tail call i32 @g2_string(i32 %12, float %13, float %14, i8* %7)
%16 = tail call i32 @g2_free(i8* %7)
ret void
}