#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 */
scalar_t__ is_narcissistic(int);
int /*<<< orphan*/ printf(char *, ...);
void narcissistic(int a) {
  for (int i = 1; i < a; ++i) {
    if (is_narcissistic(i))
      printf("%d, ", i);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<narcissistic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1174 <narcissistic+0x54>
mov    -0x8(%rbp),%edi
call   1040 <is_narcissistic@plt>
cmp    $0x0,%rax
je     1161 <narcissistic+0x41>
mov    -0x8(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1166 <narcissistic+0x46>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <narcissistic+0x12>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<narcissistic>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     1171 <narcissistic+0x41>
mov    %edi,%ebx
mov    $0x1,%ebp
lea    0xeb9(%rip),%r14
jmp    1157 <narcissistic+0x27>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1171 <narcissistic+0x41>
mov    %ebp,%edi
call   1050 <is_narcissistic@plt>
test   %rax,%rax
je     1150 <narcissistic+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <narcissistic+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d, \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @narcissistic(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %19
8: ; preds = %4
%9 = load i32, i32* %3
%10 = call i64 @is_narcissistic(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %8
br label %16
16: ; preds = %15
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d, \00"
define void @narcissistic(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %5, label %3
3: ; preds = %11, %1
%4 = tail call i32 @putchar(i32 10)
ret void
5: ; preds = %1, %11
%6 = phi i32 [ %12, %11 ], [ 1, %1 ]
%7 = tail call i64 @is_narcissistic(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %11
11: ; preds = %5, %9
%12 = add nuw nsw i32 %6, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %3, label %5
}