#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int, int, unsigned short, ...);
int main(void) {
  unsigned short num1 = 0x0030;
  num1 |= 0x0040;
  printf("0x%x |= 0x%x - 0x%x\n", 0x30, 0x40, num1);
  unsigned short num2 = 0x0030;
  unsigned short i = 6;
  num2 |= 1 << i;
  printf("%#x |= %d << %d - %#x\n", 0x00, 1, i, num2);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x30,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
or     $0x40,%eax
mov    %ax,-0x6(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x30,%esi
mov    $0x40,%edx
movzwl -0x6(%rbp),%ecx
mov    $0x0,%al
call   1030 <printf@plt>
movw   $0x30,-0x8(%rbp)
movw   $0x6,-0xa(%rbp)
movzwl -0xa(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
movzwl -0x8(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x8(%rbp)
mov    -0xa(%rbp),%ax
movzwl -0x8(%rbp),%r8d
lea    0xe96(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
movzwl %ax,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x30,%esi
mov    $0x40,%edx
mov    $0x70,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x6,%ecx
mov    $0x70,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"0x%x |= 0x%x - 0x%x\0A\00"
@.str.1 = [23 x i8] c"%#x |= %d << %d - %#x\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
store i32 0, i32* %1
store i16 48, i16* %2
%5 = load i16, i16* %2
%6 = zext i16 %5 to i32
%7 = or i32 %6, 64
%8 = trunc i32 %7 to i16
store i16 %8, i16* %2
%9 = load i16, i16* %2
%10 = call i32 (i8*, i32, i32, i16, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 48, i32 64, i16 zeroext %9)
store i16 48, i16* %3
store i16 6, i16* %4
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = shl i32 1, %12
%14 = load i16, i16* %3
%15 = zext i16 %14 to i32
%16 = or i32 %15, %13
%17 = trunc i32 %16 to i16
store i16 %17, i16* %3
%18 = load i16, i16* %4
%19 = load i16, i16* %3
%20 = zext i16 %19 to i32
%21 = call i32 (i8*, i32, i32, i16, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i16 zeroext %18, i32 %20)
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}

LLVM IR (-O2):
@.str = [21 x i8] c"0x%x |= 0x%x - 0x%x\0A\00"
@.str.1 = [23 x i8] c"%#x |= %d << %d - %#x\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (i8*, i32, i32, i16, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 48, i32 64, i16 zeroext 112)
%2 = tail call i32 (i8*, i32, i32, i16, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i16 zeroext 6, i32 112)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}