#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  void result(int x, int y, int (*p)(int, int));
  int max(int, int);
  int min(int, int);
  int add(int, int);
  int a = 34, b = -21, choose;
  printf("numberA=34,nubmerB=-21,choose:\n\t1(max)\n\t2(min)\n\t3(add)\n ");
  scanf("%d", &choose);
  if (choose == 1)
    result(a, b, max);
  else if (choose == 2)
    result(a, b, min);
  else if (choose == 3)
    result(a, b, add);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x22,-0x8(%rbp)
movl   $0xffffffeb,-0xc(%rbp)
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    118a <main+0x5a>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2e60(%rip),%rdx
call   1040 <result@plt>
jmp    11d1 <main+0xa1>
cmpl   $0x2,-0x10(%rbp)
jne    11ab <main+0x7b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2e37(%rip),%rdx
call   1040 <result@plt>
jmp    11cc <main+0x9c>
cmpl   $0x3,-0x10(%rbp)
jne    11c7 <main+0x97>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2e0e(%rip),%rdx
call   1040 <result@plt>
jmp    11cc <main+0x9c>
jmp    11d1 <main+0xa1>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x2,%eax
ja     1176 <main+0x46>
cltq
lea    0x2ca5(%rip),%rcx
mov    (%rcx,%rax,8),%rdx
mov    $0x22,%edi
mov    $0xffffffeb,%esi
call   1040 <result@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"numberA=34,nubmerB=-21,choose:\0A\091(max)\0A\092(min)\0A\093(add)\0A \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 34, i32* %2
store i32 -21, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
br label %26
12: ; preds = %0
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = load i32, i32* %3
br label %25
18: ; preds = %12
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %2
%23 = load i32, i32* %3
br label %24
24: ; preds = %21, %18
br label %25
25: ; preds = %24, %15
br label %26
26: ; preds = %25, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"numberA=34,nubmerB=-21,choose:\0A\091(max)\0A\092(min)\0A\093(add)\0A \00"
@.str.1 = [3 x i8] c"%d\00"
@switch.table.main = [3 x i32 (i32, i32)*] [i32 (i32, i32)* @max, i32 (i32, i32)* @min, i32 (i32, i32)* @add]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%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 = add i32 %5, -1
%7 = icmp ult i32 %6, 3
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = sext i32 %6 to i64
%10 = getelementptr inbounds [3 x i32 (i32, i32)*], [3 x i32 (i32, i32)*]* @switch.table.main, i64 0, i64 %9
%11 = load i32 (i32, i32)*, i32 (i32, i32)** %10
br label %12
12: ; preds = %0, %8
ret i32 0
}