#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 */
struct stat {
  int dummy;
};
struct felement {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ adaptive_add(char const *, struct felement *, struct stat *);
int /*<<< orphan*/ adaptive_delete(char const *, struct felement *,
                                   unsigned int);
int adaptive_action(int event_mask, const char *path, struct felement *lsptr,
                    struct stat *statdat, unsigned int wd) {
  switch (event_mask) {
  case 0x40000100:
    adaptive_add(path, lsptr, statdat);
    break;
  case 0x00000400:
    adaptive_delete(path, lsptr, wd);
    break;
  default:
    return 0;
    break;
  }
  return 1;
}


x86 assembly (clang, -O0):
<adaptive_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x400,%eax
je     117a <adaptive_action+0x5a>
jmp    1151 <adaptive_action+0x31>
mov    -0x28(%rbp),%eax
sub    $0x40000100,%eax
jne    118f <adaptive_action+0x6f>
jmp    1164 <adaptive_action+0x44>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <adaptive_add@plt>
jmp    119b <adaptive_action+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <adaptive_delete@plt>
jmp    119b <adaptive_action+0x7b>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <adaptive_action+0x82>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adaptive_action>:
push   %rax
cmp    $0x400,%edi
je     1143 <adaptive_action+0x23>
xor    %eax,%eax
cmp    $0x40000100,%edi
jne    1156 <adaptive_action+0x36>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1040 <adaptive_add@plt>
jmp    1151 <adaptive_action+0x31>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %r8d,%edx
call   1030 <adaptive_delete@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.felement = type { i32 }
%struct.stat = type { i32 }
define i32 @adaptive_action(i32 %0, i8* %1, %struct.felement* %2, %struct.stat* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca %struct.felement*
%10 = alloca %struct.stat*
%11 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store %struct.felement* %2, %struct.felement** %9
store %struct.stat* %3, %struct.stat** %10
store i32 %4, i32* %11
%12 = load i32, i32* %7
switch i32 %12, label %23 [
i32 1073742080, label %13
i32 1024, label %18
]
13: ; preds = %5
%14 = load i8*, i8** %8
%15 = load %struct.felement*, %struct.felement** %9
%16 = load %struct.stat*, %struct.stat** %10
%17 = call i32 @adaptive_add(i8* %14, %struct.felement* %15, %struct.stat* %16)
br label %24
18: ; preds = %5
%19 = load i8*, i8** %8
%20 = load %struct.felement*, %struct.felement** %9
%21 = load i32, i32* %11
%22 = call i32 @adaptive_delete(i8* %19, %struct.felement* %20, i32 %21)
br label %24
23: ; preds = %5
store i32 0, i32* %6
br label %25
24: ; preds = %18, %13
store i32 1, i32* %6
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %6
ret i32 %26
}

LLVM IR (-O2):
%struct.felement = type { i32 }
%struct.stat = type { i32 }
define i32 @adaptive_action(i32 %0, i8* %1, %struct.felement* %2, %struct.stat* %3, i32 %4) {
switch i32 %0, label %10 [
i32 1073742080, label %6
i32 1024, label %8
]
6: ; preds = %5
%7 = tail call i32 @adaptive_add(i8* %1, %struct.felement* %2, %struct.stat* %3)
br label %10
8: ; preds = %5
%9 = tail call i32 @adaptive_delete(i8* %1, %struct.felement* %2, i32 %4)
br label %10
10: ; preds = %6, %8, %5
%11 = phi i32 [ 0, %5 ], [ 1, %8 ], [ 1, %6 ]
ret i32 %11
}