#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 /*<<< orphan*/ atoi(char const *);
double dpow(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ *strchr(char const *, char);
int /*<<< orphan*/ strtod(char const *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  const char *dbl = NULL, *nbr = NULL;
  if (argc != 3) {
    printf("usage: dpow <double/decimal number> <exponent>\n");
    exit(-1);
  }
  dbl = argv[1];
  nbr = argv[2];
  if (strchr(dbl, '.') == NULL) {
    printf("First number entered %s is not a double/decimal number\n", dbl);
    exit(-2);
  }
  printf("%s ^ %s is : %g\n", dbl, nbr, dpow(strtod(dbl, NULL), atoi(nbr)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11a8 <main+0x48>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    11f4 <main+0x94>
mov    -0x18(%rbp),%rsi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfffffffe,%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1060 <dpow@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe32(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x3,%edi
jne    11cb <main+0x5b>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11e1 <main+0x71>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1080 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1070 <dpow@plt>
lea    0xe81(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
lea    0xe18(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xfffffffe,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"usage: dpow <double/decimal number> <exponent>\0A\00"
@.str.1 = [56 x i8] c"First number entered %s is not a double/decimal number\0A\00"
@.str.2 = [17 x i8] c"%s ^ %s is : %g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
store i8* %19, i8** %7
%20 = load i8*, i8** %6
%21 = call i32* @strchr(i8* %20, i8 signext 46)
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %27
23: ; preds = %13
%24 = load i8*, i8** %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 -2)
unreachable
27: ; preds = %13
%28 = load i8*, i8** %6
%29 = load i8*, i8** %7
%30 = load i8*, i8** %6
%31 = call i32 @strtod(i8* %30, i32* null)
%32 = load i8*, i8** %7
%33 = call i32 @atoi(i8* %32)
%34 = call double @dpow(i32 %31, i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %29, double %34)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [56 x i8] c"First number entered %s is not a double/decimal number\0A\00"
@.str.2 = [17 x i8] c"%s ^ %s is : %g\0A\00"
@str = [47 x i8] c"usage: dpow <double/decimal number> <exponent>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32* @strchr(i8* %9, i8 signext 46)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%16 = tail call i32 @exit(i32 -2)
unreachable
17: ; preds = %7
%18 = tail call i32 @strtod(i8* nocapture %9, i32* null)
%19 = tail call i32 @atoi(i8* %11)
%20 = tail call double @dpow(i32 %18, i32 %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %11, double %20)
ret i32 0
}