#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 drukujspacja(int liczba) {
  int ilecyfr = 0;
  int kopia = liczba;
  while (kopia != 0) {
    kopia /= 10;
    ilecyfr++;
  }
  kopia = liczba;
  int tab[ilecyfr];
  int ilecyfrkopia = ilecyfr;
  ilecyfr--;
  while (kopia != 0) {
    kopia = liczba % 10;
    tab[ilecyfr] = kopia;
    liczba /= 10;
    ilecyfr--;
  }
  int i, licznik = 0;
  for (i = 0; i < ilecyfrkopia; i++) {
    printf("%d", tab[i]);
    licznik++;
    if (licznik == 3) {
      licznik = 0;
      printf(" ");
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<drukujspacja>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114e <drukujspacja+0x3e>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1128 <drukujspacja+0x18>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11cc <drukujspacja+0xbc>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x38(%rbp),%rax
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%edx
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    118a <drukujspacja+0x7a>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    123a <drukujspacja+0x12a>
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jne    1227 <drukujspacja+0x117>
movl   $0x0,-0x2c(%rbp)
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <drukujspacja+0x11c>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11da <drukujspacja+0xca>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drukujspacja>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
je     1200 <drukujspacja+0xe0>
mov    $0xfffffffffffffffc,%rax
xor    %ebx,%ebx
mov    %edi,%ecx
xchg   %ax,%ax
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
add    $0x9,%edx
add    $0x1,%rbx
add    $0x4,%rax
cmp    $0x12,%edx
ja     1140 <drukujspacja+0x20>
mov    %rsp,%r15
lea    0xf(,%rbx,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r15
mov    %r15,%rsp
test   %edi,%edi
je     11b7 <drukujspacja+0x97>
add    %r15,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
mov    %ecx,(%rax)
lea    -0x4(%rax),%rax
jne    1190 <drukujspacja+0x70>
lea    0xe42(%rip),%r14
xor    %r12d,%r12d
jmp    11da <drukujspacja+0xba>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x4,%r15
add    $0xffffffffffffffff,%rbx
je     1200 <drukujspacja+0xe0>
mov    (%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12d
cmp    $0x3,%r12d
jne    11d0 <drukujspacja+0xb0>
mov    $0x20,%edi
call   1030 <putchar@plt>
xor    %r12d,%r12d
jmp    11d0 <drukujspacja+0xb0>
mov    $0xa,%edi
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
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" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @drukujspacja(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%10 = load i32, i32* %2
store i32 %10, i32* %4
br label %11
11: ; preds = %14, %1
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 10
store i32 %16, i32* %4
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %11
19: ; preds = %11
%20 = load i32, i32* %2
store i32 %20, i32* %4
%21 = load i32, i32* %3
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %5
%24 = alloca i32, i64 %22
store i64 %22, i64* %6
%25 = load i32, i32* %3
store i32 %25, i32* %7
%26 = load i32, i32* %3
%27 = add nsw i32 %26, -1
store i32 %27, i32* %3
br label %28
28: ; preds = %31, %19
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %42
31: ; preds = %28
%32 = load i32, i32* %2
%33 = srem i32 %32, 10
store i32 %33, i32* %4
%34 = load i32, i32* %4
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %24, i64 %36
store i32 %34, i32* %37
%38 = load i32, i32* %2
%39 = sdiv i32 %38, 10
store i32 %39, i32* %2
%40 = load i32, i32* %3
%41 = add nsw i32 %40, -1
store i32 %41, i32* %3
br label %28
42: ; preds = %28
store i32 0, i32* %9
store i32 0, i32* %8
br label %43
43: ; preds = %60, %42
%44 = load i32, i32* %8
%45 = load i32, i32* %7
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %63
47: ; preds = %43
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %24, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
%55 = load i32, i32* %9
%56 = icmp eq i32 %55, 3
br i1 %56, label %57, label %59
57: ; preds = %47
store i32 0, i32* %9
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %59
59: ; preds = %57, %47
br label %60
60: ; preds = %59
%61 = load i32, i32* %8
%62 = add nsw i32 %61, 1
store i32 %62, i32* %8
br label %43
63: ; preds = %43
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%65 = load i8*, i8** %5
ret void
}

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