#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, ...);
main() {
  int a, b, c;
  int number, counter = 0;
  int d;
  for (number = 100; number <= 999; number++) {
    a = number / 100;
    b = (number / 10) % 10;
    c = (number % 100) % 10;
    d = b + c;
    printf("%d %d %d\n", a, b, c);
    if (a == d) {
      counter++;
    }
  }
  printf("\n Result: %d\n", counter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x64,-0x14(%rbp)
cmpl   $0x3e7,-0x14(%rbp)
jg     11be <main+0xae>
mov    -0x14(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11ab <main+0x9b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b0 <main+0xa0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
mov    -0x18(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x384,%r15d
mov    $0x64,%ax
lea    0xed4(%rip),%r14
xor    %r12d,%r12d
nop
movzwl %ax,%ebx
mov    %ebx,%ecx
shr    $0x2,%ecx
imul   $0x147b,%ecx,%ebp
shr    $0x11,%ebp
imul   $0x64,%ebp,%ecx
mov    %eax,%edx
sub    %cl,%dl
movzbl %dl,%edx
imul   $0xcd,%edx,%edx
shr    $0xa,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%al
sub    %cl,%al
imul   $0xcccd,%ebx,%ecx
shr    $0x13,%ecx
movzbl %cl,%ecx
imul   $0xcd,%ecx,%edx
shr    $0xa,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
movzbl %cl,%edx
movzbl %al,%ecx
lea    (%rdx,%rcx,1),%r13d
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
cmp    %ebp,%r13d
sete   %al
add    %eax,%r12d
add    $0x1,%ebx
mov    %ebx,%eax
add    $0xffffffff,%r15d
jne    1130 <main+0x20>
lea    0xe5c(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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