#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[]) {
  int bi = 2 * 8;
  int h = ((1L << bi) - 1) - (1 << (bi - 1));
  printf("Res_1: %x\n", h);
  int i;
  for (i = 0; i < 2; ++i)
    printf("%x ", (h >> (i * 8)) & 0xFF);
  printf("\n");
  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)
movl   $0x10,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
sub    $0x1,%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    11a5 <main+0x95>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%esi
and    $0xff,%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116e <main+0x5e>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
mov    $0x7fff,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rbx
mov    %rbx,%rdi
mov    $0xff,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7f,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Res_1: %x\0A\00"
@.str.1 = [4 x i8] c"%x \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 16, i32* %6
%9 = load i32, i32* %6
%10 = zext i32 %9 to i64
%11 = shl i64 1, %10
%12 = sub nsw i64 %11, 1
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
%15 = shl i32 1, %14
%16 = sext i32 %15 to i64
%17 = sub nsw i64 %12, %16
%18 = trunc i64 %17 to i32
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %19)
store i32 0, i32* %8
br label %21
21: ; preds = %31, %2
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 2
br i1 %23, label %24, label %34
24: ; preds = %21
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = mul nsw i32 %26, 8
%28 = ashr i32 %25, %27
%29 = and i32 %28, 255
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %24
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %21
34: ; preds = %21
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Res_1: %x\0A\00"
@.str.1 = [4 x i8] c"%x \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 32767)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 255)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 127)
%6 = tail call i32 @putchar(i32 10)
ret i32 0
}