#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*/ snprintf(char *, size_t, char *, unsigned long long,
                            char const *);
void format_dmy(char *dest, size_t size, const char *name,
                unsigned long long count) {
  if (count == 1)
    snprintf(dest, size, "%llu %s, ", count, name);
  else if (count > 1)
    snprintf(dest, size, "%llu %ss, ", count, name);
  else
    dest[0] = '\0';
}


x86 assembly (clang, -O0):
<format_dmy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x1,-0x20(%rbp)
jne    1154 <format_dmy+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xeb6(%rip),%rdx
call   1030 <snprintf@plt>
jmp    118c <format_dmy+0x7c>
cmpq   $0x1,-0x20(%rbp)
jbe    1180 <format_dmy+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe94(%rip),%rdx
call   1030 <snprintf@plt>
jmp    1187 <format_dmy+0x77>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    118c <format_dmy+0x7c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_dmy>:
test   %rcx,%rcx
je     112f <format_dmy+0x1f>
mov    %rdx,%r8
cmp    $0x1,%rcx
jne    1133 <format_dmy+0x23>
lea    0xedb(%rip),%rdx
mov    $0x1,%ecx
jmp    1030 <snprintf@plt>
movb   $0x0,(%rdi)
ret
lea    0xed0(%rip),%rdx
jmp    1030 <snprintf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"%llu %s, \00"
@.str.1 = [11 x i8] c"%llu %ss, \00"
define void @format_dmy(i8* %0, i64 %1, i8* %2, i64 %3) {
switch i64 %3, label %7 [
i64 1, label %5
i64 0, label %9
]
5: ; preds = %4
%6 = tail call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 1, i8* %2)
br label %10
7: ; preds = %4
%8 = tail call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %3, i8* %2)
br label %10
9: ; preds = %4
store i8 0, i8* %0
br label %10
10: ; preds = %7, %9, %5
ret void
}