#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 trackDb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SHA1(unsigned char const *, int /*<<< orphan*/,
                        unsigned char *);
int SHA_DIGEST_LENGTH;
int /*<<< orphan*/ cloneTdbListToSharedMem(char *, struct trackDb *,
                                           unsigned long, char *);
int /*<<< orphan*/ hexBinaryString(unsigned char *, int, char *, int);
int /*<<< orphan*/ strlen(char *);
void trackDbHubCloneTdbListToSharedMem(char *trackDbUrl, struct trackDb *list,
                                       unsigned long size) {
  if ((*trackDbUrl == '.') || (list == NULL))
    return;
  ;
  unsigned char hash[SHA_DIGEST_LENGTH];
  SHA1((const unsigned char *)trackDbUrl, strlen(trackDbUrl), hash);
  char newName[(SHA_DIGEST_LENGTH + 1) * 2];
  hexBinaryString(hash, SHA_DIGEST_LENGTH, newName,
                  (SHA_DIGEST_LENGTH + 1) * 2);
  cloneTdbListToSharedMem(newName, list, size, trackDbUrl);
}


x86 assembly (clang, -O0):
<trackDbHubCloneTdbListToSharedMem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     116f <trackDbHubCloneTdbListToSharedMem+0x2f>
cmpq   $0x0,-0x10(%rbp)
jne    1174 <trackDbHubCloneTdbListToSharedMem+0x34>
jmp    1225 <trackDbHubCloneTdbListToSharedMem+0xe5>
mov    0x2e6d(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    %rdi,-0x50(%rbp)
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    %eax,%esi
call   1060 <SHA1@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
mov    %ecx,%eax
lea    0x2(%rax,%rax,1),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x30(%rbp)
mov    0x2df5(%rip),%rax
mov    (%rax),%esi
mov    0x2dec(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
shl    $0x1,%ecx
call   1030 <hexBinaryString@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
call   1050 <cloneTdbListToSharedMem@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trackDbHubCloneTdbListToSharedMem>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     11cd <trackDbHubCloneTdbListToSharedMem+0x8d>
mov    %rdi,%r12
cmpb   $0x2e,(%rdi)
je     11cd <trackDbHubCloneTdbListToSharedMem+0x8d>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rsp,-0x30(%rbp)
mov    0x2e7c(%rip),%rbx
mov    (%rbx),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
mov    %r13,%rdx
call   1060 <SHA1@plt>
mov    (%rbx),%esi
lea    (%rsi,%rsi,1),%ecx
add    $0x2,%ecx
lea    0xf(%rcx),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r13,%rdi
mov    %rbx,%rdx
call   1030 <hexBinaryString@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
call   1050 <cloneTdbListToSharedMem@plt>
mov    -0x30(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.trackDb = type { i32 }
@SHA_DIGEST_LENGTH = global i32 0
define void @trackDbHubCloneTdbListToSharedMem(i8* %0, %struct.trackDb* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca %struct.trackDb*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %4
store %struct.trackDb* %1, %struct.trackDb** %5
store i64 %2, i64* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 46
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = load %struct.trackDb*, %struct.trackDb** %5
%16 = icmp eq %struct.trackDb* %15, null
br i1 %16, label %17, label %18
17: ; preds = %14, %3
br label %42
18: ; preds = %14
%19 = load i32, i32* @SHA_DIGEST_LENGTH
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %7
%22 = alloca i8, i64 %20
store i64 %20, i64* %8
%23 = load i8*, i8** %4
%24 = load i8*, i8** %4
%25 = call i32 @strlen(i8* %24)
%26 = call i32 @SHA1(i8* %23, i32 %25, i8* %22)
%27 = load i32, i32* @SHA_DIGEST_LENGTH
%28 = add nsw i32 %27, 1
%29 = mul nsw i32 %28, 2
%30 = zext i32 %29 to i64
%31 = alloca i8, i64 %30
store i64 %30, i64* %9
%32 = load i32, i32* @SHA_DIGEST_LENGTH
%33 = load i32, i32* @SHA_DIGEST_LENGTH
%34 = add nsw i32 %33, 1
%35 = mul nsw i32 %34, 2
%36 = call i32 @hexBinaryString(i8* %22, i32 %32, i8* %31, i32 %35)
%37 = load %struct.trackDb*, %struct.trackDb** %5
%38 = load i64, i64* %6
%39 = load i8*, i8** %4
%40 = call i32 @cloneTdbListToSharedMem(i8* %31, %struct.trackDb* %37, i64 %38, i8* %39)
%41 = load i8*, i8** %7
br label %42
42: ; preds = %18, %17
ret void
}

LLVM IR (-O2):
%struct.trackDb = type { i32 }
@SHA_DIGEST_LENGTH = global i32 0
define void @trackDbHubCloneTdbListToSharedMem(i8* %0, %struct.trackDb* %1, i64 %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 46
%6 = icmp eq %struct.trackDb* %1, null
%7 = or i1 %6, %5
br i1 %7, label %22, label %8
8: ; preds = %3
%9 = load i32, i32* @SHA_DIGEST_LENGTH
%10 = zext i32 %9 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = alloca i8, i64 %10
%13 = tail call i32 @strlen(i8* %0)
%14 = call i32 @SHA1(i8* %0, i32 %13, i8* %12)
%15 = load i32, i32* @SHA_DIGEST_LENGTH
%16 = shl i32 %15, 1
%17 = add i32 %16, 2
%18 = zext i32 %17 to i64
%19 = alloca i8, i64 %18
%20 = call i32 @hexBinaryString(i8* %12, i32 %15, i8* %19, i32 %17)
%21 = call i32 @cloneTdbListToSharedMem(i8* %19, %struct.trackDb* %1, i64 %2, i8* %0)
br label %22
22: ; preds = %3, %8
ret void
}