#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*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
void print_word(char *word, int *len, int *col_count) {
  int _len = *len;
  int _col_count = *col_count;
  word[_len] = '\0';
  if (_col_count + _len > 80) {
    putchar('\n');
    *col_count = 0;
  }
  *col_count += _len;
  printf("%s", word);
  *len = 0;
}


x86 assembly (clang, -O0):
<print_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    $0x50,%eax
jle    1175 <print_word+0x55>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_word>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
movslq (%rsi),%rbx
mov    (%rdx),%eax
add    %ebx,%eax
movb   $0x0,(%rdi,%rbx,1)
cmp    $0x50,%eax
jle    114f <print_word+0x2f>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
jmp    1153 <print_word+0x33>
mov    (%r12),%eax
add    %ebx,%eax
mov    %eax,(%r12)
lea    0xea0(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
movl   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @print_word(i8* %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = sext i32 %4 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %7
%8 = add nsw i32 %5, %4
%9 = icmp sgt i32 %8, 80
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = load i32, i32* %2
br label %14
12: ; preds = %3
%13 = tail call i32 @putchar(i8 signext 10)
br label %14
14: ; preds = %10, %12
%15 = phi i32 [ %11, %10 ], [ 0, %12 ]
%16 = add nsw i32 %15, %4
store i32 %16, i32* %2
%17 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
store i32 0, i32* %1
ret void
}