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

/* Type definitions */
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ XtPointer;
typedef TYPE_1__ *XrmValuePtr;
typedef int /*<<< orphan*/ *XPointer;
struct TYPE_5__ {
  size_t size;
  int /*<<< orphan*/ *addr;
};
typedef int /*<<< orphan*/ String;
typedef int /*<<< orphan*/ Display;
typedef scalar_t__ Cardinal;
typedef int /*<<< orphan*/ Boolean;

/* Variables and functions */
int /*<<< orphan*/ False;
int /*<<< orphan*/ True;
int /*<<< orphan*/ XmuSnprintf(char *, int, char *, long);
int /*<<< orphan*/ XtWarning(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
Boolean XmuCvtLongToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
                           XrmValuePtr fromVal, XrmValuePtr toVal,
                           XtPointer *data) {
  static char buffer[32];
  size_t size;
  if (*num_args != 0)
    XtWarning("Long to String conversion needs no extra arguments");
  XmuSnprintf(buffer, sizeof(buffer), "%ld", *(long *)fromVal->addr);
  size = strlen(buffer) + 1;
  if (toVal->addr != NULL) {
    if (toVal->size < size) {
      toVal->size = size;
      return (False);
    }
    strcpy((char *)toVal->addr, buffer);
  } else
    toVal->addr = (XPointer)buffer;
  toVal->size = sizeof(String);
  return (True);
}


x86 assembly (clang, -O0):
<XmuCvtLongToString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     117a <XmuCvtLongToString+0x3a>
lea    0xe8b(%rip),%rdi
call   1060 <XtWarning@plt>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rcx
lea    0x2ec4(%rip),%rdi
mov    $0x20,%esi
lea    0xe9b(%rip),%rdx
call   1050 <XmuSnprintf@plt>
lea    0x2eac(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1207 <XmuCvtLongToString+0xc7>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
cmp    -0x40(%rbp),%rax
jae    11ee <XmuCvtLongToString+0xae>
mov    -0x40(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    122d <XmuCvtLongToString+0xed>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0x2e53(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1216 <XmuCvtLongToString+0xd6>
mov    -0x30(%rbp),%rax
lea    0x2e3e(%rip),%rcx
mov    %rcx,0x8(%rax)
mov    -0x30(%rbp),%rax
movq   $0x4,(%rax)
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XmuCvtLongToString>:
push   %r15
push   %r14
push   %rbx
mov    %r8,%r15
mov    %rcx,%rbx
cmpq   $0x0,(%rdx)
je     115d <XmuCvtLongToString+0x1d>
lea    0xea8(%rip),%rdi
call   1060 <XtWarning@plt>
mov    0x8(%rbx),%rax
mov    (%rax),%rcx
lea    0x2ee5(%rip),%r14
lea    0xec1(%rip),%rdx
mov    %r14,%rdi
mov    $0x20,%esi
call   1050 <XmuSnprintf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    0x8(%r15),%rdi
test   %rdi,%rdi
je     11a6 <XmuCvtLongToString+0x66>
add    $0x1,%eax
cltq
cmp    %rax,(%r15)
jae    11ac <XmuCvtLongToString+0x6c>
mov    %rax,(%r15)
mov    0x2e44(%rip),%rax
jmp    11c6 <XmuCvtLongToString+0x86>
mov    %r14,0x8(%r15)
jmp    11b8 <XmuCvtLongToString+0x78>
lea    0x2e9d(%rip),%rsi
call   1030 <strcpy@plt>
movq   $0x4,(%r15)
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, i32* }
@XmuCvtLongToString.buffer = internal global [32 x i8] zeroinitializer
@.str = [51 x i8] c"Long to String conversion needs no extra arguments\00"
@.str.1 = [4 x i8] c"%ld\00"
@False = global i32 0
@True = global i32 0
define i32 @XmuCvtLongToString(i32* %0, %struct.TYPE_5__* %1, i64* %2, %struct.TYPE_5__* %3, %struct.TYPE_5__* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32*
%9 = alloca %struct.TYPE_5__*
%10 = alloca i64*
%11 = alloca %struct.TYPE_5__*
%12 = alloca %struct.TYPE_5__*
%13 = alloca i32*
%14 = alloca i64
store i32* %0, i32** %8
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %9
store i64* %2, i64** %10
store %struct.TYPE_5__* %3, %struct.TYPE_5__** %11
store %struct.TYPE_5__* %4, %struct.TYPE_5__** %12
store i32* %5, i32** %13
%15 = load i64*, i64** %10
%16 = load i64, i64* %15
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %6
%19 = call i32 @XtWarning(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %6
%21 = load %struct.TYPE_5__*, %struct.TYPE_5__** %11
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %21, i32 0, i32 1
%23 = load i32*, i32** %22
%24 = bitcast i32* %23 to i64*
%25 = load i64, i64* %24
%26 = call i32 @XmuSnprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @XmuCvtLongToString.buffer, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %25)
%27 = call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @XmuCvtLongToString.buffer, i64 0, i64 0))
%28 = add nsw i32 %27, 1
%29 = sext i32 %28 to i64
store i64 %29, i64* %14
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%31 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %30, i32 0, i32 1
%32 = load i32*, i32** %31
%33 = icmp ne i32* %32, null
br i1 %33, label %34, label %51
34: ; preds = %20
%35 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%36 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %35, i32 0, i32 0
%37 = load i64, i64* %36
%38 = load i64, i64* %14
%39 = icmp ult i64 %37, %38
br i1 %39, label %40, label %45
40: ; preds = %34
%41 = load i64, i64* %14
%42 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%43 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %42, i32 0, i32 0
store i64 %41, i64* %43
%44 = load i32, i32* @False
store i32 %44, i32* %7
br label %58
45: ; preds = %34
%46 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%47 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %46, i32 0, i32 1
%48 = load i32*, i32** %47
%49 = bitcast i32* %48 to i8*
%50 = call i32 @strcpy(i8* %49, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @XmuCvtLongToString.buffer, i64 0, i64 0))
br label %54
51: ; preds = %20
%52 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%53 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %52, i32 0, i32 1
store i32* bitcast ([32 x i8]* @XmuCvtLongToString.buffer to i32*), i32** %53
br label %54
54: ; preds = %51, %45
%55 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%56 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %55, i32 0, i32 0
store i64 4, i64* %56
%57 = load i32, i32* @True
store i32 %57, i32* %7
br label %58
58: ; preds = %54, %40
%59 = load i32, i32* %7
ret i32 %59
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, i32* }
@XmuCvtLongToString.buffer = internal global [32 x i8] zeroinitializer
@.str = [51 x i8] c"Long to String conversion needs no extra arguments\00"
@.str.1 = [4 x i8] c"%ld\00"
@False = global i32 0
@True = global i32 0
define i32 @XmuCvtLongToString(i32* nocapture readnone %0, %struct.TYPE_5__* nocapture readnone %1, i64* nocapture %2, %struct.TYPE_5__* nocapture %3, %struct.TYPE_5__* nocapture %4, i32* nocapture readnone %5) {
%7 = load i64, i64* %2
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @XtWarning(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1
%13 = bitcast i32** %12 to i64**
%14 = load i64*, i64** %13
%15 = load i64, i64* %14
%16 = tail call i32 @XmuSnprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @XmuCvtLongToString.buffer, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %15)
%17 = tail call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @XmuCvtLongToString.buffer, i64 0, i64 0))
%18 = add nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i64 0, i32 1
%21 = load i32*, i32** %20
%22 = icmp eq i32* %21, null
br i1 %22, label %31, label %23
23: ; preds = %11
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i64 0, i32 0
%25 = load i64, i64* %24
%26 = icmp ult i64 %25, %19
br i1 %26, label %27, label %28
27: ; preds = %23
store i64 %19, i64* %24
br label %34
28: ; preds = %23
%29 = bitcast i32* %21 to i8*
%30 = tail call i32 @strcpy(i8* %29, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @XmuCvtLongToString.buffer, i64 0, i64 0))
br label %32
31: ; preds = %11
store i32* bitcast ([32 x i8]* @XmuCvtLongToString.buffer to i32*), i32** %20
br label %32
32: ; preds = %31, %28
%33 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i64 0, i32 0
store i64 4, i64* %33
br label %34
34: ; preds = %32, %27
%35 = phi i32* [ @False, %27 ], [ @True, %32 ]
%36 = load i32, i32* %35
ret i32 %36
}