#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*/ printf(char *, int, int, ...);
int main(void) {
  short num = 336;
  short mnum = -336;
  printf("num as short and unsigned short: %hd %hu\n", num, num);
  printf("-num as short and unsigned short: %hd %hu\n", mnum, mnum);
  printf("num as int and char: %d %c\n", num, num);
  printf("WORDS as int, short, and char: %d %hd %c\n", 65618, 65618, 65618);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x150,-0x6(%rbp)
movw   $0xfeb0,-0x8(%rbp)
movswl -0x6(%rbp),%esi
movswl -0x6(%rbp),%edx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x8(%rbp),%esi
movswl -0x8(%rbp),%edx
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x6(%rbp),%esi
movswl -0x6(%rbp),%edx
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x10052,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee9(%rip),%rdi
mov    $0x150,%esi
mov    $0x150,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0xfffffeb0,%esi
mov    $0xfffffeb0,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x150,%esi
mov    $0x150,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x10052,%esi
mov    $0x10052,%edx
mov    $0x10052,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"num as short and unsigned short: %hd %hu\0A\00"
@.str.1 = [43 x i8] c"-num as short and unsigned short: %hd %hu\0A\00"
@.str.2 = [28 x i8] c"num as int and char: %d %c\0A\00"
@.str.3 = [42 x i8] c"WORDS as int, short, and char: %d %hd %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
store i32 0, i32* %1
store i16 336, i16* %2
store i16 -336, i16* %3
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = load i16, i16* %2
%7 = sext i16 %6 to i32
%8 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i16, i16* %3
%10 = sext i16 %9 to i32
%11 = load i16, i16* %3
%12 = sext i16 %11 to i32
%13 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12)
%14 = load i16, i16* %2
%15 = sext i16 %14 to i32
%16 = load i16, i16* %2
%17 = sext i16 %16 to i32
%18 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %17)
%19 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 65618, i32 65618, i32 65618)
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"num as short and unsigned short: %hd %hu\0A\00"
@.str.1 = [43 x i8] c"-num as short and unsigned short: %hd %hu\0A\00"
@.str.2 = [28 x i8] c"num as int and char: %d %c\0A\00"
@.str.3 = [42 x i8] c"WORDS as int, short, and char: %d %hd %c\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 336, i32 336)
%2 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 -336, i32 -336)
%3 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 336, i32 336)
%4 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 65618, i32 65618, i32 65618)
ret i32 0
}