#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 atoi(char *);
int atol(char *);
unsigned long expt_mod(unsigned long, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  register unsigned long x = argc > 1 ? atol(argv[1]) : 75634;
  register int i = argc > 2 ? atoi(argv[2]) : 10;
  while (i--)
    printf("%lu", (x = expt_mod(x, 1547, 91261)) % 2);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1175 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,-0x20(%rbp)
jmp    1182 <main+0x42>
mov    $0x12772,%eax
mov    %eax,-0x20(%rbp)
jmp    1182 <main+0x42>
mov    -0x20(%rbp),%eax
cltq
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    11aa <main+0x6a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    11b7 <main+0x77>
mov    $0xa,%eax
mov    %eax,-0x24(%rbp)
jmp    11b7 <main+0x77>
mov    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1202 <main+0xc2>
mov    -0x18(%rbp),%rdi
mov    $0x60b,%esi
mov    $0x1647d,%edx
call   1040 <expt_mod@plt>
mov    %rax,%rsi
mov    %rsi,-0x18(%rbp)
and    $0x1,%rsi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <main+0x7d>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x12772,%r14d
mov    $0xa,%ebx
cmp    $0x2,%edi
jl     118c <main+0x3c>
mov    %rsi,%r15
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1060 <atol@plt>
movslq %eax,%r14
cmp    $0x2,%ebp
je     118c <main+0x3c>
mov    0x10(%r15),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
test   %eax,%eax
je     11ca <main+0x7a>
lea    0xe6d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    $0x60b,%esi
mov    $0x1647d,%edx
call   1050 <expt_mod@plt>
mov    %rax,%r14
mov    %r14d,%esi
and    $0x1,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11a0 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atol(i8* %13)
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %10
%17 = phi i32 [ %14, %10 ], [ 75634, %15 ]
%18 = sext i32 %17 to i64
store i64 %18, i64* %6
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 2
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
br label %27
26: ; preds = %16
br label %27
27: ; preds = %26, %21
%28 = phi i32 [ %25, %21 ], [ 10, %26 ]
store i32 %28, i32* %7
br label %29
29: ; preds = %33, %27
%30 = load i32, i32* %7
%31 = add nsw i32 %30, -1
store i32 %31, i32* %7
%32 = icmp ne i32 %30, 0
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = load i64, i64* %6
%35 = call i64 @expt_mod(i64 %34, i32 1547, i32 91261)
store i64 %35, i64* %6
%36 = urem i64 %35, 2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %36)
br label %29
38: ; preds = %29
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atol(i8* %6)
%8 = sext i32 %7 to i64
%9 = icmp eq i32 %0, 2
br i1 %9, label %15, label %10
10: ; preds = %4
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %26, label %15
15: ; preds = %2, %4, %10
%16 = phi i32 [ 10, %2 ], [ 10, %4 ], [ %13, %10 ]
%17 = phi i64 [ 75634, %2 ], [ %8, %4 ], [ %8, %10 ]
br label %18
18: ; preds = %15, %18
%19 = phi i32 [ %21, %18 ], [ %16, %15 ]
%20 = phi i64 [ %22, %18 ], [ %17, %15 ]
%21 = add nsw i32 %19, -1
%22 = tail call i64 @expt_mod(i64 %20, i32 1547, i32 91261)
%23 = and i64 %22, 1
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %23)
%25 = icmp eq i32 %21, 0
br i1 %25, label %26, label %18
26: ; preds = %18, %10
%27 = tail call i32 @putchar(i32 10)
ret i32 0
}