#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: ");
  {
    const int u = (c << s) > 0;
    if (u) {
      printf("Classic C (unsigned-preserving)\n");
      printf("%d %d %uU\n", c, s, (unsigned)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    11f0 <main+0xe0>
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
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11bb <main+0xab>
lea    0xe8d(%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    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <main+0xe0>
lea    0xe7f(%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    0xe7a(%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
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = icmp eq i8** %12, null
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 0, i32* %3
br label %45
15: ; preds = %11, %2
store i8 -128, i8* %6
store i32 24, i32* %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = load i32, i32* %7
%20 = shl i32 %18, %19
%21 = icmp sgt i32 %20, 0
%22 = zext i1 %21 to i32
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %15
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%27 = load i8, i8* %6
%28 = zext i8 %27 to i32
%29 = load i32, i32* %7
%30 = load i8, i8* %6
%31 = zext i8 %30 to i32
%32 = load i32, i32* %7
%33 = shl i32 %31, %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29, i32 %33)
store i32 1, i32* %3
br label %45
35: ; preds = %15
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%37 = load i8, i8* %6
%38 = zext i8 %37 to i32
%39 = load i32, i32* %7
%40 = load i8, i8* %6
%41 = zext i8 %40 to i32
%42 = load i32, i32* %7
%43 = shl i32 %41, %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %38, i32 %39, i32 %43)
store i32 0, i32* %3
br label %45
45: ; preds = %35, %25, %14
%46 = load i32, i32* %3
ret i32 %46
}

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
}