#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 const *process_string(char const *, size_t);
int /*<<< orphan*/ skip_quotes(char const **);
const char *get_quoted_string(const char **string) {
  const char *string_start = *string;
  size_t string_len = 0;
  skip_quotes(string);
  if (**string == '\0')
    return NULL;
  string_len = *string - string_start - 2;
  return process_string(string_start + 1, string_len);
}


x86 assembly (clang, -O0):
<get_quoted_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <skip_quotes@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1168 <get_quoted_string+0x48>
movq   $0x0,-0x8(%rbp)
jmp    1193 <get_quoted_string+0x73>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
sub    $0x2,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    -0x20(%rbp),%rsi
call   1030 <process_string@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_quoted_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r14
call   1040 <skip_quotes@plt>
mov    (%rbx),%rsi
cmpb   $0x0,(%rsi)
je     1151 <get_quoted_string+0x31>
sub    %r14,%rsi
add    $0xfffffffffffffffe,%rsi
add    $0x1,%r14
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <process_string@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @get_quoted_string(i8** %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i64
store i8** %0, i8*** %3
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %4
store i64 0, i64* %5
%8 = load i8**, i8*** %3
%9 = call i32 @skip_quotes(i8** %8)
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %1
store i8* null, i8** %2
br label %28
16: ; preds = %1
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %17
%19 = load i8*, i8** %4
%20 = ptrtoint i8* %18 to i64
%21 = ptrtoint i8* %19 to i64
%22 = sub i64 %20, %21
%23 = sub nsw i64 %22, 2
store i64 %23, i64* %5
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i64, i64* %5
%27 = call i8* @process_string(i8* %25, i64 %26)
store i8* %27, i8** %2
br label %28
28: ; preds = %16, %15
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
define i8* @get_quoted_string(i8** %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @skip_quotes(i8** %0)
%4 = load i8*, i8** %0
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %2 to i64
%10 = sub i64 -2, %9
%11 = add i64 %10, %8
%12 = getelementptr inbounds i8, i8* %2, i64 1
%13 = tail call i8* @process_string(i8* %12, i64 %11)
br label %14
14: ; preds = %1, %7
%15 = phi i8* [ %13, %7 ], [ null, %1 ]
ret i8* %15
}