#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  printf("%d.", a / b);
  a %= b;
  while (c--) {
    a *= 10;
    int q = a / b;
    if (c == 0 && (a % b) * 10 / b >= 5)
      q++;
    printf("%d", q);
    a %= b;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
je     11d7 <main+0xb7>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11b7 <main+0x97>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
imul   $0xa,%edx,%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x5,%eax
jl     11b7 <main+0x97>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
jmp    1168 <main+0x48>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cltd
idivl  0xc(%rsp)
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%ecx
mov    0x4(%rsp),%eax
mov    0x8(%rsp),%edi
sub    $0x1,%edi
mov    %edi,0x8(%rsp)
jae    1174 <main+0x54>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
cltd
idiv   %ecx
lea    0xe86(%rip),%rbx
jmp    11a4 <main+0x84>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%ecx
mov    0x4(%rsp),%eax
cltd
idiv   %ecx
mov    %edx,0x4(%rsp)
mov    0x8(%rsp),%edi
sub    $0x1,%edi
mov    %edi,0x8(%rsp)
jb     116c <main+0x4c>
add    %edx,%edx
lea    (%rdx,%rdx,4),%eax
mov    %eax,0x4(%rsp)
cltd
idiv   %ecx
mov    %eax,%esi
test   %edi,%edi
jne    1180 <main+0x60>
add    %edx,%edx
lea    (%rdx,%rdx,4),%eax
cltd
idiv   %ecx
xor    %ecx,%ecx
cmp    $0x5,%eax
setge  %cl
add    %ecx,%esi
jmp    1180 <main+0x60>

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

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