#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*/ EnvPrintRouter(void *, char const *, char const *);
int /*<<< orphan*/ PrintLongInteger(void *, char const *, long long);
void PrintTally(void *theEnv, const char *logicalName, long long count,
                const char *singular, const char *plural) {
  if (count == 0)
    return;
  EnvPrintRouter(theEnv, logicalName, "For a total of ");
  PrintLongInteger(theEnv, logicalName, count);
  EnvPrintRouter(theEnv, logicalName, " ");
  if (count == 1)
    EnvPrintRouter(theEnv, logicalName, singular);
  else
    EnvPrintRouter(theEnv, logicalName, plural);
  EnvPrintRouter(theEnv, logicalName, ".\n");
}


x86 assembly (clang, -O0):
<PrintTally>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114c <PrintTally+0x2c>
jmp    11cb <PrintTally+0xab>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xea5(%rip),%rdx
call   1030 <EnvPrintRouter@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <PrintLongInteger@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdx
call   1030 <EnvPrintRouter@plt>
cmpq   $0x1,-0x18(%rbp)
jne    11a6 <PrintTally+0x86>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <EnvPrintRouter@plt>
jmp    11b7 <PrintTally+0x97>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <EnvPrintRouter@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe4a(%rip),%rdx
call   1030 <EnvPrintRouter@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintTally>:
test   %rdx,%rdx
je     119a <PrintTally+0x7a>
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebc(%rip),%rdx
call   1030 <EnvPrintRouter@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1040 <PrintLongInteger@plt>
lea    0xeb0(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <EnvPrintRouter@plt>
cmp    $0x1,%r13
cmove  %r12,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <EnvPrintRouter@plt>
lea    0xe8a(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <EnvPrintRouter@plt>
ret

LLVM IR (-O0):
@.str = [16 x i8] c"For a total of \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c".\0A\00"
define void @PrintTally(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i64, i64* %8
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %5
br label %41
14: ; preds = %5
%15 = load i8*, i8** %6
%16 = load i8*, i8** %7
%17 = call i32 @EnvPrintRouter(i8* %15, i8* %16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = load i64, i64* %8
%21 = call i32 @PrintLongInteger(i8* %18, i8* %19, i64 %20)
%22 = load i8*, i8** %6
%23 = load i8*, i8** %7
%24 = call i32 @EnvPrintRouter(i8* %22, i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = load i64, i64* %8
%26 = icmp eq i64 %25, 1
br i1 %26, label %27, label %32
27: ; preds = %14
%28 = load i8*, i8** %6
%29 = load i8*, i8** %7
%30 = load i8*, i8** %9
%31 = call i32 @EnvPrintRouter(i8* %28, i8* %29, i8* %30)
br label %37
32: ; preds = %14
%33 = load i8*, i8** %6
%34 = load i8*, i8** %7
%35 = load i8*, i8** %10
%36 = call i32 @EnvPrintRouter(i8* %33, i8* %34, i8* %35)
br label %37
37: ; preds = %32, %27
%38 = load i8*, i8** %6
%39 = load i8*, i8** %7
%40 = call i32 @EnvPrintRouter(i8* %38, i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %37, %13
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"For a total of \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c".\0A\00"
define void @PrintTally(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4) {
%6 = icmp eq i64 %2, 0
br i1 %6, label %15, label %7
7: ; preds = %5
%8 = tail call i32 @EnvPrintRouter(i8* %0, i8* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @PrintLongInteger(i8* %0, i8* %1, i64 %2)
%10 = tail call i32 @EnvPrintRouter(i8* %0, i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %2, 1
%12 = select i1 %11, i8* %3, i8* %4
%13 = tail call i32 @EnvPrintRouter(i8* %0, i8* %1, i8* %12)
%14 = tail call i32 @EnvPrintRouter(i8* %0, i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %5, %7
ret void
}