#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 *column_fill_characters(char *destination, char *string) {
  int double_quote_flag = 0;
  while (*string) {
    if (*string == '"') {
      double_quote_flag = 1 - double_quote_flag;
      string++;
      continue;
    }
    if (double_quote_flag) {
      *destination++ = *string++;
      continue;
    } else if (isspace(*string)) {
      break;
    } else {
      *destination++ = *string++;
    }
  }
  *destination = '\0';
  return string;
}


x86 assembly (clang, -O0):
<column_fill_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d8 <column_fill_characters+0xc8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1160 <column_fill_characters+0x50>
mov    $0x1,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1127 <column_fill_characters+0x17>
cmpl   $0x0,-0x14(%rbp)
je     1191 <column_fill_characters+0x81>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1127 <column_fill_characters+0x17>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11ac <column_fill_characters+0x9c>
jmp    11d8 <column_fill_characters+0xc8>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    11d3 <column_fill_characters+0xc3>
jmp    1127 <column_fill_characters+0x17>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<column_fill_characters>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %eax,%eax
jmp    112d <column_fill_characters+0x1d>
xchg   %ax,%ax
mov    $0x1,%ecx
sub    %eax,%ecx
add    $0x1,%rbx
mov    %ecx,%eax
movzbl (%rbx),%ecx
cmp    $0x22,%cl
je     1120 <column_fill_characters+0x10>
test   %cl,%cl
je     1163 <column_fill_characters+0x53>
mov    $0x1,%edx
test   %eax,%eax
jne    1154 <column_fill_characters+0x44>
movsbl %cl,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1163 <column_fill_characters+0x53>
movzbl (%rbx),%ecx
xor    %edx,%edx
add    $0x1,%rbx
mov    %cl,(%r14)
add    $0x1,%r14
mov    %edx,%eax
jmp    112d <column_fill_characters+0x1d>
movb   $0x0,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @column_fill_characters(i8* nocapture writeonly %0, i8* %1) {
br label %3
3: ; preds = %16, %2
%4 = phi i8* [ %0, %2 ], [ %20, %16 ]
%5 = phi i8* [ %1, %2 ], [ %19, %16 ]
%6 = phi i32 [ 0, %2 ], [ %18, %16 ]
br label %7
7: ; preds = %3, %11
%8 = phi i8* [ %13, %11 ], [ %5, %3 ]
%9 = phi i32 [ %12, %11 ], [ %6, %3 ]
%10 = load i8, i8* %8
switch i8 %10, label %14 [
i8 0, label %26
i8 34, label %11
]
11: ; preds = %7
%12 = sub nsw i32 1, %9
%13 = getelementptr inbounds i8, i8* %8, i64 1
br label %7
14: ; preds = %7
%15 = icmp eq i32 %9, 0
br i1 %15, label %21, label %16
16: ; preds = %14, %24
%17 = phi i8 [ %25, %24 ], [ %10, %14 ]
%18 = phi i32 [ 0, %24 ], [ 1, %14 ]
%19 = getelementptr inbounds i8, i8* %8, i64 1
%20 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %17, i8* %4
br label %3
21: ; preds = %14
%22 = tail call i64 @isspace(i8 signext %10)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i8, i8* %8
br label %16
26: ; preds = %21, %7
store i8 0, i8* %4
ret i8* %8
}