#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int s = 0, a, acp, br;
  printf("A:");
  scanf("%d", &a);
  while (s < 10) {
    br = 0;
    acp = a;
    while (acp >= 1) {
      if (acp % 10 == s)
        br++;
      acp /= 10;
    }
    if (br != 0)
      printf("%d puti %d\n", br, s);
    s++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xa,-0x8(%rbp)
jge    11d1 <main+0xb1>
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jl     11a5 <main+0x85>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    -0x8(%rbp),%edx
jne    1192 <main+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    116b <main+0x4b>
cmpl   $0x0,-0x14(%rbp)
je     11c3 <main+0xa3>
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xcccccccd,%ebx
lea    0xeb3(%rip),%r14
xor    %ebp,%ebp
jmp    1168 <main+0x48>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0xa,%ebp
je     11b6 <main+0x96>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1160 <main+0x40>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
imul   %rbx,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %eax,%edi
sub    %edx,%edi
xor    %edx,%edx
cmp    %ebp,%edi
sete   %dl
add    %edx,%esi
cmp    $0x9,%eax
mov    %ecx,%eax
ja     1180 <main+0x60>
test   %esi,%esi
je     1160 <main+0x40>
mov    %r14,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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