#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
void do_update_line_count(FILE *out, int *lines, int *words_in_line) {
  ++*lines;
  if (*words_in_line < 2) {
    fprintf(out, "line %d has %d word\n", *lines, *words_in_line);
  } else {
    fprintf(out, "line %d has %d words\n", *lines, *words_in_line);
  }
  *words_in_line = 0;
}


x86 assembly (clang, -O0):
<do_update_line_count>:
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),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x2,(%rax)
jge    115d <do_update_line_count+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xead(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1179 <do_update_line_count+0x69>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xea1(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_update_line_count>:
push   %rbx
mov    %rdx,%rbx
mov    (%rsi),%edx
add    $0x1,%edx
mov    %edx,(%rsi)
mov    (%rbx),%ecx
cmp    $0x2,%ecx
lea    0xed9(%rip),%rax
lea    0xee7(%rip),%rsi
cmovl  %rax,%rsi
call   1030 <fprintf@plt>
movl   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"line %d has %d word\0A\00"
@.str.1 = [22 x i8] c"line %d has %d words\0A\00"
define void @do_update_line_count(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %3
%14 = load i32*, i32** %4
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18)
br label %27
20: ; preds = %3
%21 = load i32*, i32** %4
%22 = load i32*, i32** %5
%23 = load i32, i32* %22
%24 = load i32*, i32** %6
%25 = load i32, i32* %24
%26 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %25)
br label %27
27: ; preds = %20, %13
%28 = load i32*, i32** %6
store i32 0, i32* %28
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"line %d has %d word\0A\00"
@.str.1 = [22 x i8] c"line %d has %d words\0A\00"
define void @do_update_line_count(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 2
%8 = select i1 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%9 = tail call i32 @fprintf(i32* %0, i8* %8, i32 %5, i32 %6)
store i32 0, i32* %2
ret void
}