#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 _pow1(int, int);
int _pow2(int, int);
int atoi(char *);
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char *argv[]) {
  int N = 10, M = 5;
  if (2 <= argc) {
    N = atoi(argv[1]);
    if (2 < argc) {
      M = atoi(argv[2]);
    }
  }
  printf("pow(%d,%d)=%d\n", N, M, _pow1(N, M));
  printf("pow(%d,%d)=%d\n", N, M, _pow2(N, M));
  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)
movl   $0xa,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jg     11a5 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jge    11a0 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11a5 <main+0x65>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <_pow1@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    %eax,%ecx
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <_pow2@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe0a(%rip),%rdi
call   1040 <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    $0x5,%ebx
mov    $0xa,%ebp
cmp    $0x2,%edi
jl     1178 <main+0x38>
mov    %rsi,%r14
mov    %edi,%r15d
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
cmp    $0x2,%r15d
je     1178 <main+0x38>
mov    0x10(%r14),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <_pow1@plt>
lea    0xe78(%rip),%r14
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <_pow2@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"pow(%d,%d)=%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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
store i32 5, i32* %7
%8 = load i32, i32* %4
%9 = icmp sle i32 2, %8
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 2, %15
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %7
br label %22
22: ; preds = %17, %10
br label %23
23: ; preds = %22, %2
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 @_pow1(i32 %26, i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25, i32 %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = call i32 @_pow2(i32 %32, i32 %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %31, i32 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"pow(%d,%d)=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp eq i32 %0, 2
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
br label %13
13: ; preds = %4, %9, %2
%14 = phi i32 [ %7, %9 ], [ %7, %4 ], [ 10, %2 ]
%15 = phi i32 [ %12, %9 ], [ 5, %4 ], [ 5, %2 ]
%16 = tail call i32 @_pow1(i32 %14, i32 %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15, i32 %16)
%18 = tail call i32 @_pow2(i32 %14, i32 %15)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15, i32 %18)
ret i32 0
}