#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void convertir_digito_cadena(char *target, char *longitud_cadena, int numero) {
  char aux[100];
  strcpy(aux, "%0");
  strcat(aux, longitud_cadena);
  strcat(aux, "d");
  sprintf(target, aux, numero);
}


x86 assembly (clang, -O0):
<convertir_digito_cadena>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
lea    -0x80(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <sprintf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertir_digito_cadena>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xeb6(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <strcat@plt>
lea    0xe9c(%rip),%rsi
mov    %rbp,%rdi
call   1040 <strcat@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1050 <sprintf@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%0\00"
@.str.1 = [2 x i8] c"d\00"
define void @convertir_digito_cadena(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [100 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = call i32 @strcat(i8* %10, i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8*, i8** %4
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%17 = load i32, i32* %6
%18 = call i32 @sprintf(i8* %15, i8* %16, i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%0\00"
@.str.1 = [2 x i8] c"d\00"
define void @convertir_digito_cadena(i8* nocapture writeonly %0, i8* %1, i32 %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @strcat(i8* %5, i8* %1)
%8 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* %5, i32 %2)
ret void
}