#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*/ isspace(char);
int /*<<< orphan*/ printf(char *, char *);
void emit_word(char *line) {
  int num_words;
  int in_word;
  char word[200];
  char *word_ptr;
  word_ptr = &word[0];
  num_words = 0;
  in_word = 0;
  while (*line != 0) {
    if (!isspace(*line)) {
      *word_ptr++ = *line;
    } else {
      *word_ptr = 0;
      word_ptr = word;
      printf("%s\t1\n", word);
    }
    line++;
  }
}


x86 assembly (clang, -O0):
<emit_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ce <emit_word+0xae>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1192 <emit_word+0x72>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0xe8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0xe8(%rbp)
mov    %cl,(%rax)
jmp    11bd <emit_word+0x9d>
mov    -0xe8(%rbp),%rax
movb   $0x0,(%rax)
lea    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
lea    -0xe0(%rbp),%rsi
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114b <emit_word+0x2b>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_word>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    (%rdi),%al
test   %al,%al
je     1188 <emit_word+0x68>
mov    %rdi,%rbx
mov    %rsp,%r14
add    $0x1,%rbx
lea    0xebb(%rip),%r15
mov    %r14,%r12
jmp    116e <emit_word+0x4e>
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%r12)
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %r14,%r12
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1188 <emit_word+0x68>
movsbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1150 <emit_word+0x30>
movzbl -0x1(%rbx),%eax
mov    %al,(%r12)
add    $0x1,%r12
jmp    1163 <emit_word+0x43>
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s\091\0A\00"
define void @emit_word(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [200 x i8]
%6 = alloca i8*
store i8* %0, i8** %2
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
store i8* %7, i8** %6
store i32 0, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %28, %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %31
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = call i32 @isspace(i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = load i8*, i8** %6
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %6
store i8 %20, i8* %21
br label %28
23: ; preds = %13
%24 = load i8*, i8** %6
store i8 0, i8* %24
%25 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
store i8* %25, i8** %6
%26 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %23, %18
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %2
br label %8
31: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s\091\0A\00"
define void @emit_word(i8* nocapture %0) {
%2 = alloca [200 x i8]
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %1, %17
%7 = phi i8 [ %20, %17 ], [ %4, %1 ]
%8 = phi i8* [ %18, %17 ], [ %3, %1 ]
%9 = phi i8* [ %19, %17 ], [ %0, %1 ]
%10 = call i32 @isspace(i8 signext %7)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = load i8, i8* %9
%14 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %13, i8* %8
br label %17
15: ; preds = %6
store i8 0, i8* %8
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %17
17: ; preds = %15, %12
%18 = phi i8* [ %3, %15 ], [ %14, %12 ]
%19 = getelementptr inbounds i8, i8* %9, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %6
22: ; preds = %17, %1
ret void
}