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

/* Variables and functions */
int /*<<< orphan*/ convertEscape(struct gff3Ann *, char *, char *);
void unescapeStr(struct gff3Ann *g3a, char *dest, char *src) {
  char *s = src, *d = dest;
  while (*s != '\0') {
    if (*s == '%') {
      *d++ = convertEscape(g3a, s, src);
      s += 3;
    } else
      *d++ = *s++;
  }
  *d = '\0';
}


x86 assembly (clang, -O0):
<unescapeStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b0 <unescapeStr+0xa0>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    1189 <unescapeStr+0x79>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <convertEscape@plt>
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x20(%rbp)
jmp    11ab <unescapeStr+0x9b>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1134 <unescapeStr+0x24>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unescapeStr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
mov    %rdx,%rbx
jmp    114a <unescapeStr+0x3a>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <convertEscape@plt>
mov    %al,(%r12)
add    $0x3,%rbx
add    $0x1,%r12
movzbl (%rbx),%eax
cmp    $0x25,%al
je     1130 <unescapeStr+0x20>
test   %al,%al
je     1163 <unescapeStr+0x53>
add    $0x1,%rbx
mov    %al,(%r12)
add    $0x1,%r12
jmp    114a <unescapeStr+0x3a>
movb   $0x0,(%r12)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.gff3Ann = type { i32 }
define void @unescapeStr(%struct.gff3Ann* %0, i8* %1, i8* %2) {
%4 = alloca %struct.gff3Ann*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store %struct.gff3Ann* %0, %struct.gff3Ann** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
store i8* %9, i8** %7
%10 = load i8*, i8** %5
store i8* %10, i8** %8
br label %11
11: ; preds = %37, %3
%12 = load i8*, i8** %7
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %38
16: ; preds = %11
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 37
br i1 %20, label %21, label %31
21: ; preds = %16
%22 = load %struct.gff3Ann*, %struct.gff3Ann** %4
%23 = load i8*, i8** %7
%24 = load i8*, i8** %6
%25 = call i32 @convertEscape(%struct.gff3Ann* %22, i8* %23, i8* %24)
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %8
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %8
store i8 %26, i8* %27
%29 = load i8*, i8** %7
%30 = getelementptr inbounds i8, i8* %29, i64 3
store i8* %30, i8** %7
br label %37
31: ; preds = %16
%32 = load i8*, i8** %7
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %7
%34 = load i8, i8* %32
%35 = load i8*, i8** %8
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %8
store i8 %34, i8* %35
br label %37
37: ; preds = %31, %21
br label %11
38: ; preds = %11
%39 = load i8*, i8** %8
store i8 0, i8* %39
ret void
}

LLVM IR (-O2):
%struct.gff3Ann = type { i32 }
define void @unescapeStr(%struct.gff3Ann* %0, i8* nocapture writeonly %1, i8* %2) {
br label %4
4: ; preds = %14, %3
%5 = phi i8* [ %2, %3 ], [ %15, %14 ]
%6 = phi i8* [ %1, %3 ], [ %16, %14 ]
%7 = load i8, i8* %5
switch i8 %7, label %12 [
i8 0, label %17
i8 37, label %8
]
8: ; preds = %4
%9 = tail call i32 @convertEscape(%struct.gff3Ann* %0, i8* %5, i8* %2)
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
%11 = getelementptr inbounds i8, i8* %5, i64 3
br label %14
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %6
br label %14
14: ; preds = %12, %8
%15 = phi i8* [ %11, %8 ], [ %13, %12 ]
%16 = getelementptr inbounds i8, i8* %6, i64 1
br label %4
17: ; preds = %4
store i8 0, i8* %6
ret void
}