#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 Mult(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int stub1(int, int);
int stub2(int, int);
int main() {
  int a, b;
  int (*func)(int, int);
  printf("请输入两个数a,b:");
  scanf("%d,%d", &a, &b);
  printf("第一种调用方法：调用函数名：\n");
  printf("%d * %d = %d\n", a, b, Mult(a, b));
  func = Mult;
  printf("第二种调用方法，函数指针调用：\n");
  printf("%d * %d = %d\n", a, b, (*func)(a, b));
  return 0;
}
int Mult(int a, int b) { return a * b; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <Mult@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    %eax,%ecx
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e55(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   *%rax
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %edx,%ecx
imul   %esi,%ecx
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %edx,%ecx
imul   %esi,%ecx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xchg   %ax,%ax

LLVM IR (-O0):
@.str = [23 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\A4\E4\B8\AA\E6\95\B0a,b:\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [44 x i8] c"\E7\AC\AC\E4\B8\80\E7\A7\8D\E8\B0\83\E7\94\A8\E6\96\B9\E6\B3\95\EF\BC\9A\E8\B0\83\E7\94\A8\E5\87\BD\E6\95\B0\E5\90\8D\EF\BC\9A\0A\00"
@.str.3 = [14 x i8] c"%d * %d = %d\0A\00"
@.str.4 = [47 x i8] c"\E7\AC\AC\E4\BA\8C\E7\A7\8D\E8\B0\83\E7\94\A8\E6\96\B9\E6\B3\95\EF\BC\8C\E5\87\BD\E6\95\B0\E6\8C\87\E9\92\88\E8\B0\83\E7\94\A8\EF\BC\9A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32 (i32, i32)*
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @Mult(i32 %10, i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %9, i32 %12)
store i32 (i32, i32)* @Mult, i32 (i32, i32)** %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32 (i32, i32)*, i32 (i32, i32)** %4
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 %17(i32 %18, i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %16, i32 %20)
ret i32 0
}
define i32 @Mult(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
@.str = [23 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\A4\E4\B8\AA\E6\95\B0a,b:\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.3 = [14 x i8] c"%d * %d = %d\0A\00"
@str = [43 x i8] c"\E7\AC\AC\E4\B8\80\E7\A7\8D\E8\B0\83\E7\94\A8\E6\96\B9\E6\B3\95\EF\BC\9A\E8\B0\83\E7\94\A8\E5\87\BD\E6\95\B0\E5\90\8D\EF\BC\9A\00"
@str.5 = [46 x i8] c"\E7\AC\AC\E4\BA\8C\E7\A7\8D\E8\B0\83\E7\94\A8\E6\96\B9\E6\B3\95\EF\BC\8C\E5\87\BD\E6\95\B0\E6\8C\87\E9\92\88\E8\B0\83\E7\94\A8\EF\BC\9A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, %8
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.5, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, %13
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
ret i32 0
}
define i32 @Mult(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}