#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 *, ...);
void inverse_round(unsigned n, unsigned k) {
  unsigned b = 1;
  printf(".");
  while (k > 0) {
    unsigned a = 10 * b / n;
    printf("%u", a);
    b = (10 * b) % n;
    k--;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<inverse_round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jbe    1174 <inverse_round+0x64>
imul   $0xa,-0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0xa,-0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <inverse_round+0x23>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverse_round>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r15d
mov    $0x2e,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
je     116e <inverse_round+0x4e>
mov    $0x1,%ebp
lea    0xeba(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%eax
xor    %edx,%edx
div    %r15d
mov    %edx,%ebp
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    1150 <inverse_round+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @inverse_round(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %11, %2
%9 = load i32, i32* %4
%10 = icmp ugt i32 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i32, i32* %5
%13 = mul i32 10, %12
%14 = load i32, i32* %3
%15 = udiv i32 %13, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %5
%19 = mul i32 10, %18
%20 = load i32, i32* %3
%21 = urem i32 %19, %20
store i32 %21, i32* %5
%22 = load i32, i32* %4
%23 = add i32 %22, -1
store i32 %23, i32* %4
br label %8
24: ; preds = %8
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%u\00"
define void @inverse_round(i32 %0, i32 %1) {
%3 = tail call i32 @putchar(i32 46)
%4 = icmp eq i32 %1, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %12, %5 ], [ %1, %2 ]
%7 = phi i32 [ %11, %5 ], [ 1, %2 ]
%8 = mul i32 %7, 10
%9 = udiv i32 %8, %0
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = urem i32 %8, %0
%12 = add i32 %6, -1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}