#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*/ itoa(int, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void namex(int i, char *s, char *r) {
  extern char s1[], s2[];
  extern void resets();
  resets(r);
  resets(s1);
  resets(s2);
  strcpy(s1, s);
  itoa(i, s2);
  strcat(s1, s2);
  strcpy(r, s1);
}


x86 assembly (clang, -O0):
<namex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <resets@plt>
mov    0x2e83(%rip),%rdi
mov    $0x0,%al
call   1040 <resets@plt>
mov    0x2e65(%rip),%rdi
mov    $0x0,%al
call   1040 <resets@plt>
mov    -0x10(%rbp),%rsi
mov    0x2e63(%rip),%rdi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
mov    0x2e44(%rip),%rsi
call   1060 <itoa@plt>
mov    0x2e48(%rip),%rdi
mov    0x2e31(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    0x2e31(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<namex>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%r15d
mov    %rdx,%rdi
xor    %eax,%eax
call   1040 <resets@plt>
mov    0x2e86(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <resets@plt>
mov    0x2e65(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <resets@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r15d,%edi
mov    %r12,%rsi
call   1060 <itoa@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@s1 = external global [0 x i8]
@s2 = external global [0 x i8]
define void @namex(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = load i8*, i8** %5
%9 = call i32 @strcpy(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s1, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %4
%11 = call i32 @itoa(i32 %10, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s2, i64 0, i64 0))
%12 = call i32 @strcat(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s1, i64 0, i64 0), i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s2, i64 0, i64 0))
%13 = load i8*, i8** %6
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@s1 = external global [0 x i8]
@s2 = external global [0 x i8]
define void @namex(i32 %0, i8* %1, i8* %2) {
tail call void (i8*, ...) bitcast (void (...)* @resets to void (i8*, ...)*)(i8* %2)
tail call void (i8*, ...) bitcast (void (...)* @resets to void (i8*, ...)*)(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s1, i64 0, i64 0))
tail call void (i8*, ...) bitcast (void (...)* @resets to void (i8*, ...)*)(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s2, i64 0, i64 0))
%4 = tail call i32 @strcpy(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s1, i64 0, i64 0), i8* %1)
%5 = tail call i32 @itoa(i32 %0, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s2, i64 0, i64 0))
%6 = tail call i32 @strcat(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s1, i64 0, i64 0), i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s2, i64 0, i64 0))
%7 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s1, i64 0, i64 0))
ret void
}