#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 getNoOfCoins(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main() {
  unsigned int t, n;
  for (t = 10; t > 0; t--) {
    unsigned int noOfDollers;
    scanf("%u", &n);
    if ((n >= 0) && (n <= 1000000000)) {
      printf("%u\n", getNoOfCoins(n));
    } else {
      printf("0\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    11b5 <main+0x85>
lea    0xea9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jb     1194 <main+0x64>
cmpl   $0x3b9aca00,-0xc(%rbp)
ja     1194 <main+0x64>
mov    -0xc(%rbp),%edi
call   1040 <getNoOfCoins@plt>
mov    %eax,%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a2 <main+0x72>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a7 <main+0x77>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0xfffffff6,%ebp
lea    0xea8(%rip),%r14
lea    0xc(%rsp),%rbx
lea    0xe9f(%rip),%r15
lea    0xe9c(%rip),%r12
jmp    117c <main+0x3c>
nopl   (%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
inc    %ebp
je     11a8 <main+0x68>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
cmp    $0x3b9aca00,%edi
ja     1170 <main+0x30>
call   1050 <getNoOfCoins@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
inc    %ebp
jne    117c <main+0x3c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@.str.1 = [4 x i8] c"%u\0A\00"
@.str.2 = [3 x i8] c"0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %2
%7 = icmp ugt i32 %6, 0
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp uge i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %3
%14 = icmp ule i32 %13, 1000000000
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %3
%17 = call i32 @getNoOfCoins(i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %21
19: ; preds = %12, %8
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add i32 %23, -1
store i32 %24, i32* %2
br label %5
25: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@.str.1 = [4 x i8] c"%u\0A\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %13
%4 = phi i32 [ 10, %0 ], [ %14, %13 ]
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp ult i32 %6, 1000000001
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = call i32 @getNoOfCoins(i32 %6)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %13
11: ; preds = %3
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = add nsw i32 %4, -1
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %3
16: ; preds = %13
ret i32 0
}