#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*/ gen_str_alphanumeric(char *, char const *, size_t);
int /*<<< orphan*/ strcpy(char *, char *);
void gen_cname_elem(char *dst, const char *src, size_t n) {
  if (n > 3) {
    strcpy(dst, "el_");
    gen_str_alphanumeric(dst + 3, src, n - 3);
  } else if (n > 0) {
    *dst = '\0';
  }
}


x86 assembly (clang, -O0):
<gen_cname_elem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x3,-0x18(%rbp)
jbe    116d <gen_cname_elem+0x4d>
mov    -0x8(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
add    $0x3,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x3,%rdx
call   1040 <gen_str_alphanumeric@plt>
jmp    1184 <gen_cname_elem+0x64>
cmpq   $0x0,-0x18(%rbp)
jbe    117f <gen_cname_elem+0x5f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    1184 <gen_cname_elem+0x64>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_cname_elem>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rdi,%r14
cmp    $0x4,%rdx
jb     115e <gen_cname_elem+0x3e>
mov    %rsi,%r15
lea    0xec5(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
add    $0x3,%r14
add    $0xfffffffffffffffd,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <gen_str_alphanumeric@plt>
test   %rbx,%rbx
je     1167 <gen_cname_elem+0x47>
movb   $0x0,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"el_\00"
define void @gen_cname_elem(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = icmp ugt i64 %7, 3
br i1 %8, label %9, label %18
9: ; preds = %3
%10 = load i8*, i8** %4
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 3
%14 = load i8*, i8** %5
%15 = load i64, i64* %6
%16 = sub i64 %15, 3
%17 = call i32 @gen_str_alphanumeric(i8* %13, i8* %14, i64 %16)
br label %24
18: ; preds = %3
%19 = load i64, i64* %6
%20 = icmp ugt i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i8*, i8** %4
store i8 0, i8* %22
br label %23
23: ; preds = %21, %18
br label %24
24: ; preds = %23, %9
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"el_\00"
define void @gen_cname_elem(i8* %0, i8* %1, i64 %2) {
%4 = icmp ugt i64 %2, 3
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds i8, i8* %0, i64 3
%8 = add i64 %2, -3
%9 = tail call i32 @gen_str_alphanumeric(i8* %7, i8* %1, i64 %8)
br label %13
10: ; preds = %3
%11 = icmp eq i64 %2, 0
br i1 %11, label %13, label %12
12: ; preds = %10
store i8 0, i8* %0
br label %13
13: ; preds = %10, %12, %5
ret void
}