#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*/ decode_quoted(char *);
int strlen(char *);
void dequote_string(char *s) {
  int len, i, j;
  len = strlen(s);
  if (*s == 0x22 && *(s + len - 1) == 0x22) {
    for (i = 1, j = 0; i < len - 1; i++, j++) {
      *(s + j) = *(s + i);
    }
    *(s + j) = '\0';
    decode_quoted(s);
  }
}


x86 assembly (clang, -O0):
<dequote_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11bf <dequote_string+0x9f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl -0x1(%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    11bf <dequote_string+0x9f>
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11aa <dequote_string+0x8a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116c <dequote_string+0x4c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <decode_quoted@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dequote_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmpb   $0x22,(%rbx)
jne    1168 <dequote_string+0x38>
mov    %eax,%r14d
cltq
cmpb   $0x22,-0x1(%rbx,%rax,1)
jne    1168 <dequote_string+0x38>
cmp    $0x3,%r14d
jl     1170 <dequote_string+0x40>
lea    0x1(%rbx),%rsi
add    $0xfffffffe,%r14d
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <memmove@plt>
jmp    1173 <dequote_string+0x43>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %r14d,%r14d
movb   $0x0,(%rbx,%r14,1)
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <decode_quoted@plt>

LLVM IR (-O0):
define void @dequote_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 34
br i1 %11, label %12, label %49
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = getelementptr inbounds i8, i8* %16, i64 -1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 34
br i1 %20, label %21, label %49
21: ; preds = %12
store i32 1, i32* %4
store i32 0, i32* %5
br label %22
22: ; preds = %37, %21
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 1
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %42
27: ; preds = %22
%28 = load i8*, i8** %2
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = load i8*, i8** %2
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 %32, i8* %36
br label %37
37: ; preds = %27
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %22
42: ; preds = %22
%43 = load i8*, i8** %2
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
store i8 0, i8* %46
%47 = load i8*, i8** %2
%48 = call i32 @decode_quoted(i8* %47)
br label %49
49: ; preds = %42, %12, %1
ret void
}

LLVM IR (-O2):
define void @dequote_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 34
br i1 %4, label %5, label %23
5: ; preds = %1
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 34
br i1 %10, label %11, label %23
11: ; preds = %5
%12 = icmp sgt i32 %2, 2
br i1 %12, label %13, label %19
13: ; preds = %11
%14 = getelementptr i8, i8* %0, i64 1
%15 = add nsw i32 %2, -2
%16 = zext i32 %15 to i64
%17 = add nsw i32 %2, -2
%18 = zext i32 %17 to i64
br label %19
19: ; preds = %13, %11
%20 = phi i64 [ 0, %11 ], [ %18, %13 ]
%21 = getelementptr inbounds i8, i8* %0, i64 %20
store i8 0, i8* %21
%22 = tail call i32 @decode_quoted(i8* %0)
br label %23
23: ; preds = %19, %5, %1
ret void
}