#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_double(double);
int /*<<< orphan*/ print_float(float);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
void print_log(double *d, float *f, char *log) {
  if (d != NULL) {
    print_double(*d);
  } else if (f != NULL) {
    print_float(*f);
  } else {
    fprintf(stderr, "undefined real size\n");
  }
  printf("%s\n", log);
}


x86 assembly (clang, -O0):
<print_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1171 <print_log+0x31>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1050 <print_double@plt>
jmp    11a8 <print_log+0x68>
cmpq   $0x0,-0x10(%rbp)
je     118e <print_log+0x4e>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
call   1060 <print_float@plt>
jmp    11a3 <print_log+0x63>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11a8 <print_log+0x68>
mov    -0x18(%rbp),%rsi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_log>:
push   %rbx
mov    %rdx,%rbx
test   %rdi,%rdi
je     1154 <print_log+0x14>
movsd  (%rdi),%xmm0
call   1050 <print_double@plt>
jmp    1179 <print_log+0x39>
test   %rsi,%rsi
je     1164 <print_log+0x24>
movss  (%rsi),%xmm0
call   1060 <print_float@plt>
jmp    1179 <print_log+0x39>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xe95(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"undefined real size\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @print_log(double* %0, float* %1, i8* %2) {
%4 = alloca double*
%5 = alloca float*
%6 = alloca i8*
store double* %0, double** %4
store float* %1, float** %5
store i8* %2, i8** %6
%7 = load double*, double** %4
%8 = icmp ne double* %7, null
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load double*, double** %4
%11 = load double, double* %10
%12 = call i32 @print_double(double %11)
br label %24
13: ; preds = %3
%14 = load float*, float** %5
%15 = icmp ne float* %14, null
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load float*, float** %5
%18 = load float, float* %17
%19 = call i32 @print_float(float %18)
br label %23
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %20, %16
br label %24
24: ; preds = %23, %9
%25 = load i8*, i8** %6
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %25)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"undefined real size\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @print_log(double* %0, float* %1, i8* %2) {
%4 = icmp eq double* %0, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = load double, double* %0
%7 = tail call i32 @print_double(double %6)
br label %16
8: ; preds = %3
%9 = icmp eq float* %1, null
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = load float, float* %1
%12 = tail call i32 @print_float(float %11)
br label %16
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %10, %13, %5
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}