#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 uint8_t;
typedef int uint16_t;
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  uint16_t value = 0xFFFF;
  printf("Original Value: %u\n", value);
  printf("Unsigned 16->Signed 16: %hd\n", (int16_t)value);
  printf("Unsinged 16->Unsigned 32: %u\n", (unsigned int)value);
  printf("Unsigned 16->Unsigned 8: %hu\n", (uint8_t)value);
  printf("Unsigned 16->Signed 32: %d\n", (int)value);
  int16_t svalue = -1;
  printf("Original Value: %d\n", svalue);
  printf("Signed 16->Unsinged 16: %u\n", (uint16_t)svalue);
  printf("Signed 16->Signed 32: %d\n", svalue);
  printf("Signed 16->Signed 8: %d\n", (uint8_t)svalue);
  printf("Signed 16->Unsigned 32: %u\n", (unsigned int)svalue);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffff,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xf08(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xf0e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf13(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf20(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf2b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf35(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xffff,%esi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0xffff,%esi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0xffff,%esi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0xffff,%esi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
mov    $0xffff,%esi
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xf1f(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xf2a(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xf3b(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Original Value: %u\0A\00"
@.str.1 = [29 x i8] c"Unsigned 16->Signed 16: %hd\0A\00"
@.str.2 = [30 x i8] c"Unsinged 16->Unsigned 32: %u\0A\00"
@.str.3 = [30 x i8] c"Unsigned 16->Unsigned 8: %hu\0A\00"
@.str.4 = [28 x i8] c"Unsigned 16->Signed 32: %d\0A\00"
@.str.5 = [20 x i8] c"Original Value: %d\0A\00"
@.str.6 = [28 x i8] c"Signed 16->Unsinged 16: %u\0A\00"
@.str.7 = [26 x i8] c"Signed 16->Signed 32: %d\0A\00"
@.str.8 = [25 x i8] c"Signed 16->Signed 8: %d\0A\00"
@.str.9 = [28 x i8] c"Signed 16->Unsigned 32: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 65535, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 %11)
store i32 -1, i32* %2
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %2
%20 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Original Value: %u\0A\00"
@.str.1 = [29 x i8] c"Unsigned 16->Signed 16: %hd\0A\00"
@.str.2 = [30 x i8] c"Unsinged 16->Unsigned 32: %u\0A\00"
@.str.3 = [30 x i8] c"Unsigned 16->Unsigned 8: %hu\0A\00"
@.str.4 = [28 x i8] c"Unsigned 16->Signed 32: %d\0A\00"
@.str.5 = [20 x i8] c"Original Value: %d\0A\00"
@.str.6 = [28 x i8] c"Signed 16->Unsinged 16: %u\0A\00"
@.str.7 = [26 x i8] c"Signed 16->Signed 32: %d\0A\00"
@.str.8 = [25 x i8] c"Signed 16->Signed 8: %d\0A\00"
@.str.9 = [28 x i8] c"Signed 16->Unsigned 32: %u\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 65535)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 65535)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 65535)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 65535)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 65535)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 -1)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 -1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 -1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 -1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 -1)
ret i32 0
}