#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() {
  char a_char = 0;
  unsigned char a_char_u = 0;
  unsigned char res1 = a_char_u - 1;
  char *s = "Hello,"
            "world";
  short a_short = 0;
  unsigned short a_short_u = 0;
  unsigned int a_int_u = 0;
  int a_int = 0;
  unsigned long a_long_u = 0;
  long a_long = 0;
  char bell = '\x7';
  printf("%c\n", bell);
  printf("%s\n", s);
  printf("unsigned char is between: %u and %u\n", a_char_u,
         (unsigned char)(a_char_u - 1));
  printf("char is between: %d and %d\n", ~(char)((unsigned char)~0 >> 1),
         (char)((unsigned char)~0 >> 1));
  printf("unsigned int is between: %u and %u\n", a_int_u, a_int_u - 1);
  printf("int is between: %d and %d\n", ~(int)((unsigned int)~0 >> 1),
         (int)((unsigned int)~0 >> 1));
  printf("unsigned long is between: %lu and %lu\n", a_long_u,
         (unsigned long)(a_long_u - 1));
  printf("long is between: %ld and %ld\n", ~(long)((unsigned long)~0 >> 1),
         (long)((unsigned long)~0 >> 1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movb   $0x0,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x3(%rbp)
lea    0xecf(%rip),%rax
mov    %rax,-0x10(%rbp)
movw   $0x0,-0x12(%rbp)
movw   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movb   $0x7,-0x31(%rbp)
movsbl -0x31(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x2(%rbp),%esi
movzbl -0x2(%rbp),%eax
sub    $0x1,%eax
movzbl %al,%edx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    $0xffffff80,%esi
mov    $0x7f,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x80000000,%esi
mov    $0x7fffffff,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
mov    -0x28(%rbp),%rdx
sub    $0x1,%rdx
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
movabs $0x8000000000000000,%rsi
movabs $0x7fffffffffffffff,%rdx
ff ff 7f
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee4(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
xor    %esi,%esi
mov    $0xff,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0xffffff80,%esi
mov    $0x7f,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x80000000,%esi
mov    $0x7fffffff,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
xor    %esi,%esi
mov    $0xffffffffffffffff,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movabs $0x7fffffffffffffff,%rdx
ff ff 7f
lea    0x1(%rdx),%rsi
lea    0xef1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello,world\00"
@.str.1 = [4 x i8] c"%c\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [37 x i8] c"unsigned char is between: %u and %u\0A\00"
@.str.4 = [28 x i8] c"char is between: %d and %d\0A\00"
@.str.5 = [36 x i8] c"unsigned int is between: %u and %u\0A\00"
@.str.6 = [27 x i8] c"int is between: %d and %d\0A\00"
@.str.7 = [39 x i8] c"unsigned long is between: %lu and %lu\0A\00"
@.str.8 = [30 x i8] c"long is between: %ld and %ld\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8
store i8 0, i8* %1
store i8 0, i8* %2
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = sub nsw i32 %13, 1
%15 = trunc i32 %14 to i8
store i8 %15, i8* %3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %4
store i16 0, i16* %5
store i16 0, i16* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i64 0, i64* %9
store i64 0, i64* %10
store i8 7, i8* %11
%16 = load i8, i8* %11
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = load i8, i8* %2
%22 = zext i8 %21 to i32
%23 = load i8, i8* %2
%24 = zext i8 %23 to i32
%25 = sub nsw i32 %24, 1
%26 = trunc i32 %25 to i8
%27 = zext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 -128, i32 127)
%30 = load i32, i32* %7
%31 = load i32, i32* %7
%32 = sub i32 %31, 1
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %30, i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 -2147483648, i32 2147483647)
%35 = load i64, i64* %9
%36 = load i64, i64* %9
%37 = sub i64 %36, 1
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), i64 %35, i64 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i64 -9223372036854775808, i64 9223372036854775807)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello,world\00"
@.str.1 = [4 x i8] c"%c\0A\00"
@.str.3 = [37 x i8] c"unsigned char is between: %u and %u\0A\00"
@.str.4 = [28 x i8] c"char is between: %d and %d\0A\00"
@.str.5 = [36 x i8] c"unsigned int is between: %u and %u\0A\00"
@.str.6 = [27 x i8] c"int is between: %d and %d\0A\00"
@.str.7 = [39 x i8] c"unsigned long is between: %lu and %lu\0A\00"
@.str.8 = [30 x i8] c"long is between: %ld and %ld\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 7)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 255)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 -128, i32 127)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 0, i32 -1)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 -2147483648, i32 2147483647)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), i64 0, i64 -1)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i64 -9223372036854775808, i64 9223372036854775807)
ret i32 0
}