#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 basamak_ayirma(int sayi, int basamak_sayici) {
  int kalan;
  int bolum;
  while (basamak_sayici != 0) {
    bolum = sayi / pow(10, basamak_sayici - 1);
    kalan = bolum % 10;
    printf("%d  ", kalan);
    basamak_sayici--;
  }
}


x86 assembly (clang, -O0):
<basamak_ayirma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1184 <basamak_ayirma+0x64>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    $0xa,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <basamak_ayirma+0xe>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basamak_ayirma>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
je     117e <basamak_ayirma+0x5e>
mov    %esi,%ebx
mov    %edi,%ebp
add    $0xffffffff,%ebx
lea    0xeca(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %ebx,%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jb     1140 <basamak_ayirma+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d \00"
define void @basamak_ayirma(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
br label %7
7: ; preds = %10, %2
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = call i32 @pow(i32 10, i32 %13)
%15 = sdiv i32 %11, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = srem i32 %16, 10
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %4
%21 = add nsw i32 %20, -1
store i32 %21, i32* %4
br label %7
22: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d \00"
define void @basamak_ayirma(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %1, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 @pow(i32 10, i32 %6)
%8 = sdiv i32 %0, %7
%9 = srem i32 %8, 10
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %6, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}