#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 pow(int, int);
int /*<<< orphan*/ printf(char *, int);
void rotation(int num) {
  int temp = num;
  int digits = 0;
  while (temp > 0) {
    digits++;
    temp /= 10;
  }
  int power = pow(10, digits - 1);
  for (int i = 0; i < digits - 1; i++) {
    int lastDigit = num % 10;
    int x = num / 10;
    num = lastDigit * power + x;
    printf("%d ", num);
  }
}


x86 assembly (clang, -O0):
<rotation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    115e <rotation+0x3e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1138 <rotation+0x18>
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0xa,%edi
call   1040 <pow@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11cf <rotation+0xaf>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x10(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <rotation+0x58>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotation>:
test   %edi,%edi
jle    11af <rotation+0x8f>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xffffffff,%ebp
mov    $0xcccccccd,%eax
mov    %edi,%ecx
nopl   (%rax)
mov    %ecx,%edx
imul   %rax,%rdx
shr    $0x23,%rdx
add    $0x1,%ebp
cmp    $0x9,%ecx
mov    %edx,%ecx
ja     1140 <rotation+0x20>
mov    $0xa,%edi
mov    %ebp,%esi
call   1040 <pow@plt>
test   %ebp,%ebp
je     11a4 <rotation+0x84>
mov    %eax,%r14d
lea    0xe92(%rip),%r15
xchg   %ax,%ax
movslq %ebx,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%ebx
imul   %r14d,%ebx
add    %eax,%ebx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1170 <rotation+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
mov    $0xffffffff,%esi
jmp    1040 <pow@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @rotation(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @pow(i32 10, i32 -1)
br label %14
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ %0, %1 ]
%7 = phi i32 [ %8, %5 ], [ 0, %1 ]
%8 = add nuw nsw i32 %7, 1
%9 = udiv i32 %6, 10
%10 = icmp ult i32 %6, 10
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = tail call i32 @pow(i32 10, i32 %7)
%13 = icmp eq i32 %7, 0
br i1 %13, label %14, label %15
14: ; preds = %15, %3, %11
ret void
15: ; preds = %11, %15
%16 = phi i32 [ %21, %15 ], [ %0, %11 ]
%17 = phi i32 [ %23, %15 ], [ 0, %11 ]
%18 = srem i32 %16, 10
%19 = sdiv i32 %16, 10
%20 = mul nsw i32 %18, %12
%21 = add nsw i32 %20, %19
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = add nuw nsw i32 %17, 1
%24 = icmp eq i32 %23, %7
br i1 %24, label %14, label %15
}