#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 *, unsigned char, unsigned char);
void test_unsigned_and_signed(void) {
  signed char c7_1 = 0x00ff;
  unsigned char c7_2 = 0x00ff;
  printf("signed   %08x, %d\n", c7_1, c7_1);
  printf("unsigned %08x, %d\n", c7_2, c7_2);
  signed char cc1 = 0x80;
  unsigned char cc2 = 0x80;
  printf("signed   %08x, %d\n", cc1, cc1);
  printf("unsigned %08x, %d\n", cc2, cc2);
  signed char cc3 = 0x7f;
  unsigned char cc4 = 0x7f;
  printf("signed   %08x, %d\n", cc3, cc3);
  printf("unsigned %08x, %d\n", cc4, cc4);
}


x86 assembly (clang, -O0):
<test_unsigned_and_signed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0xff,-0x1(%rbp)
movb   $0xff,-0x2(%rbp)
mov    -0x1(%rbp),%al
lea    0xed6(%rip),%rdi
movzbl %al,%esi
movzbl -0x1(%rbp),%edx
call   1030 <printf@plt>
mov    -0x2(%rbp),%al
lea    0xed3(%rip),%rdi
movzbl %al,%esi
movzbl -0x2(%rbp),%edx
call   1030 <printf@plt>
movb   $0x80,-0x3(%rbp)
movb   $0x80,-0x4(%rbp)
mov    -0x3(%rbp),%al
lea    0xea2(%rip),%rdi
movzbl %al,%esi
movzbl -0x3(%rbp),%edx
call   1030 <printf@plt>
mov    -0x4(%rbp),%al
lea    0xe9f(%rip),%rdi
movzbl %al,%esi
movzbl -0x4(%rbp),%edx
call   1030 <printf@plt>
movb   $0x7f,-0x5(%rbp)
movb   $0x7f,-0x6(%rbp)
mov    -0x5(%rbp),%al
lea    0xe6e(%rip),%rdi
movzbl %al,%esi
movzbl -0x5(%rbp),%edx
call   1030 <printf@plt>
mov    -0x6(%rbp),%al
lea    0xe6b(%rip),%rdi
movzbl %al,%esi
movzbl -0x6(%rbp),%edx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unsigned_and_signed>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %r14,%rdi
mov    $0xff,%esi
mov    $0xff,%edx
call   1030 <printf@plt>
lea    0xedf(%rip),%rbx
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0xff,%edx
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x80,%esi
mov    $0x80,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x80,%esi
mov    $0x80,%edx
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x7f,%esi
mov    $0x7f,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7f,%esi
mov    $0x7f,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"signed %08x, %d\0A\00"
@.str.1 = [19 x i8] c"unsigned %08x, %d\0A\00"
define void @test_unsigned_and_signed() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 -1, i8* %1
store i8 -1, i8* %2
%7 = load i8, i8* %1
%8 = load i8, i8* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 zeroext %7, i8 zeroext %8)
%10 = load i8, i8* %2
%11 = load i8, i8* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %10, i8 zeroext %11)
store i8 -128, i8* %3
store i8 -128, i8* %4
%13 = load i8, i8* %3
%14 = load i8, i8* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 zeroext %13, i8 zeroext %14)
%16 = load i8, i8* %4
%17 = load i8, i8* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %16, i8 zeroext %17)
store i8 127, i8* %5
store i8 127, i8* %6
%19 = load i8, i8* %5
%20 = load i8, i8* %5
%21 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 zeroext %19, i8 zeroext %20)
%22 = load i8, i8* %6
%23 = load i8, i8* %6
%24 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %22, i8 zeroext %23)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"signed %08x, %d\0A\00"
@.str.1 = [19 x i8] c"unsigned %08x, %d\0A\00"
define void @test_unsigned_and_signed() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 zeroext -1, i8 zeroext -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8 zeroext -1, i8 zeroext -1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 zeroext -128, i8 zeroext -128)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8 zeroext -128, i8 zeroext -128)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 zeroext 127, i8 zeroext 127)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 127, i8 zeroext 127)
ret void
}