#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 */
double getDC();
double getDI();
double getDS();
int /*<<< orphan*/ printf(char *, unsigned char, unsigned short, unsigned int);
int main(int argc, char **argv) {
  double DC = getDC();
  double DS = getDS();
  double DI = getDI();
  unsigned char uc = (unsigned char)DC;
  unsigned short us = (unsigned short)DS;
  unsigned int ui = (unsigned int)DI;
  printf("DC = %lf, DS = %lf, DI = %lf\n", DC, DS, DI);
  printf("uc = %u, us = %u, ui = %u\n", uc, us, ui);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %al,-0x31(%rbp)
call   1040 <getDC@plt>
mov    -0x31(%rbp),%al
movsd  %xmm0,-0x18(%rbp)
call   1050 <getDS@plt>
mov    -0x31(%rbp),%al
movsd  %xmm0,-0x20(%rbp)
call   1060 <getDI@plt>
movsd  %xmm0,-0x28(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %al,-0x29(%rbp)
cvttsd2si -0x20(%rbp),%eax
mov    %ax,-0x2c(%rbp)
cvttsd2si -0x28(%rbp),%rax
mov    %eax,-0x30(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %al,%dl
cvttsd2si -0x20(%rbp),%eax
cvttsd2si -0x28(%rbp),%rcx
lea    0xe4e(%rip),%rdi
movzbl %dl,%esi
movzwl %ax,%edx
call   1030 <printf@plt>
mov    -0x29(%rbp),%dl
mov    -0x2c(%rbp),%ax
mov    -0x30(%rbp),%ecx
lea    0xe50(%rip),%rdi
movzbl %dl,%esi
movzwl %ax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <getDC@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1050 <getDS@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <getDI@plt>
cvttsd2si 0x8(%rsp),%eax
cvttsd2si (%rsp),%ecx
cvttsd2si %xmm0,%r14
movzbl %al,%ebp
movzwl %cx,%ebx
lea    0xe7b(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"DC = %lf, DS = %lf, DI = %lf\0A\00"
@.str.1 = [27 x i8] c"uc = %u, us = %u, ui = %u\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i8
%10 = alloca i16
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call double (...) @getDC()
store double %12, double* %6
%13 = call double (...) @getDS()
store double %13, double* %7
%14 = call double (...) @getDI()
store double %14, double* %8
%15 = load double, double* %6
%16 = fptoui double %15 to i8
store i8 %16, i8* %9
%17 = load double, double* %7
%18 = fptoui double %17 to i16
store i16 %18, i16* %10
%19 = load double, double* %8
%20 = fptoui double %19 to i32
store i32 %20, i32* %11
%21 = load double, double* %6
%22 = fptoui double %21 to i8
%23 = load double, double* %7
%24 = fptoui double %23 to i16
%25 = load double, double* %8
%26 = fptoui double %25 to i32
%27 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 zeroext %22, i16 zeroext %24, i32 %26)
%28 = load i8, i8* %9
%29 = load i16, i16* %10
%30 = load i32, i32* %11
%31 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %28, i16 zeroext %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"DC = %lf, DS = %lf, DI = %lf\0A\00"
@.str.1 = [27 x i8] c"uc = %u, us = %u, ui = %u\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double (...) @getDC()
%4 = tail call double (...) @getDS()
%5 = tail call double (...) @getDI()
%6 = fptoui double %3 to i8
%7 = fptoui double %4 to i16
%8 = fptoui double %5 to i32
%9 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 zeroext %6, i16 zeroext %7, i32 %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %6, i16 zeroext %7, i32 %8)
ret i32 0
}