#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 nr_cifre(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int n, a, b, s = 0, v[100], i;
  printf("Interval de cautare: ");
  scanf("%d %d", &a, &b);
  printf("Nr de componente in sir: ");
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    s += nr_cifre(v[i], a, b);
  }
  for (i = 0; i < n; i++) {
    printf("\nNumarul %d are %d cifre in interval.\n", i + 1,
           nr_cifre(v[i], a, b));
  }
  printf("\nNumarul de cifre in interval este: %d \n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fc <main+0xcc>
movslq -0x1b4(%rbp),%rax
lea    -0x1b0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movslq -0x1b4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <nr_cifre@plt>
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    1197 <main+0x67>
movl   $0x0,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1267 <main+0x137>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b8(%rbp)
movslq -0x1b4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <nr_cifre@plt>
mov    -0x1b8(%rbp),%esi
mov    %eax,%edx
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    1206 <main+0xd6>
mov    -0x14(%rbp),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1a8,%rsp
lea    0xebc(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    120d <main+0xdd>
lea    0x10(%rsp),%rbx
lea    0xe7f(%rip),%r14
xor    %ebp,%ebp
xor    %r15d,%r15d
nop
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rbx),%edi
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
call   1050 <nr_cifre@plt>
add    %eax,%r15d
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     11a0 <main+0x70>
test   %eax,%eax
jle    120d <main+0xdd>
lea    0xe5a(%rip),%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    0x10(%rsp,%rbx,4),%edi
add    $0x1,%rbx
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
call   1050 <nr_cifre@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     11e0 <main+0xb0>
lea    0xe49(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Interval de cautare: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [26 x i8] c"Nr de componente in sir: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [39 x i8] c"\0ANumarul %d are %d cifre in interval.\0A\00"
@.str.5 = [41 x i8] c"\0ANumarul de cifre in interval este: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x i32]
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
store i32 0, i32* %7
br label %12
12: ; preds = %30, %0
%13 = load i32, i32* %7
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %18
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %19)
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = call i32 @nr_cifre(i32 %24, i32 %25, i32 %26)
%28 = load i32, i32* %5
%29 = add nsw i32 %28, %27
store i32 %29, i32* %5
br label %30
30: ; preds = %16
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %12
33: ; preds = %12
store i32 0, i32* %7
br label %34
34: ; preds = %49, %33
%35 = load i32, i32* %7
%36 = load i32, i32* %2
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %52
38: ; preds = %34
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = load i32, i32* %3
%46 = load i32, i32* %4
%47 = call i32 @nr_cifre(i32 %44, i32 %45, i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %40, i32 %47)
br label %49
49: ; preds = %38
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
store i32 %51, i32* %7
br label %34
52: ; preds = %34
%53 = load i32, i32* %5
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %53)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Interval de cautare: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [26 x i8] c"Nr de componente in sir: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [39 x i8] c"\0ANumarul %d are %d cifre in interval.\0A\00"
@.str.5 = [41 x i8] c"\0ANumarul de cifre in interval este: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [100 x i32]* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %17, label %44
15: ; preds = %17
%16 = icmp sgt i32 %28, 0
br i1 %16, label %31, label %44
17: ; preds = %0, %17
%18 = phi i64 [ %27, %17 ], [ 0, %0 ]
%19 = phi i32 [ %26, %17 ], [ 0, %0 ]
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %18
%21 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %20)
%22 = load i32, i32* %20
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @nr_cifre(i32 %22, i32 %23, i32 %24)
%26 = add nsw i32 %25, %19
%27 = add nuw nsw i64 %18, 1
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %27, %29
br i1 %30, label %17, label %15
31: ; preds = %15, %31
%32 = phi i64 [ %33, %31 ], [ 0, %15 ]
%33 = add nuw nsw i64 %32, 1
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %32
%35 = load i32, i32* %34
%36 = load i32, i32* %2
%37 = load i32, i32* %3
%38 = call i32 @nr_cifre(i32 %35, i32 %36, i32 %37)
%39 = trunc i64 %33 to i32
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %39, i32 %38)
%41 = load i32, i32* %1
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %33, %42
br i1 %43, label %31, label %44
44: ; preds = %31, %0, %15
%45 = phi i32 [ %26, %15 ], [ 0, %0 ], [ %26, %31 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %45)
ret i32 0
}