#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 flag1, flag2, flag3;
  flag1 = 0X01 | 0x02 | 0x04 | 0x08;
  printf("flag1=%02X\n", flag1);
  flag2 = 0x10 | 0x20 | 0x40 | 0x80;
  printf("flag2=%02X\n", flag2);
  printf("\n");
  if (flag1 & 0x02)
    printf("WRITE True in the flag1\n");
  else
    printf("WRITE False in the flag1\n");
  if (flag2 & 0x02)
    printf("WRITE True in the flag2\n");
  else
    printf("WRITE False in the flag2\n");
  printf("\n");
  flag3 = flag1 | flag2;
  printf("flag3 = %02X\n", flag3);
  printf("flag3 & flag1 = %02X\n", flag3 & flag1);
  printf("flag3 & flag2 = %02X\n", flag3 & flag2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xf0,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     117f <main+0x6f>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118d <main+0x7d>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11af <main+0x9f>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <main+0xad>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
and    -0x8(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
and    -0xc(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0xf0,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeea(%rip),%rdi
call   1040 <puts@plt>
lea    0xef6(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe8e(%rip),%rdi
mov    $0xff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0xf0,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"flag1=%02X\0A\00"
@.str.1 = [12 x i8] c"flag2=%02X\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [25 x i8] c"WRITE True in the flag1\0A\00"
@.str.4 = [26 x i8] c"WRITE False in the flag1\0A\00"
@.str.5 = [25 x i8] c"WRITE True in the flag2\0A\00"
@.str.6 = [26 x i8] c"WRITE False in the flag2\0A\00"
@.str.7 = [14 x i8] c"flag3 = %02X\0A\00"
@.str.8 = [22 x i8] c"flag3 & flag1 = %02X\0A\00"
@.str.9 = [22 x i8] c"flag3 & flag2 = %02X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 240, i32* %3
%7 = load i32, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = and i32 %10, 2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %3
%19 = and i32 %18, 2
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %25
23: ; preds = %17
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = or i32 %27, %28
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %4
%33 = load i32, i32* %2
%34 = and i32 %32, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %4
%37 = load i32, i32* %3
%38 = and i32 %36, %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"flag1=%02X\0A\00"
@.str.1 = [12 x i8] c"flag2=%02X\0A\00"
@.str.7 = [14 x i8] c"flag3 = %02X\0A\00"
@.str.8 = [22 x i8] c"flag3 & flag1 = %02X\0A\00"
@.str.9 = [22 x i8] c"flag3 & flag2 = %02X\0A\00"
@str = [24 x i8] c"WRITE True in the flag1\00"
@str.10 = [25 x i8] c"WRITE False in the flag2\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 15)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 240)
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 255)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 15)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 240)
ret i32 0
}