#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 rc_format_value_seconds(char *, int, unsigned int);
int snprintf(char *, int, char *, unsigned int);
int rc_format_value_centiseconds(char *buffer, int size,
                                 unsigned centiseconds) {
  unsigned seconds;
  int chars, chars2;
  seconds = centiseconds / 100;
  centiseconds -= seconds * 100;
  chars = rc_format_value_seconds(buffer, size, seconds);
  if (chars > 0) {
    chars2 = snprintf(buffer + chars, size - chars, ".%02u", centiseconds);
    if (chars2 > 0) {
      chars += chars2;
    } else {
      chars = chars2;
    }
  }
  return chars;
}


x86 assembly (clang, -O0):
<rc_format_value_centiseconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x14(%rbp)
imul   $0x64,-0x14(%rbp),%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <rc_format_value_seconds@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11af <rc_format_value_centiseconds+0x8f>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x18(%rbp),%esi
mov    -0x10(%rbp),%ecx
lea    0xe7c(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    11a4 <rc_format_value_centiseconds+0x84>
mov    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11aa <rc_format_value_centiseconds+0x8a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11af <rc_format_value_centiseconds+0x8f>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc_format_value_centiseconds>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%r12
mov    %edx,%eax
imul   $0x51eb851f,%rax,%rbp
shr    $0x25,%rbp
mov    %ebp,%edx
call   1040 <rc_format_value_seconds@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1176 <rc_format_value_centiseconds+0x56>
imul   $0xffffff9c,%ebp,%ecx
add    %r15d,%ecx
mov    %ebx,%eax
add    %rax,%r12
sub    %ebx,%r14d
lea    0xea0(%rip),%rdx
mov    %r12,%rdi
mov    %r14d,%esi
call   1030 <snprintf@plt>
xor    %ecx,%ecx
test   %eax,%eax
cmovg  %ebx,%ecx
add    %eax,%ecx
mov    %ecx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c".%02u\00"
define i32 @rc_format_value_centiseconds(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = udiv i32 %10, 100
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = mul i32 %12, 100
%14 = load i32, i32* %6
%15 = sub i32 %14, %13
store i32 %15, i32* %6
%16 = load i8*, i8** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = call i32 @rc_format_value_seconds(i8* %16, i32 %17, i32 %18)
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %41
22: ; preds = %3
%23 = load i8*, i8** %4
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i32, i32* %5
%28 = load i32, i32* %8
%29 = sub nsw i32 %27, %28
%30 = load i32, i32* %6
%31 = call i32 @snprintf(i8* %26, i32 %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %30)
store i32 %31, i32* %9
%32 = load i32, i32* %9
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %22
%35 = load i32, i32* %9
%36 = load i32, i32* %8
%37 = add nsw i32 %36, %35
store i32 %37, i32* %8
br label %40
38: ; preds = %22
%39 = load i32, i32* %9
store i32 %39, i32* %8
br label %40
40: ; preds = %38, %34
br label %41
41: ; preds = %40, %3
%42 = load i32, i32* %8
ret i32 %42
}

LLVM IR (-O2):
@.str = [6 x i8] c".%02u\00"
define i32 @rc_format_value_centiseconds(i8* %0, i32 %1, i32 %2) {
%4 = udiv i32 %2, 100
%5 = tail call i32 @rc_format_value_seconds(i8* %0, i32 %1, i32 %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %3
%8 = mul i32 %4, -100
%9 = add i32 %8, %2
%10 = zext i32 %5 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = sub nsw i32 %1, %5
%13 = tail call i32 @snprintf(i8* %11, i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%14 = icmp sgt i32 %13, 0
%15 = select i1 %14, i32 %5, i32 0
%16 = add nsw i32 %15, %13
br label %17
17: ; preds = %7, %3
%18 = phi i32 [ %5, %3 ], [ %16, %7 ]
ret i32 %18
}