#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ write_by_half_octet(int /*<<< orphan*/ *, int);
int main() {
  char tag[10];
  scanf("%s", tag);
  union {
    uint8_t data[sizeof(long double)];
    float v_f;
    double v_d;
    long double v_ld;
  } value = {};
  if (!strcmp(tag, "float")) {
    scanf("%f", &value.v_f);
    write_by_half_octet(value.data, sizeof(value.v_f));
  } else if (!strcmp(tag, "double")) {
    scanf("%lf", &value.v_d);
    write_by_half_octet(value.data, sizeof(value.v_d));
  } else if (!strcmp(tag, "long")) {
    scanf("%*s");
    scanf("%Lf", &value.v_ld);
    write_by_half_octet(value.data, sizeof(value.v_ld));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
lea    -0xe(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11af <main+0x6f>
lea    -0x50(%rbp),%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x4,%esi
call   1030 <write_by_half_octet@plt>
jmp    123e <main+0xfe>
lea    -0xe(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11ed <main+0xad>
lea    -0x50(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1030 <write_by_half_octet@plt>
jmp    1239 <main+0xf9>
lea    -0xe(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1234 <main+0xf4>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x10,%esi
call   1030 <write_by_half_octet@plt>
jmp    1239 <main+0xf9>
jmp    123e <main+0xfe>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
lea    0xed5(%rip),%rdi
lea    0x6(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
mov    $0x616f6c66,%eax
xor    0x6(%rsp),%eax
movaps %xmm0,0x10(%rsp)
movzwl 0xa(%rsp),%ecx
xor    $0x74,%ecx
or     %eax,%ecx
je     11b3 <main+0x93>
mov    $0x62756f64,%eax
xor    0x6(%rsp),%eax
mov    $0x656c62,%ecx
xor    0x9(%rsp),%ecx
or     %eax,%ecx
je     11cd <main+0xad>
mov    $0x676e6f6c,%eax
xor    0x6(%rsp),%eax
movzbl 0xa(%rsp),%ecx
or     %eax,%ecx
jne    11ef <main+0xcf>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xe80(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0x10,%esi
jmp    11e5 <main+0xc5>
lea    0xe4f(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0x4,%esi
jmp    11e5 <main+0xc5>
lea    0xe3f(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0x8,%esi
lea    0x10(%rsp),%rdi
call   1030 <write_by_half_octet@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
%union.anon = type { x86_fp80, [48 x i8] }
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"float\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [7 x i8] c"double\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [5 x i8] c"long\00"
@.str.6 = [4 x i8] c"%*s\00"
@.str.7 = [4 x i8] c"%Lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca %union.anon
store i32 0, i32* %1
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = bitcast %union.anon* %3 to i8*
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %0
%11 = bitcast %union.anon* %3 to float*
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %11)
%13 = bitcast %union.anon* %3 to [16 x i32]*
%14 = getelementptr inbounds [16 x i32], [16 x i32]* %13, i64 0, i64 0
%15 = call i32 @write_by_half_octet(i32* %14, i32 4)
br label %39
16: ; preds = %0
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %16
%21 = bitcast %union.anon* %3 to double*
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %21)
%23 = bitcast %union.anon* %3 to [16 x i32]*
%24 = getelementptr inbounds [16 x i32], [16 x i32]* %23, i64 0, i64 0
%25 = call i32 @write_by_half_octet(i32* %24, i32 8)
br label %38
26: ; preds = %16
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %37, label %30
30: ; preds = %26
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%32 = bitcast %union.anon* %3 to x86_fp80*
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), x86_fp80* %32)
%34 = bitcast %union.anon* %3 to [16 x i32]*
%35 = getelementptr inbounds [16 x i32], [16 x i32]* %34, i64 0, i64 0
%36 = call i32 @write_by_half_octet(i32* %35, i32 16)
br label %37
37: ; preds = %30, %26
br label %38
38: ; preds = %37, %20
br label %39
39: ; preds = %38, %10
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
%union.anon = type { x86_fp80, [48 x i8] }
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"float\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [7 x i8] c"double\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [5 x i8] c"long\00"
@.str.6 = [4 x i8] c"%*s\00"
@.str.7 = [4 x i8] c"%Lf\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca %union.anon
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = bitcast %union.anon* %2 to i8*
%6 = call i32 @bcmp(i8* dereferenceable(6) %3, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 6)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %union.anon* %2)
br label %22
10: ; preds = %0
%11 = call i32 @bcmp(i8* dereferenceable(7) %3, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %union.anon* %2)
br label %22
15: ; preds = %10
%16 = call i32 @bcmp(i8* dereferenceable(5) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 5)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%20 = getelementptr inbounds %union.anon, %union.anon* %2, i64 0, i32 0
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), x86_fp80* %20)
br label %22
22: ; preds = %8, %18, %13
%23 = phi i32 [ 8, %13 ], [ 16, %18 ], [ 4, %8 ]
%24 = bitcast %union.anon* %2 to i32*
%25 = call i32 @write_by_half_octet(i32* %24, i32 %23)
br label %26
26: ; preds = %22, %15
ret i32 0
}