#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int mod_pow(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 3) {
    fprintf(stderr, "usage: %s <M> <N>\n", argv[0]);
    return 1;
  }
  int M = atoi(argv[1]);
  int N = atoi(argv[2]);
  if (M < 0 || N < 0)
    return 1;
  int result = 1;
  for (int i = N; i >= 1; i--)
    result = mod_pow(M, result, 100000000);
  printf("%d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1188 <main+0x48>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1216 <main+0xd6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11bc <main+0x7c>
cmpl   $0x0,-0x18(%rbp)
jge    11c8 <main+0x88>
movl   $0x1,-0x4(%rbp)
jmp    1216 <main+0xd6>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jl     1200 <main+0xc0>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x5f5e100,%edx
call   1050 <mod_pow@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11d5 <main+0x95>
mov    -0x1c(%rbp),%esi
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    1198 <main+0x58>
mov    0x8(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    $0x1,%eax
test   %ebx,%ebx
js     11cd <main+0x8d>
test   %ebp,%ebp
js     11cd <main+0x8d>
je     11b8 <main+0x78>
add    $0x1,%ebp
mov    $0x1,%eax
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x5f5e100,%edx
call   1050 <mod_pow@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1180 <main+0x40>
jmp    11bd <main+0x7d>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xe54(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    11cd <main+0x8d>
mov    $0x1,%eax
lea    0xe4f(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"usage: %s <M> <N>\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %48
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %7
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %18
%30 = load i32, i32* %7
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %29, %18
store i32 1, i32* %3
br label %48
33: ; preds = %29
store i32 1, i32* %8
%34 = load i32, i32* %7
store i32 %34, i32* %9
br label %35
35: ; preds = %42, %33
%36 = load i32, i32* %9
%37 = icmp sge i32 %36, 1
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = load i32, i32* %6
%40 = load i32, i32* %8
%41 = call i32 @mod_pow(i32 %39, i32 %40, i32 100000000)
store i32 %41, i32* %8
br label %42
42: ; preds = %38
%43 = load i32, i32* %9
%44 = add nsw i32 %43, -1
store i32 %44, i32* %9
br label %35
45: ; preds = %35
%46 = load i32, i32* %8
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %46)
store i32 0, i32* %3
br label %48
48: ; preds = %45, %32, %12
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"usage: %s <M> <N>\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %29
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp slt i32 %11, 0
%16 = icmp slt i32 %14, 0
%17 = select i1 %15, i1 true, i1 %16
br i1 %17, label %29, label %18
18: ; preds = %8
%19 = icmp eq i32 %14, 0
br i1 %19, label %20, label %23
20: ; preds = %23, %18
%21 = phi i32 [ 1, %18 ], [ %26, %23 ]
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %29
23: ; preds = %18, %23
%24 = phi i32 [ %27, %23 ], [ %14, %18 ]
%25 = phi i32 [ %26, %23 ], [ 1, %18 ]
%26 = tail call i32 @mod_pow(i32 %11, i32 %25, i32 100000000)
%27 = add nsw i32 %24, -1
%28 = icmp ugt i32 %24, 1
br i1 %28, label %23, label %20
29: ; preds = %20, %8, %4
%30 = phi i32 [ 1, %4 ], [ 0, %20 ], [ 1, %8 ]
ret i32 %30
}