#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(int argc, char *argv[]) {
  unsigned char c;
  int s;
  if (argc < 0 && argv == NULL)
    return 0;
  c = (unsigned char)(1 << (8 * sizeof(char) - 1));
  s = 8 * (int)(sizeof(int) - sizeof(char));
  printf("Integral promotion: ");
  if ((c << s) > 0) {
    printf("Classic C (unsigned-preserving)\n");
    printf("%d %d %uu\n", c, s, c << s);
    return 1;
  } else {
    printf("ANSI C (value-preserving)\n");
    printf("%d %d %d\n", c, s, c << s);
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1147 <main+0x37>
cmpq   $0x0,-0x10(%rbp)
jne    1147 <main+0x37>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <main+0xd1>
movb   $0x80,-0x11(%rbp)
movl   $0x18,-0x18(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x11(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
cmp    $0x0,%eax
jle    11ac <main+0x9c>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x11(%rbp),%esi
mov    -0x18(%rbp),%edx
movzbl -0x11(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <main+0xd1>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x11(%rbp),%esi
mov    -0x18(%rbp),%edx
movzbl -0x11(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
test   %edi,%edi
jns    112c <main+0xc>
test   %rsi,%rsi
jne    112c <main+0xc>
xor    %eax,%eax
ret
push   %rax
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
mov    $0x80,%esi
mov    $0x18,%edx
mov    $0x80000000,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Integral promotion: \00"
@.str.1 = [33 x i8] c"Classic C (unsigned-preserving)\0A\00"
@.str.2 = [11 x i8] c"%d %d %uu\0A\00"
@.str.3 = [27 x i8] c"ANSI C (value-preserving)\0A\00"
@.str.4 = [10 x i8] c"%d %d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = icmp eq i8** %11, null
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 0, i32* %3
br label %41
14: ; preds = %10, %2
store i8 -128, i8* %6
store i32 24, i32* %7
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i32, i32* %7
%19 = shl i32 %17, %18
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %31
21: ; preds = %14
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%23 = load i8, i8* %6
%24 = zext i8 %23 to i32
%25 = load i32, i32* %7
%26 = load i8, i8* %6
%27 = zext i8 %26 to i32
%28 = load i32, i32* %7
%29 = shl i32 %27, %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %25, i32 %29)
store i32 1, i32* %3
br label %41
31: ; preds = %14
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%33 = load i8, i8* %6
%34 = zext i8 %33 to i32
%35 = load i32, i32* %7
%36 = load i8, i8* %6
%37 = zext i8 %36 to i32
%38 = load i32, i32* %7
%39 = shl i32 %37, %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %34, i32 %35, i32 %39)
store i32 0, i32* %3
br label %41
41: ; preds = %31, %21, %13
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [21 x i8] c"Integral promotion: \00"
@.str.4 = [10 x i8] c"%d %d %d\0A\00"
@str = [26 x i8] c"ANSI C (value-preserving)\00"
define i32 @main(i32 %0, i8** readnone %1) {
%3 = icmp slt i32 %0, 0
%4 = icmp eq i8** %1, null
%5 = and i1 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 128, i32 24, i32 -2147483648)
br label %10
10: ; preds = %2, %6
ret i32 0
}