#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*/ litchar(char **);
int /*<<< orphan*/ stowlit(int /*<<< orphan*/);
char *unpackedstring(char *lptr) {
  while (*lptr != '\"' && *lptr != '\0') {
    if (*lptr == '\a') {
      lptr++;
      continue;
    }
    stowlit(litchar(&lptr));
  }
  stowlit(0);
  return lptr;
}


x86 assembly (clang, -O0):
<unpackedstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x22,%ecx
mov    %al,-0x9(%rbp)
je     1151 <unpackedstring+0x31>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1161 <unpackedstring+0x41>
jmp    1197 <unpackedstring+0x77>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7,%eax
jne    1182 <unpackedstring+0x62>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <unpackedstring+0xc>
lea    -0x8(%rbp),%rdi
call   1040 <litchar@plt>
mov    %eax,%edi
call   1030 <stowlit@plt>
jmp    112c <unpackedstring+0xc>
xor    %edi,%edi
call   1030 <stowlit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpackedstring>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rbx
jmp    1149 <unpackedstring+0x29>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdi
mov    %rdi,0x8(%rsp)
movzbl (%rdi),%eax
cmp    $0x7,%al
je     1140 <unpackedstring+0x20>
test   %al,%al
je     116e <unpackedstring+0x4e>
cmp    $0x22,%al
je     116e <unpackedstring+0x4e>
mov    %rbx,%rdi
call   1040 <litchar@plt>
mov    %eax,%edi
call   1030 <stowlit@plt>
mov    0x8(%rsp),%rdi
jmp    1149 <unpackedstring+0x29>
xor    %edi,%edi
call   1030 <stowlit@plt>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @unpackedstring(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %23, %20, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 34
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %26
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 7
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %2
br label %3
23: ; preds = %15
%24 = call i32 @litchar(i8** %2)
%25 = call i32 @stowlit(i32 %24)
br label %3
26: ; preds = %13
%27 = call i32 @stowlit(i32 0)
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
define i8* @unpackedstring(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = phi i8* [ %0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %4
switch i8 %5, label %10 [
i8 34, label %14
i8 0, label %14
i8 7, label %6
]
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %7, i8** %2
br label %8
8: ; preds = %6, %10
%9 = phi i8* [ %7, %6 ], [ %13, %10 ]
br label %3
10: ; preds = %3
%11 = call i32 @litchar(i8** %2)
%12 = call i32 @stowlit(i32 %11)
%13 = load i8*, i8** %2
br label %8
14: ; preds = %3, %3
%15 = call i32 @stowlit(i32 0)
%16 = load i8*, i8** %2
ret i8* %16
}