#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *);
scalar_t__ is_dualpal(int);
int main() {
  FILE *fin, *fout;
  fin = fopen("dualpal.in", "r");
  fout = fopen("dualpal.out", "w");
  assert(fin && fout);
  int num, start;
  fscanf(fin, "%d %d", &num, &start);
  fclose(fin);
  int count = 0;
  while (count < num) {
    ++start;
    if (is_dualpal(start)) {
      ++count;
      fprintf(fout, "%d\n", start);
    }
  }
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xe8e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe80(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x25(%rbp)
je     11b8 <main+0x58>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe4b(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <fscanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1235 <main+0xd5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1070 <is_dualpal@plt>
cmp    $0x0,%rax
je     1230 <main+0xd0>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xdf6(%rip),%rsi
call   1060 <fprintf@plt>
jmp    11ed <main+0x8d>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
lea    0xe88(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
test   %r14,%r14
setne  %al
test   %rbx,%rbx
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
lea    0xe6a(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
call   1040 <fscanf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
cmpl   $0x0,0xc(%rsp)
jle    120f <main+0xaf>
xor    %ebp,%ebp
lea    0xe46(%rip),%r14
jmp    11e6 <main+0x86>
nopl   (%rax)
cmp    0xc(%rsp),%ebp
jge    120f <main+0xaf>
mov    0x8(%rsp),%edi
add    $0x1,%edi
mov    %edi,0x8(%rsp)
call   1070 <is_dualpal@plt>
test   %rax,%rax
je     11e0 <main+0x80>
add    $0x1,%ebp
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <fprintf@plt>
jmp    11e0 <main+0x80>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"dualpal.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"dualpal.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
%8 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %8, i32** %3
%9 = load i32*, i32** %2
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32*, i32** %3
%13 = icmp ne i32* %12, null
br label %14
14: ; preds = %11, %0
%15 = phi i1 [ false, %0 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32*, i32** %2
%19 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %4, i32* %5)
%20 = load i32*, i32** %2
%21 = call i32 @fclose(i32* %20)
store i32 0, i32* %6
br label %22
22: ; preds = %38, %14
%23 = load i32, i32* %6
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %39
26: ; preds = %22
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = call i64 @is_dualpal(i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %26
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
%35 = load i32*, i32** %3
%36 = load i32, i32* %5
%37 = call i32 @fprintf(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32, %26
br label %22
39: ; preds = %22
%40 = load i32*, i32** %3
%41 = call i32 @fclose(i32* %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"dualpal.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"dualpal.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp ne i32* %3, null
%6 = icmp ne i32* %4, null
%7 = and i1 %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = bitcast i32* %1 to i8*
%11 = bitcast i32* %2 to i8*
%12 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %1, i32* %2)
%13 = call i32 @fclose(i32* %3)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %0, %26
%17 = phi i32 [ %27, %26 ], [ 0, %0 ]
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
%20 = call i64 @is_dualpal(i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %16
%23 = add nsw i32 %17, 1
%24 = load i32, i32* %2
%25 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %16
%27 = phi i32 [ %23, %22 ], [ %17, %16 ]
%28 = load i32, i32* %1
%29 = icmp slt i32 %27, %28
br i1 %29, label %16, label %30
30: ; preds = %26, %0
%31 = call i32 @fclose(i32* %4)
ret i32 0
}