#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 */
unsigned int count_digits(unsigned int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *stderr;
size_t strlen(char const *);
void print_stats(const char *str1, unsigned stat1, const char *str2,
                 unsigned stat2) {
  size_t i;
  unsigned digits;
  FILE *fp = stderr;
  digits = count_digits(stat1);
  fprintf(fp, "%s", str1);
  for (i = strlen(str1); i < 16; i++)
    fprintf(fp, ".");
  for (i = digits; i < 11; i++)
    fprintf(fp, ".");
  fprintf(fp, "%d", stat1);
  fprintf(fp, " ");
  if (str2) {
    digits = count_digits(stat2);
    fprintf(fp, "%s", str2);
    for (i = strlen(str2); i < 16; i++)
      fprintf(fp, ".");
    for (i = digits; i < 11; i++)
      fprintf(fp, ".");
    fprintf(fp, "%d", stat2);
  }
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<print_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <count_digits@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x10,-0x28(%rbp)
jae    11b0 <print_stats+0x80>
mov    -0x38(%rbp),%rdi
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1182 <print_stats+0x52>
mov    -0x2c(%rbp),%eax
mov    %rax,-0x28(%rbp)
cmpq   $0xb,-0x28(%rbp)
jae    11e5 <print_stats+0xb5>
mov    -0x38(%rbp),%rdi
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11b7 <print_stats+0x87>
mov    -0x38(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     12bd <print_stats+0x18d>
mov    -0x1c(%rbp),%edi
call   1040 <count_digits@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xdcf(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x10,-0x28(%rbp)
jae    1273 <print_stats+0x143>
mov    -0x38(%rbp),%rdi
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1245 <print_stats+0x115>
mov    -0x2c(%rbp),%eax
mov    %rax,-0x28(%rbp)
cmpq   $0xb,-0x28(%rbp)
jae    12a8 <print_stats+0x178>
mov    -0x38(%rbp),%rdi
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    127a <print_stats+0x14a>
mov    -0x38(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xd4f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%rdi
lea    0xd3c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_stats>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%rbp
mov    0x2e72(%rip),%rax
mov    (%rax),%rbx
mov    %esi,%edi
call   1050 <count_digits@plt>
mov    %eax,%r13d
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
cmp    $0xf,%rax
ja     11b2 <print_stats+0x62>
mov    %rax,%rbp
add    $0xfffffffffffffff0,%rbp
nopl   0x0(%rax,%rax,1)
mov    $0x2e,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
inc    %rbp
jne    11a0 <print_stats+0x50>
cmp    $0xa,%r13d
ja     11d2 <print_stats+0x82>
mov    %r13d,%ebp
add    $0xfffffffffffffff5,%rbp
nop
mov    $0x2e,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
inc    %rbp
jne    11c0 <print_stats+0x70>
lea    0xe27(%rip),%rsi
mov    %rbx,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
test   %r15,%r15
je     1276 <print_stats+0x126>
mov    %r14d,%edi
call   1050 <count_digits@plt>
mov    %eax,%r12d
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    $0xf,%rax
ja     1242 <print_stats+0xf2>
mov    %rax,%rbp
add    $0xfffffffffffffff0,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2e,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
inc    %rbp
jne    1230 <print_stats+0xe0>
cmp    $0xa,%r12d
ja     1262 <print_stats+0x112>
mov    %r12d,%ebp
add    $0xfffffffffffffff5,%rbp
nop
mov    $0x2e,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
inc    %rbp
jne    1250 <print_stats+0x100>
lea    0xd97(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%rsi
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <fputc@plt>

LLVM IR (-O0):
@stderr = global i32* null
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @print_stats(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%12 = load i32*, i32** @stderr
store i32* %12, i32** %11
%13 = load i32, i32* %6
%14 = call i32 @count_digits(i32 %13)
store i32 %14, i32* %10
%15 = load i32*, i32** %11
%16 = load i8*, i8** %5
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %5
%19 = call i64 @strlen(i8* %18)
store i64 %19, i64* %9
br label %20
20: ; preds = %26, %4
%21 = load i64, i64* %9
%22 = icmp ult i64 %21, 16
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i32*, i32** %11
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %23
%27 = load i64, i64* %9
%28 = add i64 %27, 1
store i64 %28, i64* %9
br label %20
29: ; preds = %20
%30 = load i32, i32* %10
%31 = zext i32 %30 to i64
store i64 %31, i64* %9
br label %32
32: ; preds = %38, %29
%33 = load i64, i64* %9
%34 = icmp ult i64 %33, 11
br i1 %34, label %35, label %41
35: ; preds = %32
%36 = load i32*, i32** %11
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %35
%39 = load i64, i64* %9
%40 = add i64 %39, 1
store i64 %40, i64* %9
br label %32
41: ; preds = %32
%42 = load i32*, i32** %11
%43 = load i32, i32* %6
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i32*, i32** %11
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = load i8*, i8** %7
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %82
49: ; preds = %41
%50 = load i32, i32* %8
%51 = call i32 @count_digits(i32 %50)
store i32 %51, i32* %10
%52 = load i32*, i32** %11
%53 = load i8*, i8** %7
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %53)
%55 = load i8*, i8** %7
%56 = call i64 @strlen(i8* %55)
store i64 %56, i64* %9
br label %57
57: ; preds = %63, %49
%58 = load i64, i64* %9
%59 = icmp ult i64 %58, 16
br i1 %59, label %60, label %66
60: ; preds = %57
%61 = load i32*, i32** %11
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %63
63: ; preds = %60
%64 = load i64, i64* %9
%65 = add i64 %64, 1
store i64 %65, i64* %9
br label %57
66: ; preds = %57
%67 = load i32, i32* %10
%68 = zext i32 %67 to i64
store i64 %68, i64* %9
br label %69
69: ; preds = %75, %66
%70 = load i64, i64* %9
%71 = icmp ult i64 %70, 11
br i1 %71, label %72, label %78
72: ; preds = %69
%73 = load i32*, i32** %11
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %75
75: ; preds = %72
%76 = load i64, i64* %9
%77 = add i64 %76, 1
store i64 %77, i64* %9
br label %69
78: ; preds = %69
%79 = load i32*, i32** %11
%80 = load i32, i32* %8
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %78, %41
%83 = load i32*, i32** @stderr
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32* null
@.str.2 = [3 x i8] c"%d\00"
define void @print_stats(i8* nocapture %0, i32 %1, i8* %2, i32 %3) {
%5 = load i32*, i32** @stderr
%6 = tail call i32 @count_digits(i32 %1)
%7 = tail call i32 @fputs(i8* %0, i32* %5)
%8 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%9 = icmp ult i64 %8, 16
br i1 %9, label %10, label %15
10: ; preds = %4, %10
%11 = phi i64 [ %13, %10 ], [ %8, %4 ]
%12 = tail call i32 @fputc(i32 46, i32* %5)
%13 = add i64 %11, 1
%14 = icmp eq i64 %13, 16
br i1 %14, label %15, label %10
15: ; preds = %10, %4
%16 = icmp ult i32 %6, 11
br i1 %16, label %17, label %24
17: ; preds = %15
%18 = zext i32 %6 to i64
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ %22, %19 ], [ %18, %17 ]
%21 = tail call i32 @fputc(i32 46, i32* %5)
%22 = add nuw nsw i64 %20, 1
%23 = icmp eq i64 %22, 11
br i1 %23, label %24, label %19
24: ; preds = %19, %15
%25 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%26 = tail call i32 @fputc(i32 32, i32* %5)
%27 = icmp eq i8* %2, null
br i1 %27, label %49, label %28
28: ; preds = %24
%29 = tail call i32 @count_digits(i32 %3)
%30 = tail call i32 @fputs(i8* %2, i32* %5)
%31 = tail call i64 @strlen(i8* %2)
%32 = icmp ult i64 %31, 16
br i1 %32, label %33, label %38
33: ; preds = %28, %33
%34 = phi i64 [ %36, %33 ], [ %31, %28 ]
%35 = tail call i32 @fputc(i32 46, i32* %5)
%36 = add i64 %34, 1
%37 = icmp eq i64 %36, 16
br i1 %37, label %38, label %33
38: ; preds = %33, %28
%39 = icmp ult i32 %29, 11
br i1 %39, label %40, label %47
40: ; preds = %38
%41 = zext i32 %29 to i64
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ %45, %42 ], [ %41, %40 ]
%44 = tail call i32 @fputc(i32 46, i32* %5)
%45 = add nuw nsw i64 %43, 1
%46 = icmp eq i64 %45, 11
br i1 %46, label %47, label %42
47: ; preds = %42, %38
%48 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %3)
br label %49
49: ; preds = %47, %24
%50 = load i32*, i32** @stderr
%51 = tail call i32 @fputc(i32 10, i32* %50)
ret void
}