#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 main(void) {
  printf("short type is %hd bytes\n", sizeof(short));
  printf("unsigned short type is %hd bytes\n", sizeof(unsigned short));
  printf("int type is %hd bytes\n", sizeof(int));
  printf("unsigned int type is %hd bytes\n", sizeof(int));
  printf("long type is %hd bytes\n", sizeof(long));
  printf("unsigned long type is %hd bytes\n", sizeof(unsigned long));
  printf("long long type is %hd bytes\n", sizeof(long long));
  printf("unsigned long long type is %hd bytes\n", sizeof(unsigned long long));
  short sShort = 32767;
  unsigned short uShort = 65535;
  int sInt = 2147483647;
  unsigned int uInt = 4294967295;
  long long sLongLong = 9223372036854775807LL;
  unsigned long long uLongLong = 18446744073709551615ULL;
  printf("\n");
  printf("Right usage:\n");
  printf("%hd %hu\n", sShort, uShort);
  printf("%d %u\n", sInt, uInt);
  printf("%lld %llu\n", sLongLong, uLongLong);
  printf("\n");
  printf("Wrong usage:\n");
  printf("%hd %hu\n", sInt, uInt);
  printf("%ld %lu\n", sLongLong, uLongLong);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee3(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movw   $0x7fff,-0x6(%rbp)
movw   $0xffff,-0x8(%rbp)
movl   $0x7fffffff,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
movabs $0x7fffffffffffffff,%rax
ff ff 7f
mov    %rax,-0x18(%rbp)
movq   $0xffffffffffffffff,-0x20(%rbp)
ff
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x6(%rbp),%esi
movzwl -0x8(%rbp),%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea8(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xed0(%rip),%rdi
call   1040 <puts@plt>
lea    0xea0(%rip),%r14
mov    %r14,%rdi
mov    $0x7fff,%esi
mov    $0xffff,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x7fffffff,%esi
mov    $0xffffffff,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7d(%rip),%rdi
movabs $0x7fffffffffffffff,%rbx
ff ff 7f
mov    %rbx,%rsi
mov    $0xffffffffffffffff,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe72(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    $0x7fffffff,%esi
mov    $0xffffffff,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe3c(%rip),%rdi
mov    %rbx,%rsi
mov    $0xffffffffffffffff,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"short type is %hd bytes\0A\00"
@.str.1 = [34 x i8] c"unsigned short type is %hd bytes\0A\00"
@.str.2 = [23 x i8] c"int type is %hd bytes\0A\00"
@.str.3 = [32 x i8] c"unsigned int type is %hd bytes\0A\00"
@.str.4 = [24 x i8] c"long type is %hd bytes\0A\00"
@.str.5 = [33 x i8] c"unsigned long type is %hd bytes\0A\00"
@.str.6 = [29 x i8] c"long long type is %hd bytes\0A\00"
@.str.7 = [38 x i8] c"unsigned long long type is %hd bytes\0A\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [14 x i8] c"Right usage:\0A\00"
@.str.10 = [9 x i8] c"%hd %hu\0A\00"
@.str.11 = [7 x i8] c"%d %u\0A\00"
@.str.12 = [11 x i8] c"%lld %llu\0A\00"
@.str.13 = [14 x i8] c"Wrong usage:\0A\00"
@.str.14 = [9 x i8] c"%ld %lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i64 2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i64 4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i64 4)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 8)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i64 8)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i64 8)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i64 8)
store i16 32767, i16* %2
store i16 -1, i16* %3
store i32 2147483647, i32* %4
store i32 -1, i32* %5
store i64 9223372036854775807, i64* %6
store i64 -1, i64* %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%18 = load i16, i16* %2
%19 = sext i16 %18 to i32
%20 = load i16, i16* %3
%21 = zext i16 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %19, i32 %21)
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i64, i64* %6
%27 = load i64, i64* %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i64 %26, i64 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %31, i32 %32)
%34 = load i64, i64* %6
%35 = load i64, i64* %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i64 %34, i64 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"short type is %hd bytes\0A\00"
@.str.1 = [34 x i8] c"unsigned short type is %hd bytes\0A\00"
@.str.2 = [23 x i8] c"int type is %hd bytes\0A\00"
@.str.3 = [32 x i8] c"unsigned int type is %hd bytes\0A\00"
@.str.4 = [24 x i8] c"long type is %hd bytes\0A\00"
@.str.5 = [33 x i8] c"unsigned long type is %hd bytes\0A\00"
@.str.6 = [29 x i8] c"long long type is %hd bytes\0A\00"
@.str.7 = [38 x i8] c"unsigned long long type is %hd bytes\0A\00"
@.str.10 = [9 x i8] c"%hd %hu\0A\00"
@.str.11 = [7 x i8] c"%d %u\0A\00"
@.str.12 = [11 x i8] c"%lld %llu\0A\00"
@.str.14 = [9 x i8] c"%ld %lu\0A\00"
@str = [13 x i8] c"Right usage:\00"
@str.15 = [13 x i8] c"Wrong usage:\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 2)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i64 2)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i64 4)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i64 4)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 8)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i64 8)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i64 8)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i64 8)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 32767, i32 65535)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 2147483647, i32 -1)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i64 9223372036854775807, i64 -1)
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.15, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 2147483647, i32 -1)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i64 9223372036854775807, i64 -1)
ret i32 0
}