#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 *);
char getchar();
double mypow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int a, p, i, j;
  char e[10], r[10];
  double result;
  result = 0;
  printf("geef grondtal: ");
  for (i = 0; (e[i] = getchar()) != '\n'; i++)
    ;
  e[i] = '\0';
  a = atoi(e);
  printf("geef macht: ");
  for (j = 0; (r[j] = getchar()) != '\n'; j++)
    ;
  r[j] = '\0';
  p = atoi(r);
  printf("%d%d\n", a, p);
  result = mypow(a, p);
  printf("resultaat: %.f\n", result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0x10(%rbp),%rcx
mov    %al,-0x1e(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     119a <main+0x5a>
jmp    118c <main+0x4c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116c <main+0x2c>
movslq -0x10(%rbp),%rax
movb   $0x0,-0x1e(%rbp,%rax,1)
lea    -0x1e(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x8(%rbp)
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0x14(%rbp),%rcx
mov    %al,-0x28(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11f2 <main+0xb2>
jmp    11e4 <main+0xa4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c4 <main+0x84>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x28(%rbp,%rax,1)
lea    -0x28(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <mypow@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xdec(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0xf(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1160 <main+0x20>
mov    %ebx,%eax
movb   $0x0,0xe(%rsp,%rax,1)
lea    0xe(%rsp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffffffffffff,%rbp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x5(%rsp,%rbp,1)
add    $0x1,%rbp
cmp    $0xa,%al
jne    11a0 <main+0x60>
mov    %ebp,%eax
movb   $0x0,0x4(%rsp,%rax,1)
lea    0x4(%rsp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
lea    0xe50(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <mypow@plt>
lea    0xe3b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"geef grondtal: \00"
@.str.1 = [13 x i8] c"geef macht: \00"
@.str.2 = [6 x i8] c"%d%d\0A\00"
@.str.3 = [16 x i8] c"resultaat: %.f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [10 x i8]
%7 = alloca [10 x i8]
%8 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %10
10: ; preds = %18, %0
%11 = call signext i8 (...) @getchar()
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 %13
store i8 %11, i8* %14
%15 = sext i8 %11 to i32
%16 = icmp ne i32 %15, 10
br i1 %16, label %17, label %21
17: ; preds = %10
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %10
21: ; preds = %10
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 %23
store i8 0, i8* %24
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %28
28: ; preds = %36, %21
%29 = call signext i8 (...) @getchar()
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %31
store i8 %29, i8* %32
%33 = sext i8 %29 to i32
%34 = icmp ne i32 %33, 10
br i1 %34, label %35, label %39
35: ; preds = %28
br label %36
36: ; preds = %35
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %28
39: ; preds = %28
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %41
store i8 0, i8* %42
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%44 = call i32 @atoi(i8* %43)
store i32 %44, i32* %3
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %45, i32 %46)
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = call double @mypow(i32 %48, i32 %49)
store double %50, double* %8
%51 = load double, double* %8
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %51)
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str = [16 x i8] c"geef grondtal: \00"
@.str.1 = [13 x i8] c"geef macht: \00"
@.str.2 = [6 x i8] c"%d%d\0A\00"
@.str.3 = [16 x i8] c"resultaat: %.f\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = phi i64 [ %11, %6 ], [ 0, %0 ]
%8 = tail call signext i8 (...) @getchar()
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %7
store i8 %8, i8* %9
%10 = icmp eq i8 %8, 10
%11 = add nuw i64 %7, 1
br i1 %10, label %12, label %6
12: ; preds = %6
%13 = and i64 %7, 4294967295
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %13
store i8 0, i8* %14
%15 = call i32 @atoi(i8* %3)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %17, %12
%18 = phi i64 [ %22, %17 ], [ 0, %12 ]
%19 = tail call signext i8 (...) @getchar()
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %18
store i8 %19, i8* %20
%21 = icmp eq i8 %19, 10
%22 = add nuw i64 %18, 1
br i1 %21, label %23, label %17
23: ; preds = %17
%24 = and i64 %18, 4294967295
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %24
store i8 0, i8* %25
%26 = call i32 @atoi(i8* %4)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %26)
%28 = tail call double @mypow(i32 %15, i32 %26)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %28)
ret i32 0
}