#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(int argc, char const *argv[]) {
  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    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x150,-0x12(%rbp)
movw   $0xfeb0,-0x14(%rbp)
movswl -0x12(%rbp),%esi
movswl -0x12(%rbp),%edx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x14(%rbp),%esi
movswl -0x14(%rbp),%edx
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x12(%rbp),%esi
movswl -0x12(%rbp),%edx
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x10052,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x150,%esi
mov    $0x150,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
mov    $0xfffffeb0,%esi
mov    $0xfffffeb0,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
mov    $0x150,%esi
mov    $0x150,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0f(%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 = [41 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 = [27 x i8] c"num as int and char:%d %c\0A\00"
@.str.3 = [39 x i8] c"WORDS as int,short and char:%d %hd %c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16
%7 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i16 336, i16* %6
store i16 -336, i16* %7
%8 = load i16, i16* %6
%9 = sext i16 %8 to i32
%10 = load i16, i16* %6
%11 = sext i16 %10 to i32
%12 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = load i16, i16* %7
%14 = sext i16 %13 to i32
%15 = load i16, i16* %7
%16 = sext i16 %15 to i32
%17 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16)
%18 = load i16, i16* %6
%19 = sext i16 %18 to i32
%20 = load i16, i16* %6
%21 = sext i16 %20 to i32
%22 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %21)
%23 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 65618, i32 65618, i32 65618)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 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 = [27 x i8] c"num as int and char:%d %c\0A\00"
@.str.3 = [39 x i8] c"WORDS as int,short and char:%d %hd %c\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 336, i32 336)
%4 = 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)
%5 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 336, i32 336)
%6 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 65618, i32 65618, i32 65618)
ret i32 0
}