#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 uint64_t;

/* Variables and functions */
int do_exp(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  printf("Fast exponentiation test\n");
  uint64_t base;
  for (base = 3; base <= 7; base++) {
    uint64_t exp;
    for (exp = 3; exp <= 7; exp++) {
      uint64_t result = do_exp(base, exp);
      printf("%lld ^ %lld = %lld.\n", base, exp, 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)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x3,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jg     11ac <main+0x8c>
movl   $0x3,-0x18(%rbp)
cmpl   $0x7,-0x18(%rbp)
jg     1199 <main+0x79>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <do_exp@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <main+0x3c>
jmp    119e <main+0x7e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1040 <do_exp@plt>
lea    0xead(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x4,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
mov    $0x5,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
mov    $0x6,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x6,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
mov    $0x7,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x7,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
mov    $0x3,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x3,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
mov    $0x4,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
mov    $0x5,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
mov    $0x6,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x6,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
mov    $0x7,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x7,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x5,%edi
mov    $0x3,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x5,%edi
mov    $0x4,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x4,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x5,%edi
mov    $0x5,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x5,%edi
mov    $0x6,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x6,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x5,%edi
mov    $0x7,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x7,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x6,%edi
mov    $0x3,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x3,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x6,%edi
mov    $0x4,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x4,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x6,%edi
mov    $0x5,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x6,%edi
mov    $0x6,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x6,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x6,%edi
mov    $0x7,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x7,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7,%edi
mov    $0x3,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x3,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7,%edi
mov    $0x4,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x4,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7,%edi
mov    $0x5,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7,%edi
mov    $0x6,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x6,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7,%edi
mov    $0x7,%esi
call   1040 <do_exp@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x7,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Fast exponentiation test\0A\00"
@.str.1 = [21 x i8] c"%lld ^ %lld = %lld.\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 3, i32* %6
br label %10
10: ; preds = %29, %2
%11 = load i32, i32* %6
%12 = icmp sle i32 %11, 7
br i1 %12, label %13, label %32
13: ; preds = %10
store i32 3, i32* %7
br label %14
14: ; preds = %25, %13
%15 = load i32, i32* %7
%16 = icmp sle i32 %15, 7
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @do_exp(i32 %18, i32 %19)
store i32 %20, i32* %8
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %14
28: ; preds = %14
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %10
32: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"%lld ^ %lld = %lld.\0A\00"
@str = [25 x i8] c"Fast exponentiation test\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @do_exp(i32 3, i32 3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 3, i32 %4)
%6 = tail call i32 @do_exp(i32 3, i32 4)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 4, i32 %6)
%8 = tail call i32 @do_exp(i32 3, i32 5)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 %8)
%10 = tail call i32 @do_exp(i32 3, i32 6)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 6, i32 %10)
%12 = tail call i32 @do_exp(i32 3, i32 7)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 7, i32 %12)
%14 = tail call i32 @do_exp(i32 4, i32 3)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 3, i32 %14)
%16 = tail call i32 @do_exp(i32 4, i32 4)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 4, i32 %16)
%18 = tail call i32 @do_exp(i32 4, i32 5)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 5, i32 %18)
%20 = tail call i32 @do_exp(i32 4, i32 6)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 6, i32 %20)
%22 = tail call i32 @do_exp(i32 4, i32 7)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 7, i32 %22)
%24 = tail call i32 @do_exp(i32 5, i32 3)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 3, i32 %24)
%26 = tail call i32 @do_exp(i32 5, i32 4)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 4, i32 %26)
%28 = tail call i32 @do_exp(i32 5, i32 5)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 5, i32 %28)
%30 = tail call i32 @do_exp(i32 5, i32 6)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 6, i32 %30)
%32 = tail call i32 @do_exp(i32 5, i32 7)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 7, i32 %32)
%34 = tail call i32 @do_exp(i32 6, i32 3)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 3, i32 %34)
%36 = tail call i32 @do_exp(i32 6, i32 4)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 4, i32 %36)
%38 = tail call i32 @do_exp(i32 6, i32 5)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 5, i32 %38)
%40 = tail call i32 @do_exp(i32 6, i32 6)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 6, i32 %40)
%42 = tail call i32 @do_exp(i32 6, i32 7)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 7, i32 %42)
%44 = tail call i32 @do_exp(i32 7, i32 3)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 3, i32 %44)
%46 = tail call i32 @do_exp(i32 7, i32 4)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 4, i32 %46)
%48 = tail call i32 @do_exp(i32 7, i32 5)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 5, i32 %48)
%50 = tail call i32 @do_exp(i32 7, i32 6)
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 6, i32 %50)
%52 = tail call i32 @do_exp(i32 7, i32 7)
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 7, i32 %52)
ret i32 0
}