#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);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main() {
  int count = 0;
  for (int currentNumber = 100; currentNumber <= 999; ++currentNumber) {
    char digitsOfNumber[4];
    sprintf(digitsOfNumber, "%d", currentNumber);
    if (digitsOfNumber[0] == digitsOfNumber[1] ||
        digitsOfNumber[1] == digitsOfNumber[2] ||
        digitsOfNumber[0] == digitsOfNumber[2]) {
      printf("%d \n", currentNumber);
      count++;
    }
  }
  printf("\n%d \n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
cmpl   $0x3e7,-0xc(%rbp)
jg     11b8 <main+0x98>
lea    -0x10(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xea8(%rip),%rsi
call   1040 <sprintf@plt>
movsbl -0x10(%rbp),%eax
movsbl -0xf(%rbp),%ecx
cmp    %ecx,%eax
je     118d <main+0x6d>
movsbl -0xf(%rbp),%eax
movsbl -0xe(%rbp),%ecx
cmp    %ecx,%eax
je     118d <main+0x6d>
movsbl -0x10(%rbp),%eax
movsbl -0xe(%rbp),%ecx
cmp    %ecx,%eax
jne    11a5 <main+0x85>
mov    -0xc(%rbp),%esi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11aa <main+0x8a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
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
xor    %ebx,%ebx
mov    $0x64,%ebp
lea    0xec6(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xebe(%rip),%r12
jmp    1168 <main+0x48>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
add    $0x1,%ebp
cmp    $0x3e8,%ebp
je     1192 <main+0x72>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <sprintf@plt>
movzbl 0xc(%rsp),%eax
movzbl 0xd(%rsp),%ecx
cmp    %cl,%al
je     1150 <main+0x30>
movzbl 0xe(%rsp),%edx
cmp    %dl,%cl
je     1150 <main+0x30>
cmp    %dl,%al
jne    115d <main+0x3d>
jmp    1150 <main+0x30>
lea    0xe6a(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
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"%d\00"
@.str.1 = [5 x i8] c"%d \0A\00"
@.str.2 = [6 x i8] c"\0A%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 100, i32* %3
br label %5
5: ; preds = %41, %0
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 999
br i1 %7, label %8, label %44
8: ; preds = %5
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %14, %17
br i1 %18, label %35, label %19
19: ; preds = %8
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %22, %25
br i1 %26, label %35, label %27
27: ; preds = %19
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %30, %33
br i1 %34, label %35, label %40
35: ; preds = %27, %19, %8
%36 = load i32, i32* %3
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %40
40: ; preds = %35, %27
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %5
44: ; preds = %5
%45 = load i32, i32* %2
%46 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %45)
ret i32 0
}

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