#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 int);
void test_combine() {
  unsigned int a = 2047;
  printf("%x\n", a);
  int b = 65;
  printf("%x\n", b);
  unsigned int c = a | (b << 24);
  printf("%x\n", c);
  unsigned int ae = c & 0x00ffffff;
  unsigned int be = (c & 0xff000000) >> 24;
  printf("%x\n", ae);
  printf("%x\n", be);
}


x86 assembly (clang, -O0):
<test_combine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x7ff,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x41,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0xffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_combine>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7ff,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x41,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x410007ff,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7ff,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x41,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%x\0A\00"
define void @test_combine() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 2047, i32* %1
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 65, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = shl i32 %11, 24
%13 = or i32 %10, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
%17 = and i32 %16, 16777215
store i32 %17, i32* %4
%18 = load i32, i32* %3
%19 = and i32 %18, -16777216
%20 = lshr i32 %19, 24
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x\0A\00"
define void @test_combine() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2047)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 65)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1090521087)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2047)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 65)
ret void
}