#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*/ drawstringz(char *, unsigned char, unsigned char);
int /*<<< orphan*/ int2str(unsigned char, char *);
int /*<<< orphan*/ strcat(char *, char *);
void drawmoney(unsigned char x, unsigned char y, unsigned char v) {
  char temp[20];
  temp[0] = 0;
  strcat(temp, "You have ");
  int2str(v, &temp[9]);
  strcat(temp, " crowns.");
  drawstringz(temp, x, y);
}


x86 assembly (clang, -O0):
<drawmoney>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movb   $0x0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x3(%rbp),%al
lea    -0x20(%rbp),%rsi
add    $0x9,%rsi
movzbl %al,%edi
call   1030 <int2str@plt>
lea    -0x20(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x20(%rbp),%rdi
mov    -0x1(%rbp),%al
movzbl %al,%esi
movzbl -0x2(%rbp),%edx
call   1040 <drawstringz@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawmoney>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%r15d
movb   $0x0,(%rsp)
lea    0xeb3(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
call   1050 <strcat@plt>
lea    0x9(%rsp),%rsi
mov    %ebx,%edi
call   1030 <int2str@plt>
lea    0xe9f(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcat@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1040 <drawstringz@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"You have \00"
@.str.1 = [9 x i8] c" crowns.\00"
define void @drawmoney(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca [20 x i8]
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8 0, i8* %8
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%11 = load i8, i8* %6
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 9
%13 = call i32 @int2str(i8 zeroext %11, i8* %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%17 = load i8, i8* %4
%18 = load i8, i8* %5
%19 = call i32 @drawstringz(i8* %16, i8 zeroext %17, i8 zeroext %18)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"You have \00"
@.str.1 = [9 x i8] c" crowns.\00"
define void @drawmoney(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
store i8 0, i8* %5
%6 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 9
%8 = call i32 @int2str(i8 zeroext %2, i8* %7)
%9 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @drawstringz(i8* %5, i8 zeroext %0, i8 zeroext %1)
ret void
}