#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 */
float EvenSum(int);
float OddSum(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  float (*funcptr)() = NULL;
  printf("please input a number:\n");
  int num = 1;
  float sum = 0;
  scanf("%d", &num);
  if (0 == (num % 2)) {
    sum = EvenSum(num);
  } else {
    sum = OddSum(num);
  }
  printf("sum:%f\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xea4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    11a4 <main+0x64>
mov    -0xc(%rbp),%edi
call   1050 <EvenSum@plt>
movss  %xmm0,-0x10(%rbp)
jmp    11b1 <main+0x71>
mov    -0xc(%rbp),%edi
call   1030 <OddSum@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,0x4(%rsp)
lea    0xe94(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
test   $0x1,%dil
jne    1187 <main+0x37>
call   1060 <EvenSum@plt>
jmp    118c <main+0x3c>
call   1030 <OddSum@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe6c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [24 x i8] c"please input a number:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"sum:%f\0A\00"
define void @main() {
%1 = alloca float (...)*
%2 = alloca i32
%3 = alloca float
store float (...)* null, float (...)** %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
store float 0.000000e+00, float* %3
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = srem i32 %6, 2
%8 = icmp eq i32 0, %7
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %2
%11 = call float @EvenSum(i32 %10)
store float %11, float* %3
br label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call float @OddSum(i32 %13)
store float %14, float* %3
br label %15
15: ; preds = %12, %9
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %17)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"sum:%f\0A\00"
@str = [23 x i8] c"please input a number:\00"
define void @main() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call float @EvenSum(i32 %5)
br label %12
10: ; preds = %0
%11 = call float @OddSum(i32 %5)
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %14)
ret void
}