#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int, int, short, short);
int main(void) {
  int val1 = 53191;
  short val2 = (short)val1;
  unsigned val3 = 65535;
  unsigned short val4 = (unsigned short)val3;
  int val5 = -212748364;
  short val6 = (short)val5;
  int val7 = 212748364;
  short val8 = (short)val7;
  printf("from %#12x %11d\n  to %#12x %11d\n", val1, val1, val2, val2);
  printf("from %#12x %11d\n  to %#12x %11d\n", val3, val3, val4, val4);
  printf("from %#12x %11d\n  to %#12x %11d\n", val5, val5, val6, val6);
  printf("from %#12x %11d\n  to %#12x %11d\n", val7, val7, val8, val8);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xcfc7,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %ax,-0xa(%rbp)
movl   $0xffff,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %ax,-0x12(%rbp)
movl   $0xf351b7b4,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %ax,-0x1a(%rbp)
movl   $0xcae484c,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %ax,-0x22(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xa(%rbp),%ax
lea    0xe98(%rip),%rdi
movswl %ax,%ecx
movswl -0xa(%rbp),%r8d
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x12(%rbp),%ax
lea    0xe7a(%rip),%rdi
movswl %ax,%ecx
movswl -0x12(%rbp),%r8d
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1a(%rbp),%ax
lea    0xe5c(%rip),%rdi
movswl %ax,%ecx
movswl -0x1a(%rbp),%r8d
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x22(%rbp),%ax
lea    0xe3e(%rip),%rdi
movswl %ax,%ecx
movswl -0x22(%rbp),%r8d
call   1030 <printf@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xcfc7,%esi
mov    $0xcfc7,%edx
mov    $0xffffcfc7,%ecx
mov    $0xffffcfc7,%r8d
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xffff,%esi
mov    $0xffff,%edx
mov    $0xffffffff,%ecx
mov    $0xffffffff,%r8d
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xf351b7b4,%esi
mov    $0xf351b7b4,%edx
mov    $0xffffb7b4,%ecx
mov    $0xffffb7b4,%r8d
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xcae484c,%esi
mov    $0xcae484c,%edx
mov    $0x484c,%ecx
mov    $0x484c,%r8d
call   1030 <printf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"from %x %11d\0A to %x %11d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i16
%4 = alloca i32
%5 = alloca i16
%6 = alloca i32
%7 = alloca i16
%8 = alloca i32
%9 = alloca i16
store i32 0, i32* %1
store i32 53191, i32* %2
%10 = load i32, i32* %2
%11 = trunc i32 %10 to i16
store i16 %11, i16* %3
store i32 65535, i32* %4
%12 = load i32, i32* %4
%13 = trunc i32 %12 to i16
store i16 %13, i16* %5
store i32 -212748364, i32* %6
%14 = load i32, i32* %6
%15 = trunc i32 %14 to i16
store i16 %15, i16* %7
store i32 212748364, i32* %8
%16 = load i32, i32* %8
%17 = trunc i32 %16 to i16
store i16 %17, i16* %9
%18 = load i32, i32* %2
%19 = load i32, i32* %2
%20 = load i16, i16* %3
%21 = load i16, i16* %3
%22 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19, i16 signext %20, i16 signext %21)
%23 = load i32, i32* %4
%24 = load i32, i32* %4
%25 = load i16, i16* %5
%26 = load i16, i16* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %24, i16 signext %25, i16 signext %26)
%28 = load i32, i32* %6
%29 = load i32, i32* %6
%30 = load i16, i16* %7
%31 = load i16, i16* %7
%32 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %29, i16 signext %30, i16 signext %31)
%33 = load i32, i32* %8
%34 = load i32, i32* %8
%35 = load i16, i16* %9
%36 = load i16, i16* %9
%37 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %34, i16 signext %35, i16 signext %36)
%38 = load i32, i32* @EXIT_SUCCESS
ret i32 %38
}

LLVM IR (-O2):
@.str = [33 x i8] c"from %x %11d\0A to %x %11d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 53191, i32 53191, i16 signext -12345, i16 signext -12345)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 65535, i32 65535, i16 signext -1, i16 signext -1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 -212748364, i32 -212748364, i16 signext -18508, i16 signext -18508)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 212748364, i32 212748364, i16 signext 18508, i16 signext 18508)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}