#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char, char);
int /*<<< orphan*/ stderr;
char pow_fun_char(char a, char b) {
  char r = 1;
  int i;
  if (b < 0) {
    fprintf(stderr, "Negative exponent in function pow_fun_(): %d `pow` %d", a,
            b);
    exit(1);
  }
  for (i = 0; i < b; ++i)
    r *= a;
  return r;
}


x86 assembly (clang, -O0):
<pow_fun_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movb   $0x1,-0x3(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jge    116e <pow_fun_char+0x4e>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    -0x1(%rbp),%al
lea    0xea8(%rip),%rsi
movsbl %al,%edx
movsbl -0x2(%rbp),%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jge    11a0 <pow_fun_char+0x80>
movsbl -0x1(%rbp),%ecx
movsbl -0x3(%rbp),%eax
imul   %ecx,%eax
mov    %al,-0x3(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <pow_fun_char+0x55>
movsbl -0x3(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow_fun_char>:
push   %rax
test   %sil,%sil
js     136a <pow_fun_char+0x24a>
je     113f <pow_fun_char+0x1f>
movzbl %sil,%ecx
cmp    $0x8,%sil
jae    1146 <pow_fun_char+0x26>
mov    $0x1,%al
xor    %edx,%edx
jmp    1350 <pow_fun_char+0x230>
mov    $0x1,%al
jmp    1368 <pow_fun_char+0x248>
movzbl %dil,%r8d
cmp    $0x10,%sil
jae    1159 <pow_fun_char+0x39>
xor    %edx,%edx
mov    $0x1,%al
jmp    12cc <pow_fun_char+0x1ac>
mov    %ecx,%edx
and    $0xfffffff0,%edx
movd   %r8d,%xmm1
movdqa %xmm1,%xmm0
punpcklbw %xmm1,%xmm0
pshuflw $0x0,%xmm0,%xmm0
pshufd $0x0,%xmm0,%xmm0
cmp    $0x10,%edx
je     1287 <pow_fun_char+0x167>
pmullw %xmm1,%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x0,%xmm1,%xmm1
pshufd $0x0,%xmm1,%xmm1
cmp    $0x20,%edx
je     1283 <pow_fun_char+0x163>
movdqa %xmm0,%xmm2
punpckhbw %xmm2,%xmm2
movdqa %xmm1,%xmm3
punpckhbw %xmm3,%xmm3
pmullw %xmm2,%xmm3
movdqa 0xe4b(%rip),%xmm2
pand   %xmm2,%xmm3
movdqa %xmm0,%xmm4
punpcklbw %xmm4,%xmm4
punpcklbw %xmm1,%xmm1
pmullw %xmm4,%xmm1
pand   %xmm2,%xmm1
packuswb %xmm3,%xmm1
cmp    $0x30,%edx
je     1283 <pow_fun_char+0x163>
movdqa %xmm0,%xmm3
punpckhbw %xmm3,%xmm3
movdqa %xmm1,%xmm4
punpckhbw %xmm4,%xmm4
pmullw %xmm3,%xmm4
pand   %xmm2,%xmm4
movdqa %xmm0,%xmm3
punpcklbw %xmm3,%xmm3
punpcklbw %xmm1,%xmm1
pmullw %xmm3,%xmm1
pand   %xmm2,%xmm1
packuswb %xmm4,%xmm1
cmp    $0x40,%edx
je     1283 <pow_fun_char+0x163>
movdqa %xmm0,%xmm3
punpckhbw %xmm3,%xmm3
movdqa %xmm1,%xmm4
punpckhbw %xmm4,%xmm4
pmullw %xmm3,%xmm4
pand   %xmm2,%xmm4
movdqa %xmm0,%xmm3
punpcklbw %xmm3,%xmm3
punpcklbw %xmm1,%xmm1
pmullw %xmm3,%xmm1
pand   %xmm2,%xmm1
packuswb %xmm4,%xmm1
cmp    $0x50,%edx
je     1283 <pow_fun_char+0x163>
movdqa %xmm0,%xmm4
punpckhbw %xmm4,%xmm4
movdqa %xmm1,%xmm3
punpckhbw %xmm3,%xmm3
pmullw %xmm4,%xmm3
punpcklbw %xmm0,%xmm0
punpcklbw %xmm1,%xmm1
pmullw %xmm0,%xmm1
cmp    $0x60,%edx
je     1277 <pow_fun_char+0x157>
pmullw %xmm4,%xmm3
pand   %xmm2,%xmm3
pmullw %xmm0,%xmm1
jmp    127b <pow_fun_char+0x15b>
pand   %xmm2,%xmm3
pand   %xmm2,%xmm1
packuswb %xmm3,%xmm1
movdqa %xmm1,%xmm0
movdqa %xmm0,%xmm1
punpckhbw %xmm1,%xmm1
punpcklbw %xmm0,%xmm0
pmullw %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
pmullw %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
pmullw %xmm1,%xmm0
movdqa %xmm0,%xmm1
psrld  $0x10,%xmm1
pmullw %xmm0,%xmm1
movd   %xmm1,%eax
cmp    %ecx,%edx
je     1368 <pow_fun_char+0x248>
test   $0x8,%sil
je     1350 <pow_fun_char+0x230>
mov    %edx,%esi
mov    %ecx,%edx
and    $0xfffffff8,%edx
movzbl %al,%eax
movd   %eax,%xmm1
movdqa 0xd2e(%rip),%xmm0
pandn  %xmm1,%xmm0
por    0xd32(%rip),%xmm0
movd   %r8d,%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x0,%xmm1,%xmm1
sub    %edx,%esi
punpcklbw %xmm1,%xmm1
movdqa 0xcf6(%rip),%xmm2
nopw   0x0(%rax,%rax,1)
punpcklbw %xmm0,%xmm0
pmullw %xmm1,%xmm0
pand   %xmm2,%xmm0
packuswb %xmm0,%xmm0
add    $0x8,%esi
jne    1310 <pow_fun_char+0x1f0>
punpcklbw %xmm0,%xmm0
pshufd $0xee,%xmm0,%xmm1
pmullw %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
pmullw %xmm1,%xmm0
movdqa %xmm0,%xmm1
psrld  $0x10,%xmm1
pmullw %xmm0,%xmm1
movd   %xmm1,%eax
cmp    %ecx,%edx
je     1368 <pow_fun_char+0x248>
sub    %edx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mul    %dil
add    $0xffffffff,%ecx
jne    1360 <pow_fun_char+0x240>
pop    %rcx
ret
mov    0x2c6f(%rip),%rax
mov    (%rax),%eax
movsbl %dil,%edx
movsbl %sil,%ecx
lea    0xcae(%rip),%rsi
mov    %eax,%edi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"Negative exponent in function pow_fun_(): %d `pow` %d\00"
define signext i8 @pow_fun_char(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i8 1, i8* %5
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8, i8* %3
%13 = load i8, i8* %4
%14 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8 signext %12, i8 signext %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
store i32 0, i32* %6
br label %17
17: ; preds = %29, %16
%18 = load i32, i32* %6
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %32
22: ; preds = %17
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = mul nsw i32 %26, %24
%28 = trunc i32 %27 to i8
store i8 %28, i8* %5
br label %29
29: ; preds = %22
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %17
32: ; preds = %17
%33 = load i8, i8* %5
ret i8 %33
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"Negative exponent in function pow_fun_(): %d `pow` %d\00"
define signext i8 @pow_fun_char(i8 signext %0, i8 signext %1) {
%3 = icmp slt i8 %1, 0
br i1 %3, label %60, label %4
4: ; preds = %2
%5 = icmp eq i8 %1, 0
br i1 %5, label %70, label %6
6: ; preds = %4
%7 = zext i8 %1 to i32
%8 = icmp ult i8 %1, 8
br i1 %8, label %57, label %9
9: ; preds = %6
%10 = icmp ult i8 %1, 16
br i1 %10, label %41, label %11
11: ; preds = %9
%12 = and i32 %7, 240
%13 = insertelement <16 x i8> poison, i8 %0, i64 0
%14 = shufflevector <16 x i8> %13, <16 x i8> poison, <16 x i32> zeroinitializer
%15 = icmp eq i32 %12, 16
br i1 %15, label %34, label %16
16: ; preds = %11
%17 = mul <16 x i8> %13, %13
%18 = shufflevector <16 x i8> %17, <16 x i8> poison, <16 x i32> zeroinitializer
%19 = icmp eq i32 %12, 32
br i1 %19, label %34, label %20
20: ; preds = %16
%21 = mul <16 x i8> %18, %14
%22 = icmp eq i32 %12, 48
br i1 %22, label %34, label %23
23: ; preds = %20
%24 = mul <16 x i8> %21, %14
%25 = icmp eq i32 %12, 64
br i1 %25, label %34, label %26
26: ; preds = %23
%27 = mul <16 x i8> %24, %14
%28 = icmp eq i32 %12, 80
br i1 %28, label %34, label %29
29: ; preds = %26
%30 = mul <16 x i8> %27, %14
%31 = icmp eq i32 %12, 96
%32 = mul <16 x i8> %30, %14
%33 = select i1 %31, <16 x i8> %30, <16 x i8> %32
br label %34
34: ; preds = %29, %26, %23, %20, %16, %11
%35 = phi <16 x i8> [ %14, %11 ], [ %18, %16 ], [ %21, %20 ], [ %24, %23 ], [ %27, %26 ], [ %33, %29 ]
%36 = call i8 @llvm.vector.reduce.mul.v16i8(<16 x i8> %35)
%37 = icmp eq i32 %12, %7
br i1 %37, label %70, label %38
38: ; preds = %34
%39 = and i32 %7, 8
%40 = icmp eq i32 %39, 0
br i1 %40, label %57, label %41
41: ; preds = %9, %38
%42 = phi i8 [ 1, %9 ], [ %36, %38 ]
%43 = phi i32 [ 0, %9 ], [ %12, %38 ]
%44 = and i32 %7, 248
%45 = insertelement <8 x i8> <i8 poison, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, i8 %42, i64 0
%46 = insertelement <8 x i8> poison, i8 %0, i64 0
%47 = shufflevector <8 x i8> %46, <8 x i8> poison, <8 x i32> zeroinitializer
br label %48
48: ; preds = %48, %41
%49 = phi i32 [ %43, %41 ], [ %52, %48 ]
%50 = phi <8 x i8> [ %45, %41 ], [ %51, %48 ]
%51 = mul <8 x i8> %50, %47
%52 = add nuw i32 %49, 8
%53 = icmp eq i32 %52, %44
br i1 %53, label %54, label %48
54: ; preds = %48
%55 = call i8 @llvm.vector.reduce.mul.v8i8(<8 x i8> %51)
%56 = icmp eq i32 %44, %7
br i1 %56, label %70, label %57
57: ; preds = %6, %38, %54
%58 = phi i32 [ 0, %6 ], [ %12, %38 ], [ %44, %54 ]
%59 = phi i8 [ 1, %6 ], [ %36, %38 ], [ %55, %54 ]
br label %64
60: ; preds = %2
%61 = load i32, i32* @stderr
%62 = tail call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8 signext %0, i8 signext %1)
%63 = tail call i32 @exit(i32 1)
unreachable
64: ; preds = %57, %64
%65 = phi i32 [ %68, %64 ], [ %58, %57 ]
%66 = phi i8 [ %67, %64 ], [ %59, %57 ]
%67 = mul i8 %66, %0
%68 = add nuw nsw i32 %65, 1
%69 = icmp eq i32 %68, %7
br i1 %69, label %70, label %64
70: ; preds = %64, %34, %54, %4
%71 = phi i8 [ 1, %4 ], [ %36, %34 ], [ %55, %54 ], [ %67, %64 ]
ret i8 %71
}