#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() {
  for (int i = 10; i <= 500; i++) {
    int inv = 0, num = i;
    while (num != 0) {
      inv = (inv * 10) + num % 10;
      num /= 10;
    }
    if (i == inv)
      printf("%d ", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jg     11a5 <main+0x95>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1177 <main+0x67>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    1140 <main+0x30>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1192 <main+0x82>
mov    -0x8(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <main+0x87>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xa,%ebx
lea    0xee0(%rip),%r14
jmp    113b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x1f5,%ebx
je     117f <main+0x6f>
xor    %ecx,%ecx
mov    %ebx,%eax
nop
lea    (%rcx,%rcx,4),%ecx
movslq %eax,%rdx
imul   $0x66666667,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rax
add    %esi,%eax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
lea    (%rdi,%rcx,2),%ecx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1140 <main+0x30>
cmp    %ecx,%ebx
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"%d \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 = %29, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 500
br i1 %7, label %8, label %32
8: ; preds = %5
store i32 0, i32* %3
%9 = load i32, i32* %2
store i32 %9, i32* %4
br label %10
10: ; preds = %13, %8
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, 10
%16 = load i32, i32* %4
%17 = srem i32 %16, 10
%18 = add nsw i32 %15, %17
store i32 %18, i32* %3
%19 = load i32, i32* %4
%20 = sdiv i32 %19, 10
store i32 %20, i32* %4
br label %10
21: ; preds = %10
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %21
br label %29
29: ; preds = %28
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %5
32: ; preds = %5
%33 = load i32, i32* %1
ret i32 %33
}

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