#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 */
char *badds(char *, char *);
int /*<<< orphan*/ memcpy(char *, char *, int);
char *btxid(char *p) {
  static char txid[10] = "@BCDEABCDE";
  char *q = txid;
  p = badds(p, "txid");
  for (; *q >= 'Z'; ++q)
    ;
  ++(*q);
  *p++ = '1';
  *p++ = '0';
  *p++ = ':';
  memcpy(p, txid, 10);
  return p + 10;
}


x86 assembly (clang, -O0):
<btxid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2efd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <badds@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jl     1171 <btxid+0x51>
jmp    1160 <btxid+0x40>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114b <btxid+0x2b>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
add    $0x1,%cl
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x31,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x30,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x3a,(%rax)
mov    -0x8(%rbp),%rdi
lea    0x2e73(%rip),%rsi
mov    $0xa,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0xa,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btxid>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1030 <badds@plt>
mov    %rax,%rbx
lea    0x2ef9(%rip),%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
add    $0x1,%rax
cmp    $0x59,%cl
jg     1140 <btxid+0x20>
add    $0x1,%cl
mov    %cl,-0x1(%rax)
movw   $0x3031,(%rbx)
lea    0x3(%rbx),%rdi
movb   $0x3a,0x2(%rbx)
lea    0x2eca(%rip),%rsi
mov    $0xa,%edx
call   1040 <memcpy@plt>
add    $0xd,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@btxid.txid = internal global [10 x i8] c"@BCDEABCDE"
@.str = [5 x i8] c"txid\00"
define i8* @btxid(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @btxid.txid, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = call i8* @badds(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %2
br label %6
6: ; preds = %12, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 90
br i1 %10, label %11, label %15
11: ; preds = %6
br label %12
12: ; preds = %11
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
br label %6
15: ; preds = %6
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = add i8 %17, 1
store i8 %18, i8* %16
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
store i8 49, i8* %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %2
store i8 48, i8* %21
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %2
store i8 58, i8* %23
%25 = load i8*, i8** %2
%26 = call i32 @memcpy(i8* %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @btxid.txid, i64 0, i64 0), i32 10)
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 10
ret i8* %28
}

LLVM IR (-O2):
@btxid.txid = internal global [10 x i8] c"@BCDEABCDE"
@.str = [5 x i8] c"txid\00"
define i8* @btxid(i8* %0) {
%2 = tail call i8* @badds(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %3, %1
%4 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @btxid.txid, i64 0, i64 0), %1 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp sgt i8 %5, 89
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %3, label %8
8: ; preds = %3
%9 = add nsw i8 %5, 1
store i8 %9, i8* %4
%10 = getelementptr inbounds i8, i8* %2, i64 1
store i8 49, i8* %2
%11 = getelementptr inbounds i8, i8* %2, i64 2
store i8 48, i8* %10
%12 = getelementptr inbounds i8, i8* %2, i64 3
store i8 58, i8* %11
%13 = tail call i32 @memcpy(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @btxid.txid, i64 0, i64 0), i32 10)
%14 = getelementptr inbounds i8, i8* %2, i64 13
ret i8* %14
}