#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 */
scalar_t__ isspace(char);
char *strsep(char **, char *);
char *get_value(char **buffer) {
  static char *quote_string = "\"\n";
  static char *comma_string = ",\n";
  char *val;
  char *end;
  if (**buffer == '"') {
    (*buffer)++;
    end = quote_string;
  } else {
    end = comma_string;
  }
  val = strsep(buffer, end);
  if (val && end == quote_string)
    (*buffer)++;
  while (isspace(**buffer))
    (*buffer)++;
  return val;
}


x86 assembly (clang, -O0):
<get_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    115d <get_value+0x3d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    0x2edc(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1168 <get_value+0x48>
mov    0x2ed4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strsep@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a3 <get_value+0x83>
mov    -0x18(%rbp),%rax
cmp    0x2ea1(%rip),%rax
jne    11a3 <get_value+0x83>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    11a8 <get_value+0x88>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11d4 <get_value+0xb4>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    11a8 <get_value+0x88>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_value>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rcx
lea    0xecf(%rip),%rax
lea    0xecb(%rip),%rsi
cmp    %rax,%rsi
sete   %bpl
cmpb   $0x22,(%rcx)
jne    1151 <get_value+0x31>
add    $0x1,%rcx
mov    %rcx,(%rbx)
mov    $0x1,%bpl
mov    %rax,%rsi
mov    %rbx,%rdi
call   1040 <strsep@plt>
mov    %rax,%r14
mov    (%rbx),%rax
test   $0x1,%bpl
je     1171 <get_value+0x51>
test   %r14,%r14
je     1171 <get_value+0x51>
add    $0x1,%rax
mov    %rax,(%rbx)
movsbl (%rax),%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <isspace@plt>
test   %rax,%rax
je     119a <get_value+0x7a>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl 0x1(%rax),%edi
jmp    1180 <get_value+0x60>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@get_value.quote_string = internal global i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0)
@.str = [3 x i8] c"\22\0A\00"
@get_value.comma_string = internal global i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0)
@.str.1 = [3 x i8] c",\0A\00"
define i8* @get_value(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8*
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 34
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i8**, i8*** %2
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %11
%14 = load i8*, i8** @get_value.quote_string
store i8* %14, i8** %4
br label %17
15: ; preds = %1
%16 = load i8*, i8** @get_value.comma_string
store i8* %16, i8** %4
br label %17
17: ; preds = %15, %10
%18 = load i8**, i8*** %2
%19 = load i8*, i8** %4
%20 = call i8* @strsep(i8** %18, i8* %19)
store i8* %20, i8** %3
%21 = load i8*, i8** %3
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %31
23: ; preds = %17
%24 = load i8*, i8** %4
%25 = load i8*, i8** @get_value.quote_string
%26 = icmp eq i8* %24, %25
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i8**, i8*** %2
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %28
br label %31
31: ; preds = %27, %23, %17
br label %32
32: ; preds = %38, %31
%33 = load i8**, i8*** %2
%34 = load i8*, i8** %33
%35 = load i8, i8* %34
%36 = call i64 @isspace(i8 signext %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = load i8**, i8*** %2
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %39
br label %32
42: ; preds = %32
%43 = load i8*, i8** %3
ret i8* %43
}

LLVM IR (-O2):
@.str = [3 x i8] c"\22\0A\00"
@.str.1 = [3 x i8] c",\0A\00"
define i8* @get_value(i8** %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 34
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %6, i8** %0
br label %7
7: ; preds = %1, %5
%8 = phi i1 [ true, %5 ], [ icmp eq (i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)), %1 ]
%9 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %1 ]
%10 = tail call i8* @strsep(i8** %0, i8* %9)
%11 = icmp ne i8* %10, null
%12 = and i1 %8, %11
%13 = load i8*, i8** %0
br i1 %12, label %14, label %16
14: ; preds = %7
%15 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %15, i8** %0
br label %16
16: ; preds = %7, %14
%17 = phi i8* [ %15, %14 ], [ %13, %7 ]
%18 = load i8, i8* %17
%19 = tail call i64 @isspace(i8 signext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %16, %21
%22 = load i8*, i8** %0
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %23, i8** %0
%24 = load i8, i8* %23
%25 = tail call i64 @isspace(i8 signext %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %21
27: ; preds = %21, %16
ret i8* %10
}