#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 */
double MAXDOUBLE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ log_kai2(int);
double pow(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
double kaijo2(int n) {
  if (n < 0) {
    fprintf(stderr, "Error : n < 0  in kaijo2()\n");
    return 0.;
  }
  if (n > 170) {
    fprintf(stderr, "Error : Too large n (n > 170)  in kaijo2()\n");
    return MAXDOUBLE;
  }
  return pow(10., log_kai2(n));
}


x86 assembly (clang, -O0):
<kaijo2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1167 <kaijo2+0x37>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
call   1040 <fprintf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b7 <kaijo2+0x87>
cmpl   $0xaa,-0xc(%rbp)
jle    119e <kaijo2+0x6e>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e48(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b7 <kaijo2+0x87>
mov    -0xc(%rbp),%edi
call   1030 <log_kai2@plt>
mov    %eax,%esi
mov    $0xa,%edi
call   1050 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kaijo2>:
push   %rax
test   %edi,%edi
js     115f <kaijo2+0x2f>
cmp    $0xab,%edi
jb     1179 <kaijo2+0x49>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e7f(%rip),%rax
movsd  (%rax),%xmm0
pop    %rax
ret
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1040 <fprintf@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret
call   1030 <log_kai2@plt>
mov    $0xa,%edi
mov    %eax,%esi
pop    %rax
jmp    1050 <pow@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Error : n < 0 in kaijo2()\0A\00"
@.str.1 = [44 x i8] c"Error : Too large n (n > 170) in kaijo2()\0A\00"
@MAXDOUBLE = global double 0.000000e+00
define double @kaijo2(i32 %0) {
%2 = alloca double
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %2
br label %20
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 170
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%15 = load double, double* @MAXDOUBLE
store double %15, double* %2
br label %20
16: ; preds = %9
%17 = load i32, i32* %3
%18 = call i32 @log_kai2(i32 %17)
%19 = call double @pow(i32 10, i32 %18)
store double %19, double* %2
br label %20
20: ; preds = %16, %12, %6
%21 = load double, double* %2
ret double %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Error : n < 0 in kaijo2()\0A\00"
@.str.1 = [44 x i8] c"Error : Too large n (n > 170) in kaijo2()\0A\00"
@MAXDOUBLE = global double 0.000000e+00
define double @kaijo2(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %15
6: ; preds = %1
%7 = icmp ugt i32 %0, 170
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%11 = load double, double* @MAXDOUBLE
br label %15
12: ; preds = %6
%13 = tail call i32 @log_kai2(i32 %0)
%14 = tail call double @pow(i32 10, i32 %13)
br label %15
15: ; preds = %12, %8, %3
%16 = phi double [ 0.000000e+00, %3 ], [ %11, %8 ], [ %14, %12 ]
ret double %16
}