#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 int16_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int);
const char *print100(int16_t v) {
  static char buf[16];
  char *p = buf;
  if (v < 0) {
    v = -v;
    *p++ = '-';
  }
  p += sprintf(p, "%d.%02d", v / 100, v % 100);
  return buf;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    0x2f1e(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114a <print100+0x3a>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x14(%rbp),%edx
lea    0xe8d(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
lea    0x2eb1(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
mov    %edi,%ecx
test   %edi,%edi
js     1120 <print100+0x10>
lea    0x2f22(%rip),%rdi
jmp    1130 <print100+0x20>
neg    %ecx
movb   $0x2d,0x2f17(%rip)
lea    0x2f11(%rip),%rdi
mov    %ecx,%eax
imul   $0x51eb851f,%rax,%rdx
shr    $0x25,%rdx
imul   $0x64,%edx,%eax
sub    %eax,%ecx
lea    0xeb7(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2eeb(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@print100.buf = internal global [16 x i8] zeroinitializer
@.str = [8 x i8] c"%d.%02d\00"
define i8* @print100(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @print100.buf, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
store i32 %8, i32* %2
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
store i8 45, i8* %9
br label %11
11: ; preds = %6, %1
%12 = load i8*, i8** %3
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 100
%15 = load i32, i32* %2
%16 = srem i32 %15, 100
%17 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16)
%18 = load i8*, i8** %3
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8* %20, i8** %3
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @print100.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@print100.buf = internal global [16 x i8] zeroinitializer
@.str = [8 x i8] c"%d.%02d\00"
define i8* @print100(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = sub nsw i32 0, %0
store i8 45, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @print100.buf, i64 0, i64 0)
br label %5
5: ; preds = %3, %1
%6 = phi i32 [ %4, %3 ], [ %0, %1 ]
%7 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @print100.buf, i64 0, i64 1), %3 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @print100.buf, i64 0, i64 0), %1 ]
%8 = udiv i32 %6, 100
%9 = urem i32 %6, 100
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @print100.buf, i64 0, i64 0)
}