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

/* Variables and functions */
int32_t exp_6(int32_t x) {
  int32_t x2;
  int32_t x3;
  int32_t x4;
  int32_t x5;
  if ((x < ((int32_t)(0x10000 * (1.0)))) &&
      (x > ((int32_t)(0x10000 * (-1.0))))) {
    x2 = (x * x) / 0x10000;
    x3 = (x2 * x) / 0x10000;
    x4 = (x2 * x2) / 0x10000;
    x5 = (x3 * x2) / 0x10000;
  } else {
    x2 = x * (x / 0x10000);
    x3 = x2 * (x / 0x10000);
    x4 = x2 * (x2 / 0x10000);
    x5 = x3 * (x2 / 0x10000);
  }
  return ((int32_t)(0x10000 * (1.0))) + x + (x2 / 2) + (x3 / 6) + (x4 / 24) +
         (x5 / 120);
}


x86 assembly (clang, -O0):
<exp_6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x10000,-0x4(%rbp)
jge    116e <exp_6+0x6e>
cmpl   $0xffff0000,-0x4(%rbp)
jle    116e <exp_6+0x6e>
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    11de <exp_6+0xde>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10000,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x78,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp_6>:
lea    0xffff(%rdi),%eax
cmp    $0x1fffe,%eax
ja     1148 <exp_6+0x48>
mov    %edi,%edx
imul   %edx,%edx
shr    $0x10,%edx
mov    %edx,%ecx
imul   %edi,%ecx
lea    0xffff(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x10,%eax
mov    %edx,%esi
imul   %edx,%esi
shr    $0x10,%esi
mov    %eax,%ecx
imul   %edx,%ecx
lea    0xffff(%rcx),%r8d
test   %ecx,%ecx
cmovns %ecx,%r8d
sar    $0x10,%r8d
jmp    1170 <exp_6+0x70>
test   %edi,%edi
cmovns %edi,%eax
sar    $0x10,%eax
mov    %eax,%edx
imul   %edi,%edx
imul   %edx,%eax
lea    0xffff(%rdx),%esi
test   %edx,%edx
cmovns %edx,%esi
sar    $0x10,%esi
mov    %eax,%r8d
imul   %esi,%r8d
imul   %edx,%esi
mov    %edx,%ecx
shr    $0x1f,%ecx
add    %edx,%ecx
sar    %ecx
add    %ecx,%edi
cltq
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %edi,%eax
movslq %esi,%rcx
imul   $0x2aaaaaab,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %eax,%ecx
movslq %r8d,%rax
imul   $0xffffffff88888889,%rax,%rdx
shr    $0x20,%rdx
add    %edx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x6,%eax
add    %edx,%eax
add    %ecx,%eax
add    $0x10000,%eax
ret

LLVM IR (-O0):
define i32 @exp_6(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 65536
br i1 %8, label %9, label %29
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, -65536
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = mul nsw i32 %13, %14
%16 = sdiv i32 %15, 65536
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = mul nsw i32 %17, %18
%20 = sdiv i32 %19, 65536
store i32 %20, i32* %4
%21 = load i32, i32* %3
%22 = load i32, i32* %3
%23 = mul nsw i32 %21, %22
%24 = sdiv i32 %23, 65536
store i32 %24, i32* %5
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = mul nsw i32 %25, %26
%28 = sdiv i32 %27, 65536
store i32 %28, i32* %6
br label %46
29: ; preds = %9, %1
%30 = load i32, i32* %2
%31 = load i32, i32* %2
%32 = sdiv i32 %31, 65536
%33 = mul nsw i32 %30, %32
store i32 %33, i32* %3
%34 = load i32, i32* %3
%35 = load i32, i32* %2
%36 = sdiv i32 %35, 65536
%37 = mul nsw i32 %34, %36
store i32 %37, i32* %4
%38 = load i32, i32* %3
%39 = load i32, i32* %3
%40 = sdiv i32 %39, 65536
%41 = mul nsw i32 %38, %40
store i32 %41, i32* %5
%42 = load i32, i32* %4
%43 = load i32, i32* %3
%44 = sdiv i32 %43, 65536
%45 = mul nsw i32 %42, %44
store i32 %45, i32* %6
br label %46
46: ; preds = %29, %12
%47 = load i32, i32* %2
%48 = add nsw i32 65536, %47
%49 = load i32, i32* %3
%50 = sdiv i32 %49, 2
%51 = add nsw i32 %48, %50
%52 = load i32, i32* %4
%53 = sdiv i32 %52, 6
%54 = add nsw i32 %51, %53
%55 = load i32, i32* %5
%56 = sdiv i32 %55, 24
%57 = add nsw i32 %54, %56
%58 = load i32, i32* %6
%59 = sdiv i32 %58, 120
%60 = add nsw i32 %57, %59
ret i32 %60
}

LLVM IR (-O2):
define i32 @exp_6(i32 %0) {
%2 = add i32 %0, 65535
%3 = icmp ult i32 %2, 131071
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = mul nsw i32 %0, %0
%6 = lshr i32 %5, 16
%7 = mul nsw i32 %6, %0
%8 = sdiv i32 %7, 65536
%9 = mul nuw nsw i32 %6, %6
%10 = lshr i32 %9, 16
%11 = mul nsw i32 %8, %6
%12 = sdiv i32 %11, 65536
br label %20
13: ; preds = %1
%14 = sdiv i32 %0, 65536
%15 = mul nsw i32 %14, %0
%16 = mul nsw i32 %15, %14
%17 = sdiv i32 %15, 65536
%18 = mul nsw i32 %17, %15
%19 = mul nsw i32 %16, %17
br label %20
20: ; preds = %13, %4
%21 = phi i32 [ %6, %4 ], [ %15, %13 ]
%22 = phi i32 [ %8, %4 ], [ %16, %13 ]
%23 = phi i32 [ %10, %4 ], [ %18, %13 ]
%24 = phi i32 [ %12, %4 ], [ %19, %13 ]
%25 = add nsw i32 %0, 65536
%26 = sdiv i32 %21, 2
%27 = add nsw i32 %25, %26
%28 = sdiv i32 %22, 6
%29 = add nsw i32 %27, %28
%30 = sdiv i32 %23, 24
%31 = add nsw i32 %29, %30
%32 = sdiv i32 %24, 120
%33 = add nsw i32 %31, %32
ret i32 %33
}