#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 *, ...);
void char_short_test() {
  int var1, var2;
  printf("char_short:\n");
  var1 = 0x01020304;
  var2 = 0xfffefdfc;
  printf("s8=%d %d\n", *(char *)&var1, *(char *)&var2);
  printf("u8=%d %d\n", *(unsigned char *)&var1, *(unsigned char *)&var2);
  printf("s16=%d %d\n", *(short *)&var1, *(short *)&var2);
  printf("u16=%d %d\n", *(unsigned short *)&var1, *(unsigned short *)&var2);
  printf("s32=%d %d\n", *(int *)&var1, *(int *)&var2);
  printf("u32=%d %d\n", *(unsigned int *)&var1, *(unsigned int *)&var2);
  *(char *)&var1 = 0x08;
  printf("var1=%x\n", var1);
  *(short *)&var1 = 0x0809;
  printf("var1=%x\n", var1);
  *(int *)&var1 = 0x08090a0b;
  printf("var1=%x\n", var1);
}


x86 assembly (clang, -O0):
<char_short_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1020304,-0x4(%rbp)
movl   $0xfffefdfc,-0x8(%rbp)
movsbl -0x4(%rbp),%esi
movsbl -0x8(%rbp),%edx
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x4(%rbp),%esi
movzbl -0x8(%rbp),%edx
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x4(%rbp),%esi
movswl -0x8(%rbp),%edx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzwl -0x4(%rbp),%esi
movzwl -0x8(%rbp),%edx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movw   $0x809,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x8090a0b,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_short_test>:
push   %rbx
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0x4,%esi
mov    $0xfffffffc,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x4,%esi
mov    $0xfc,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x304,%esi
mov    $0xfffffdfc,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x304,%esi
mov    $0xfdfc,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x1020304,%esi
mov    $0xfffefdfc,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
mov    $0x1020304,%esi
mov    $0xfffefdfc,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7c(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1020308,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1020809,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8090a0b,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"char_short:\0A\00"
@.str.1 = [10 x i8] c"s8=%d %d\0A\00"
@.str.2 = [10 x i8] c"u8=%d %d\0A\00"
@.str.3 = [11 x i8] c"s16=%d %d\0A\00"
@.str.4 = [11 x i8] c"u16=%d %d\0A\00"
@.str.5 = [11 x i8] c"s32=%d %d\0A\00"
@.str.6 = [11 x i8] c"u32=%d %d\0A\00"
@.str.7 = [9 x i8] c"var1=%x\0A\00"
define void @char_short_test() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 16909060, i32* %1
store i32 -66052, i32* %2
%4 = bitcast i32* %1 to i8*
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = bitcast i32* %2 to i8*
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %9)
%11 = bitcast i32* %1 to i8*
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = bitcast i32* %2 to i8*
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %16)
%18 = bitcast i32* %1 to i16*
%19 = load i16, i16* %18
%20 = sext i16 %19 to i32
%21 = bitcast i32* %2 to i16*
%22 = load i16, i16* %21
%23 = sext i16 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %20, i32 %23)
%25 = bitcast i32* %1 to i16*
%26 = load i16, i16* %25
%27 = zext i16 %26 to i32
%28 = bitcast i32* %2 to i16*
%29 = load i16, i16* %28
%30 = zext i16 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %27, i32 %30)
%32 = load i32, i32* %1
%33 = load i32, i32* %2
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %32, i32 %33)
%35 = load i32, i32* %1
%36 = load i32, i32* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %35, i32 %36)
%38 = bitcast i32* %1 to i8*
store i8 8, i8* %38
%39 = load i32, i32* %1
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %39)
%41 = bitcast i32* %1 to i16*
store i16 2057, i16* %41
%42 = load i32, i32* %1
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %42)
store i32 134810123, i32* %1
%44 = load i32, i32* %1
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %44)
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"s8=%d %d\0A\00"
@.str.2 = [10 x i8] c"u8=%d %d\0A\00"
@.str.3 = [11 x i8] c"s16=%d %d\0A\00"
@.str.4 = [11 x i8] c"u16=%d %d\0A\00"
@.str.5 = [11 x i8] c"s32=%d %d\0A\00"
@.str.6 = [11 x i8] c"u32=%d %d\0A\00"
@.str.7 = [9 x i8] c"var1=%x\0A\00"
@str = [12 x i8] c"char_short:\00"
define void @char_short_test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 -4)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 252)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 772, i32 -516)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 772, i32 65020)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 16909060, i32 -66052)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 16909060, i32 -66052)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 16909064)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 16910345)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 134810123)
ret void
}