#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 main() {
  int t, a, n, min = 100, max = 1000, sum;
  for (n = min; n < max; n++) {
    t = n;
    sum = 0;
    while (t != 0) {
      a = t % 10;
      t = t / 10;
      sum = sum + a;
    }
    if (sum == 5)
      printf("%4d", n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x14(%rbp)
movl   $0x3e8,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ac <main+0x9c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1180 <main+0x70>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <main+0x3c>
cmpl   $0x5,-0x1c(%rbp)
jne    1199 <main+0x89>
mov    -0x10(%rbp),%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
jmp    119e <main+0x8e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x64,%ebx
lea    0xee0(%rip),%r14
jmp    113b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x3e8,%ebx
je     117c <main+0x6c>
xor    %eax,%eax
mov    %ebx,%ecx
nop
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
add    %edi,%eax
add    $0x9,%edx
cmp    $0x12,%edx
ja     1140 <main+0x30>
cmp    $0x5,%eax
jne    1130 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%4d\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 100, i32* %5
store i32 1000, i32* %6
%8 = load i32, i32* %5
store i32 %8, i32* %4
br label %9
9: ; preds = %33, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %36
13: ; preds = %9
%14 = load i32, i32* %4
store i32 %14, i32* %2
store i32 0, i32* %7
br label %15
15: ; preds = %18, %13
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* %2
%20 = srem i32 %19, 10
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 10
store i32 %22, i32* %2
%23 = load i32, i32* %7
%24 = load i32, i32* %3
%25 = add nsw i32 %23, %24
store i32 %25, i32* %7
br label %15
26: ; preds = %15
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, 5
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %4
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %26
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %9
36: ; preds = %9
ret i32 0
}

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