void main() {
  int max(int, int);
  int min(int, int);
  int a, b, c;
  int (*p)();
  scanf("%d %d", &a, &b);
  c = max(a, b);
  p = min;
  printf("a=%d,b=%d,max=%d\n", a, b, c);
  printf("a=%d,b=%d,min=%d\n", a, b, (*p)(a, b));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <max@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e7d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   *%rcx
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <max@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe93(%rip),%rdi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%ebx
mov    (%rsp),%ebp
mov    %ebx,%edi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <min@plt>
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [18 x i8] c"a=%d,b=%d,max=%d\0A\00"
@.str.2 = [18 x i8] c"a=%d,b=%d,min=%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32 (...)*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @max(i32 %6, i32 %7)
store i32 %8, i32* %3
store i32 (...)* bitcast (i32 (i32, i32)* @min to i32 (...)*), i32 (...)** %4
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = load i32 (...)*, i32 (...)** %4
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = bitcast i32 (...)* %15 to i32 (i32, i32, ...)*
%19 = call i32 (i32, i32, ...) %18(i32 %16, i32 %17)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [18 x i8] c"a=%d,b=%d,max=%d\0A\00"
@.str.2 = [18 x i8] c"a=%d,b=%d,min=%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @max(i32 %6, i32 %7)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10, i32 %8)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call i32 (i32, i32, ...) bitcast (i32 (i32, i32)* @min to i32 (i32, i32, ...)*)(i32 %12, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
ret void
}