#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 *, long, ...);
int /*<<< orphan*/ scanf(char *, long *);
void main() {
  long int a, b, c, d, e;
  long int number;
  scanf("%ld", &number);
  a = number / 10000;
  b = number % 10000 / 1000;
  c = number % 1000 / 100;
  d = number % 100 / 10;
  e = number % 10;
  if (0 != a)
    printf("There are five:%d,%d,%d,%d,%d\n", e, d, c, b, a);
  else if (0 != b)
    printf("There are four:%d,%d,%d,%d\n", e, d, c, b);
  else if (0 != c)
    printf("There are three:%d,%d,%d\n", e, d, c);
  else if (0 != d)
    printf("There are two:%d,%d\n", e, d);
  else
    printf("There are one:%d\n", e);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
mov    $0x2710,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x30(%rbp),%rax
mov    $0x2710,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x30(%rbp),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
mov    -0x30(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     11ec <main+0xcc>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x8(%rbp),%r9
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128e <main+0x16e>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     121b <main+0xfb>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1289 <main+0x169>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     1246 <main+0x126>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1284 <main+0x164>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
je     126d <main+0x14d>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127f <main+0x15f>
mov    -0x28(%rbp),%rsi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1284 <main+0x164>
jmp    1289 <main+0x169>
jmp    128e <main+0x16e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rdi
movabs $0x346dc5d63886594b,%rcx
c5 6d 34
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%r9
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xb,%r9
add    %rax,%r9
imul   $0x2710,%r9,%rax
mov    %rdi,%r11
sub    %rax,%r11
movswl %r11w,%eax
imul   $0xffff8313,%eax,%eax
shr    $0x10,%eax
add    %r11d,%eax
movzwl %ax,%eax
movswl %ax,%ecx
shr    $0xf,%eax
sar    $0x9,%ecx
add    %eax,%ecx
movabs $0x20c49ba5e353f7cf,%rdx
9b c4 20
mov    %rdi,%rax
imul   %rdx
movswq %cx,%r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x7,%rdx
add    %rax,%rdx
imul   $0x3e8,%rdx,%rax
mov    %rdi,%r14
sub    %rax,%r14
movswl %r14w,%eax
imul   $0x147b,%eax,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x13,%eax
add    %ecx,%eax
movslq %eax,%rcx
movabs $0xa3d70a3d70a3d70b,%rdx
0a d7 a3
mov    %rdi,%rax
imul   %rdx
add    %rdi,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x6,%rdx
add    %rax,%rdx
imul   $0x64,%rdx,%rax
mov    %rdi,%rbx
sub    %rax,%rbx
movsbl %bl,%eax
imul   $0x67,%eax,%eax
movzwl %ax,%eax
movswl %ax,%edx
shr    $0xf,%eax
shr    $0xa,%edx
add    %al,%dl
movsbq %dl,%r10
movabs $0x6666666666666667,%rdx
66 66 66
mov    %rdi,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
add    %rdx,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %rdi,%rsi
sub    %rax,%rsi
add    $0x270f,%rdi
cmp    $0x4e1f,%rdi
jae    127e <main+0x15e>
add    $0x3e7,%r11
cmp    $0x7cf,%r11
jae    1291 <main+0x171>
add    $0x63,%r14
cmp    $0xc7,%r14
jae    12a4 <main+0x184>
add    $0x9,%rbx
cmp    $0x13,%rbx
jae    12b7 <main+0x197>
lea    0xdf9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xd7f(%rip),%rdi
mov    %r10,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xd8b(%rip),%rdi
mov    %r10,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xd94(%rip),%rdi
mov    %r10,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xd9b(%rip),%rdi
mov    %r10,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [31 x i8] c"There are five:%d,%d,%d,%d,%d\0A\00"
@.str.2 = [28 x i8] c"There are four:%d,%d,%d,%d\0A\00"
@.str.3 = [26 x i8] c"There are three:%d,%d,%d\0A\00"
@.str.4 = [21 x i8] c"There are two:%d,%d\0A\00"
@.str.5 = [18 x i8] c"There are one:%d\0A\00"
define void @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %6)
%8 = load i64, i64* %6
%9 = sdiv i64 %8, 10000
store i64 %9, i64* %1
%10 = load i64, i64* %6
%11 = srem i64 %10, 10000
%12 = sdiv i64 %11, 1000
store i64 %12, i64* %2
%13 = load i64, i64* %6
%14 = srem i64 %13, 1000
%15 = sdiv i64 %14, 100
store i64 %15, i64* %3
%16 = load i64, i64* %6
%17 = srem i64 %16, 100
%18 = sdiv i64 %17, 10
store i64 %18, i64* %4
%19 = load i64, i64* %6
%20 = srem i64 %19, 10
store i64 %20, i64* %5
%21 = load i64, i64* %1
%22 = icmp ne i64 0, %21
br i1 %22, label %23, label %30
23: ; preds = %0
%24 = load i64, i64* %5
%25 = load i64, i64* %4
%26 = load i64, i64* %3
%27 = load i64, i64* %2
%28 = load i64, i64* %1
%29 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i64 %24, i64 %25, i64 %26, i64 %27, i64 %28)
br label %60
30: ; preds = %0
%31 = load i64, i64* %2
%32 = icmp ne i64 0, %31
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load i64, i64* %5
%35 = load i64, i64* %4
%36 = load i64, i64* %3
%37 = load i64, i64* %2
%38 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %34, i64 %35, i64 %36, i64 %37)
br label %59
39: ; preds = %30
%40 = load i64, i64* %3
%41 = icmp ne i64 0, %40
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i64, i64* %5
%44 = load i64, i64* %4
%45 = load i64, i64* %3
%46 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %43, i64 %44, i64 %45)
br label %58
47: ; preds = %39
%48 = load i64, i64* %4
%49 = icmp ne i64 0, %48
br i1 %49, label %50, label %54
50: ; preds = %47
%51 = load i64, i64* %5
%52 = load i64, i64* %4
%53 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 %51, i64 %52)
br label %57
54: ; preds = %47
%55 = load i64, i64* %5
%56 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 %55)
br label %57
57: ; preds = %54, %50
br label %58
58: ; preds = %57, %42
br label %59
59: ; preds = %58, %33
br label %60
60: ; preds = %59, %23
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [31 x i8] c"There are five:%d,%d,%d,%d,%d\0A\00"
@.str.2 = [28 x i8] c"There are four:%d,%d,%d,%d\0A\00"
@.str.3 = [26 x i8] c"There are three:%d,%d,%d\0A\00"
@.str.4 = [21 x i8] c"There are two:%d,%d\0A\00"
@.str.5 = [18 x i8] c"There are one:%d\0A\00"
define void @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = srem i64 %4, 10000
%6 = sdiv i64 %4, 10000
%7 = trunc i64 %5 to i16
%8 = sdiv i16 %7, 1000
%9 = sext i16 %8 to i64
%10 = srem i64 %4, 1000
%11 = trunc i64 %10 to i16
%12 = sdiv i16 %11, 100
%13 = sext i16 %12 to i64
%14 = srem i64 %4, 100
%15 = trunc i64 %14 to i8
%16 = sdiv i8 %15, 10
%17 = sext i8 %16 to i64
%18 = srem i64 %4, 10
%19 = add i64 %4, 9999
%20 = icmp ult i64 %19, 19999
br i1 %20, label %23, label %21
21: ; preds = %0
%22 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i64 %18, i64 %17, i64 %13, i64 %9, i64 %6)
br label %40
23: ; preds = %0
%24 = add nsw i64 %5, 999
%25 = icmp ult i64 %24, 1999
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %18, i64 %17, i64 %13, i64 %9)
br label %40
28: ; preds = %23
%29 = add nsw i64 %10, 99
%30 = icmp ult i64 %29, 199
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %18, i64 %17, i64 %13)
br label %40
33: ; preds = %28
%34 = add nsw i64 %14, 9
%35 = icmp ult i64 %34, 19
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 %18, i64 %17)
br label %40
38: ; preds = %33
%39 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 %18)
br label %40
40: ; preds = %26, %36, %38, %31, %21
ret void
}