#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 */
struct timespec {
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ __clock_gettime(int /*<<< orphan*/, struct timespec *);
char *__randname(char *template) {
  int i;
  struct timespec ts;
  unsigned long r;
  __clock_gettime(CLOCK_REALTIME, &ts);
  r = ts.tv_nsec * 65537 ^ (uintptr_t)&ts / 16 + (uintptr_t) template;
  for (i = 0; i < 6; i++, r >>= 5)
    template[i] = 'A' + (r & 15) + (r & 16) * 2;
  return template;
}


x86 assembly (clang, -O0):
<__randname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <__clock_gettime@plt>
imul   $0x10001,-0x10(%rbp),%eax
cltq
lea    -0x10(%rbp),%rcx
shr    $0x4,%rcx
mov    -0x8(%rbp),%rdx
add    %rdx,%rcx
xor    %rcx,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    11a0 <__randname+0x90>
mov    -0x18(%rbp),%rax
and    $0xf,%rax
add    $0x41,%rax
mov    -0x18(%rbp),%rcx
and    $0x10,%rcx
shl    $0x1,%rcx
add    %rcx,%rax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x5,%rax
mov    %rax,-0x18(%rbp)
jmp    1154 <__randname+0x44>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__randname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <__clock_gettime@plt>
mov    (%rsp),%eax
mov    %eax,%ecx
shl    $0x10,%ecx
add    %eax,%ecx
shr    $0x4,%rbx
add    %r14d,%ebx
xor    %ecx,%ebx
mov    %ebx,%eax
and    $0xf,%eax
mov    %ebx,%ecx
and    $0x10,%ecx
lea    (%rax,%rcx,2),%eax
add    $0x41,%al
mov    %al,(%r14)
mov    %ebx,%eax
shr    $0x5,%eax
and    $0xf,%eax
mov    %ebx,%ecx
shr    $0x4,%ecx
and    $0x20,%ecx
or     %eax,%ecx
add    $0x41,%cl
mov    %cl,0x1(%r14)
mov    %ebx,%eax
shr    $0xa,%eax
and    $0xf,%eax
mov    %ebx,%ecx
shr    $0x9,%ecx
and    $0x20,%ecx
or     %eax,%ecx
add    $0x41,%cl
mov    %cl,0x2(%r14)
mov    %ebx,%eax
shr    $0xf,%eax
and    $0xf,%eax
mov    %ebx,%ecx
shr    $0xe,%ecx
and    $0x20,%ecx
or     %eax,%ecx
add    $0x41,%cl
mov    %cl,0x3(%r14)
mov    %ebx,%eax
shr    $0x14,%eax
and    $0xf,%eax
mov    %ebx,%ecx
shr    $0x13,%ecx
and    $0x20,%ecx
or     %eax,%ecx
add    $0x41,%cl
mov    %cl,0x4(%r14)
mov    %ebx,%eax
shr    $0x19,%eax
and    $0xf,%eax
shr    $0x18,%ebx
and    $0x20,%ebx
or     %eax,%ebx
add    $0x41,%bl
mov    %bl,0x5(%r14)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i8* @__randname(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.timespec
%5 = alloca i64
store i8* %0, i8** %2
%6 = load i32, i32* @CLOCK_REALTIME
%7 = call i32 @__clock_gettime(i32 %6, %struct.timespec* %4)
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%9 = load i32, i32* %8
%10 = mul nsw i32 %9, 65537
%11 = sext i32 %10 to i64
%12 = ptrtoint %struct.timespec* %4 to i64
%13 = udiv i64 %12, 16
%14 = load i8*, i8** %2
%15 = ptrtoint i8* %14 to i64
%16 = add i64 %13, %15
%17 = xor i64 %11, %16
store i64 %17, i64* %5
store i32 0, i32* %3
br label %18
18: ; preds = %34, %1
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 6
br i1 %20, label %21, label %39
21: ; preds = %18
%22 = load i64, i64* %5
%23 = and i64 %22, 15
%24 = add i64 65, %23
%25 = load i64, i64* %5
%26 = and i64 %25, 16
%27 = mul i64 %26, 2
%28 = add i64 %24, %27
%29 = trunc i64 %28 to i8
%30 = load i8*, i8** %2
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
store i8 %29, i8* %33
br label %34
34: ; preds = %21
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
%37 = load i64, i64* %5
%38 = lshr i64 %37, 5
store i64 %38, i64* %5
br label %18
39: ; preds = %18
%40 = load i8*, i8** %2
ret i8* %40
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i8* @__randname(i8* returned %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = load i32, i32* @CLOCK_REALTIME
%5 = call i32 @__clock_gettime(i32 %4, %struct.timespec* %2)
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 65537
%9 = zext i32 %8 to i64
%10 = ptrtoint %struct.timespec* %2 to i64
%11 = lshr i64 %10, 4
%12 = ptrtoint i8* %0 to i64
%13 = add i64 %11, %12
%14 = xor i64 %13, %9
%15 = and i64 %14, 15
%16 = add nuw nsw i64 %15, 65
%17 = shl i64 %14, 1
%18 = and i64 %17, 32
%19 = or i64 %16, %18
%20 = trunc i64 %19 to i8
store i8 %20, i8* %0
%21 = lshr i64 %14, 5
%22 = and i64 %21, 15
%23 = add nuw nsw i64 %22, 65
%24 = shl nuw nsw i64 %21, 1
%25 = and i64 %24, 32
%26 = or i64 %23, %25
%27 = trunc i64 %26 to i8
%28 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %27, i8* %28
%29 = lshr i64 %14, 10
%30 = and i64 %29, 15
%31 = add nuw nsw i64 %30, 65
%32 = shl nuw nsw i64 %29, 1
%33 = and i64 %32, 32
%34 = or i64 %31, %33
%35 = trunc i64 %34 to i8
%36 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %35, i8* %36
%37 = lshr i64 %14, 15
%38 = and i64 %37, 15
%39 = add nuw nsw i64 %38, 65
%40 = shl nuw nsw i64 %37, 1
%41 = and i64 %40, 32
%42 = or i64 %39, %41
%43 = trunc i64 %42 to i8
%44 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %43, i8* %44
%45 = lshr i64 %14, 20
%46 = and i64 %45, 15
%47 = add nuw nsw i64 %46, 65
%48 = shl nuw nsw i64 %45, 1
%49 = and i64 %48, 32
%50 = or i64 %47, %49
%51 = trunc i64 %50 to i8
%52 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %51, i8* %52
%53 = lshr i64 %14, 25
%54 = and i64 %53, 15
%55 = add nuw nsw i64 %54, 65
%56 = shl nuw nsw i64 %53, 1
%57 = and i64 %56, 32
%58 = or i64 %55, %57
%59 = trunc i64 %58 to i8
%60 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %59, i8* %60
ret i8* %0
}