#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 SIGBUS;
int SIGINT;
int SIGQUIT;
int /*<<< orphan*/ puts(char *);
void func(int signal) {
  if (signal == SIGINT) {
    puts("I get SIGINT!");
  } else if (signal == SIGQUIT) {
    puts("I get SIGQUIT");
  } else if (signal == SIGBUS) {
    puts("I get SIGBUS");
  }
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ebb(%rip),%rcx
cmp    (%rcx),%eax
jne    113e <func+0x2e>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
jmp    1189 <func+0x79>
mov    -0x4(%rbp),%eax
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%eax
jne    1161 <func+0x51>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
jmp    1184 <func+0x74>
mov    -0x4(%rbp),%eax
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
jne    117f <func+0x6f>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
jmp    1184 <func+0x74>
jmp    1189 <func+0x79>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
mov    0x2ec9(%rip),%rax
cmp    %edi,(%rax)
jne    1127 <func+0x17>
lea    0xede(%rip),%rdi
jmp    1030 <puts@plt>
mov    0x2eaa(%rip),%rax
cmp    %edi,(%rax)
jne    113e <func+0x2e>
lea    0xed5(%rip),%rdi
jmp    1030 <puts@plt>
mov    0x2eab(%rip),%rax
cmp    %edi,(%rax)
jne    1155 <func+0x45>
lea    0xecc(%rip),%rdi
jmp    1030 <puts@plt>
ret

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [14 x i8] c"I get SIGINT!\00"
@SIGQUIT = global i32 0
@.str.1 = [14 x i8] c"I get SIGQUIT\00"
@SIGBUS = global i32 0
@.str.2 = [13 x i8] c"I get SIGBUS\00"
define void @func(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %22
8: ; preds = %1
%9 = load i32, i32* %2
%10 = load i32, i32* @SIGQUIT
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %21
14: ; preds = %8
%15 = load i32, i32* %2
%16 = load i32, i32* @SIGBUS
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
br label %21
21: ; preds = %20, %12
br label %22
22: ; preds = %21, %6
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@.str = [14 x i8] c"I get SIGINT!\00"
@SIGQUIT = global i32 0
@.str.1 = [14 x i8] c"I get SIGQUIT\00"
@SIGBUS = global i32 0
@.str.2 = [13 x i8] c"I get SIGBUS\00"
define void @func(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = load i32, i32* @SIGQUIT
%6 = icmp eq i32 %5, %0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i32, i32* @SIGBUS
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %13
10: ; preds = %7, %4, %1
%11 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %7 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
br label %13
13: ; preds = %10, %7
ret void
}