#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 CHAR_BIT;
int INT_MAX;
int SHRT_MIN;
int /*<<< orphan*/ printf(char *, char, ...);
int main() {
  int x_hex = 0x12;
  printf("%d\n", x_hex);
  printf("%d\n", (short)x_hex);
  printf("%d\n", (char)x_hex);
  printf("%d\n", (char)257);
  printf("CHAR_BIT\t= %d\n"
         "SHRT_MIN\t= %d\n"
         "INT_MAX\t= %d\n",
         CHAR_BIT, SHRT_MIN, INT_MAX);
  printf("%f\n", (float)100);
  printf("%lf\n", (double)100);
  printf("%d\n", (char)100.0);
  signed char x = 0xEB;
  if (x == 0xEB) {
    x = 0;
  }
  printf("x = %d \n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x12,-0x8(%rbp)
mov    -0x8(%rbp),%eax
lea    0xef6(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
lea    0xee2(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
lea    0xece(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
mov    0x2e4b(%rip),%rcx
mov    (%rcx),%edx
mov    0x2e5a(%rip),%rcx
mov    (%rcx),%ecx
lea    0xe69(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0xeb,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xeb,%eax
jne    11f1 <main+0xe1>
movb   $0x0,-0x9(%rbp)
lea    0xe3b(%rip),%rdi
movsbl -0x9(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf0e(%rip),%rbx
mov    %rbx,%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e7d(%rip),%rax
movsbl (%rax),%esi
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
mov    0x2e7a(%rip),%rax
mov    (%rax),%ecx
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
mov    $0xffffffeb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [42 x i8] c"CHAR_BIT\09= %d\0ASHRT_MIN\09= %d\0AINT_MAX\09= %d\0A\00"
@CHAR_BIT = global i32 0
@SHRT_MIN = global i32 0
@INT_MAX = global i32 0
@.str.2 = [4 x i8] c"%f\0A\00"
@.str.3 = [5 x i8] c"%lf\0A\00"
@.str.4 = [9 x i8] c"x = %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 18, i32* %2
%4 = load i32, i32* %2
%5 = trunc i32 %4 to i8
%6 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
%7 = load i32, i32* %2
%8 = trunc i32 %7 to i16
%9 = trunc i16 %8 to i8
%10 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %9)
%11 = load i32, i32* %2
%12 = trunc i32 %11 to i8
%13 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %12)
%14 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 1)
%15 = load i32, i32* @CHAR_BIT
%16 = trunc i32 %15 to i8
%17 = load i32, i32* @SHRT_MIN
%18 = load i32, i32* @INT_MAX
%19 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8 signext %16, i32 %17, i32 %18)
%20 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 100)
%21 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 signext 100)
%22 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 100)
store i8 -21, i8* %3
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 235
br i1 %25, label %26, label %27
26: ; preds = %0
store i8 0, i8* %3
br label %27
27: ; preds = %26, %0
%28 = load i8, i8* %3
%29 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8 signext %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [42 x i8] c"CHAR_BIT\09= %d\0ASHRT_MIN\09= %d\0AINT_MAX\09= %d\0A\00"
@CHAR_BIT = global i32 0
@SHRT_MIN = global i32 0
@INT_MAX = global i32 0
@.str.2 = [4 x i8] c"%f\0A\00"
@.str.3 = [5 x i8] c"%lf\0A\00"
@.str.4 = [9 x i8] c"x = %d \0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 18)
%2 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 18)
%3 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 18)
%4 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 1)
%5 = load i32, i32* @CHAR_BIT
%6 = trunc i32 %5 to i8
%7 = load i32, i32* @SHRT_MIN
%8 = load i32, i32* @INT_MAX
%9 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8 signext %6, i32 %7, i32 %8)
%10 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 100)
%11 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 signext 100)
%12 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 100)
%13 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8 signext -21)
ret i32 0
}