#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 *, ...);
void girilen_sayi_ters_cevir(int girilen_sayi, int basamak_sayisi) {
  int bolum;
  int yeni_basamak_degeri = 0;
  int yazilan_rakam;
  while (basamak_sayisi != 0) {
    bolum = girilen_sayi / pow(10, yeni_basamak_degeri);
    yazilan_rakam = bolum % 10;
    printf("%d", yazilan_rakam);
    basamak_sayisi--;
    yeni_basamak_degeri++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<girilen_sayi_ters_cevir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1193 <girilen_sayi_ters_cevir+0x73>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%esi
mov    $0xa,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <girilen_sayi_ters_cevir+0x15>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<girilen_sayi_ters_cevir>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
je     1193 <girilen_sayi_ters_cevir+0x63>
mov    %esi,%ebx
mov    %edi,%r15d
lea    0xeb9(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %r15d,%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
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1150 <girilen_sayi_ters_cevir+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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