int main(void) {
  int d = 5;
  printf("%s\n", _Generic((d), int
                          : "int", float
                          : "float", double
                          : "double", default
                          : "other"));
  printf("%s\n", _Generic((2.0 * d), int
                          : "int", float
                          : "float", double
                          : "double", default
                          : "other"));
  printf("%s\n", _Generic((3L), int
                          : "int", float
                          : "float", double
                          : "double", default
                          : "other"));
  printf("%s\n", _Generic((&d), int
                          : "int", float
                          : "float", double
                          : "double", default
                          : "other"));
  printf("%d\n", square(d));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <square@plt>
mov    %eax,%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
xor    %eax,%eax
call   1040 <square@plt>
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"int\00"
@.str.2 = [7 x i8] c"double\00"
@.str.3 = [6 x i8] c"other\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 (i32, ...) bitcast (i32 (...)* @square to i32 (i32, ...)*)(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"int\00"
@.str.2 = [7 x i8] c"double\00"
@.str.3 = [6 x i8] c"other\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @square to i32 (i32, ...)*)(i32 5)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %5)
ret i32 0
}