#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*/ print(char *);
void f(int n) {
  int a = n & 2, b = n & 1;
  if (a)
    if (b)
      print("42");
    else
      print("54");
  if (a)
    if (b)
      print("42");
    else
      print("54");
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1163 <f+0x53>
cmpl   $0x0,-0xc(%rbp)
je     1152 <f+0x42>
lea    0xeb8(%rip),%rdi
call   1030 <print@plt>
jmp    115e <f+0x4e>
lea    0xeaa(%rip),%rdi
call   1030 <print@plt>
jmp    1163 <f+0x53>
cmpl   $0x0,-0x8(%rbp)
je     1199 <f+0x89>
cmpl   $0x0,-0xc(%rbp)
je     1188 <f+0x78>
lea    0xe82(%rip),%rdi
call   1030 <print@plt>
jmp    1194 <f+0x84>
lea    0xe74(%rip),%rdi
call   1030 <print@plt>
jmp    1199 <f+0x89>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   $0x2,%dil
jne    1117 <f+0x7>
ret
push   %rbx
test   $0x1,%dil
lea    0xee0(%rip),%rax
lea    0xed6(%rip),%rbx
cmove  %rax,%rbx
mov    %rbx,%rdi
call   1030 <print@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <print@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"42\00"
@.str.1 = [3 x i8] c"54\00"
define void @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, 2
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = and i32 %7, 1
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %1
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %11
%17 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
br label %19
19: ; preds = %18, %1
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %29
27: ; preds = %22
%28 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
br label %30
30: ; preds = %29, %19
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"42\00"
@.str.1 = [3 x i8] c"54\00"
define void @f(i32 %0) {
%2 = and i32 %0, 2
%3 = icmp eq i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = and i32 %0, 1
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%8 = tail call i32 @print(i8* %7)
%9 = tail call i32 @print(i8* %7)
br label %10
10: ; preds = %4, %1
ret void
}