#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);
void write_data(char *into, char **text) {
  int k = 0;
  char *from = *text;
  while (!(isspace(*(from)) && isspace(*(from + 1))))
    into[k++] = *(from++);
  *text = from;
}


x86 assembly (clang, -O0):
<write_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     1167 <write_data+0x57>
mov    -0x20(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1179 <write_data+0x69>
jmp    11a4 <write_data+0x94>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1132 <write_data+0x22>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_data>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rsi),%rbx
jmp    112e <write_data+0x1e>
movzbl (%rbx),%eax
add    $0x1,%rbx
mov    %al,(%r15)
add    $0x1,%r15
movsbl (%rbx),%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1120 <write_data+0x10>
movsbl 0x1(%rbx),%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1120 <write_data+0x10>
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @write_data(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
store i32 0, i32* %5
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
store i8* %8, i8** %6
br label %9
9: ; preds = %23, %2
%10 = load i8*, i8** %6
%11 = load i8, i8* %10
%12 = call i64 @isspace(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = call i64 @isspace(i8 signext %17)
%19 = icmp ne i64 %18, 0
br label %20
20: ; preds = %14, %9
%21 = phi i1 [ false, %9 ], [ %19, %14 ]
%22 = xor i1 %21, true
br i1 %22, label %23, label %32
23: ; preds = %20
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %6
%26 = load i8, i8* %24
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
store i8 %26, i8* %31
br label %9
32: ; preds = %20
%33 = load i8*, i8** %6
%34 = load i8**, i8*** %4
store i8* %33, i8** %34
ret void
}

LLVM IR (-O2):
define void @write_data(i8* nocapture writeonly %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
br label %4
4: ; preds = %15, %2
%5 = phi i64 [ %18, %15 ], [ 0, %2 ]
%6 = phi i8* [ %16, %15 ], [ %3, %2 ]
%7 = load i8, i8* %6
%8 = tail call i64 @isspace(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = tail call i64 @isspace(i8 signext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %4, %10
%16 = getelementptr inbounds i8, i8* %6, i64 1
%17 = load i8, i8* %6
%18 = add nuw i64 %5, 1
%19 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %17, i8* %19
br label %4
20: ; preds = %10
store i8* %6, i8** %1
ret void
}