#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 */
typedef int uint32_t;

/* Variables and functions */
int open(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *);
uint32_t librpip_dt_file_open(uint32_t moduleid, uint32_t fileid, int flags,
                              int *fd) {
  const char *node = NULL;
  const char *file = NULL;
  char sfile[200];
  switch (moduleid) {
  case 1:
    node = "/sys/firmware/devicetree/base/soc/gpiomem";
    break;
  case 2:
    node = "/sys/firmware/devicetree/base/soc/gpio@7e200000";
    break;
  case 3:
    node = "/sys/firmware/devicetree/base/soc/i2c@7e205000";
    break;
  case 4:
    node = "/sys/firmware/devicetree/base/soc/i2c@7e804000";
    break;
  case 5:
    node = "/sys/firmware/devicetree/base/soc/i2s@7e203000";
    break;
  case 6:
    node = "/sys/firmware/devicetree/base/soc/pwm@7e20c000";
    break;
  case 7:
    node = "/sys/firmware/devicetree/base/soc/spi@7e204000";
    break;
  case 8:
    node = "/sys/firmware/devicetree/base/soc/spi@7e204000/spidev@0";
    break;
  case 9:
    node = "/sys/firmware/devicetree/base/soc/spi@7e204000/spidev@1";
    break;
  case 10:
    node = "/sys/firmware/devicetree/base/soc/spi@7e215080";
    break;
  case 11:
    node = "/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@0";
    break;
  case 12:
    node = "/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@1";
    break;
  case 13:
    node = "/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@2";
    break;
  case 14:
    node = "/sys/firmware/devicetree/base/soc/uart@7e201000";
    break;
  case 15:
    node = "/sys/firmware/devicetree/base/soc/uart@7e215040";
    break;
  case 16:
    node = "/sys/firmware/devicetree/base/onewire@0";
    break;
  }
  switch (fileid) {
  case 1:
    file = "status";
    break;
  case 2:
    file = "i2c0/brcm,pins";
    break;
  case 3:
    file = "i2c1/brcm,pins";
    break;
  case 4:
    file = "i2s/brcm,pins";
    break;
  case 5:
    file = "pwm_pins/brcm,pins";
    break;
  case 6:
    file = "spi0_cs_pins/brcm,pins";
    break;
  case 7:
    file = "spi0_pins/brcm,pins";
    break;
  case 8:
    file = "spi1_cs_pins/brcm,pins";
    break;
  case 9:
    file = "spi1_pins/brcm,pins";
    break;
  case 10:
    file = "w1_pins/brcm,pins";
    break;
  }
  if (node && file) {
    sprintf(sfile, "%s/%s", node, file);
    *fd = open(sfile, flags);
    return *fd < 0 ? 0 : 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<librpip_dt_file_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0xf8(%rbp)
sub    $0xf,%eax
ja     1272 <librpip_dt_file_open+0x152>
mov    -0xf8(%rbp),%rax
lea    0xe92(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeea(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xf04(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xf24(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xf43(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xf62(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xf81(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xfa0(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xfbf(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0xfe7(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0x100f(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0x102e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0x1056(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0x107e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0x10a6(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0x10c6(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1272 <librpip_dt_file_open+0x152>
lea    0x10e6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x100(%rbp)
sub    $0x9,%eax
ja     133c <librpip_dt_file_open+0x21c>
mov    -0x100(%rbp),%rax
lea    0xda8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x10d4(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10cb(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10ca(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10c9(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10c7(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10ca(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10d1(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10d5(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10dc(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    133c <librpip_dt_file_open+0x21c>
lea    0x10e0(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     139f <librpip_dt_file_open+0x27f>
cmpq   $0x0,-0x28(%rbp)
je     139f <librpip_dt_file_open+0x27f>
lea    -0xf0(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0x10c2(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <open@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovl  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    13a6 <librpip_dt_file_open+0x286>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<librpip_dt_file_open>:
push   %rbp
push   %r14
push   %rbx
sub    $0xd0,%rsp
mov    %rcx,%r14
mov    %edx,%ebp
xor    %eax,%eax
add    $0xffffffff,%edi
cmp    $0xf,%edi
ja     1156 <librpip_dt_file_open+0x36>
lea    0xebf(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf17(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
xor    %ecx,%ecx
xor    %edx,%edx
jmp    11e6 <librpip_dt_file_open+0xc6>
lea    0xf2c(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0xf53(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0xf79(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0xf9f(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0xfc5(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0xfeb(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x1011(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x1040(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x106f(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x1095(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x10c4(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x10f3(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x1122(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x1149(%rip),%rdx
jmp    11e4 <librpip_dt_file_open+0xc4>
lea    0x1170(%rip),%rdx
mov    $0x1,%cl
add    $0xffffffff,%esi
cmp    $0x9,%esi
ja     1227 <librpip_dt_file_open+0x107>
test   %cl,%cl
je     1227 <librpip_dt_file_open+0x107>
movslq %esi,%rax
lea    0xe44(%rip),%rsi
movslq (%rsi,%rax,4),%rcx
add    %rsi,%rcx
lea    0x1220(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <open@plt>
mov    %eax,(%r14)
not    %eax
shr    $0x1f,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"/sys/firmware/devicetree/base/soc/gpiomem\00"
@.str.1 = [48 x i8] c"/sys/firmware/devicetree/base/soc/gpio@7e200000\00"
@.str.2 = [47 x i8] c"/sys/firmware/devicetree/base/soc/i2c@7e205000\00"
@.str.3 = [47 x i8] c"/sys/firmware/devicetree/base/soc/i2c@7e804000\00"
@.str.4 = [47 x i8] c"/sys/firmware/devicetree/base/soc/i2s@7e203000\00"
@.str.5 = [47 x i8] c"/sys/firmware/devicetree/base/soc/pwm@7e20c000\00"
@.str.6 = [47 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e204000\00"
@.str.7 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e204000/spidev@0\00"
@.str.8 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e204000/spidev@1\00"
@.str.9 = [47 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080\00"
@.str.10 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@0\00"
@.str.11 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@1\00"
@.str.12 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@2\00"
@.str.13 = [48 x i8] c"/sys/firmware/devicetree/base/soc/uart@7e201000\00"
@.str.14 = [48 x i8] c"/sys/firmware/devicetree/base/soc/uart@7e215040\00"
@.str.15 = [40 x i8] c"/sys/firmware/devicetree/base/onewire@0\00"
@.str.16 = [7 x i8] c"status\00"
@.str.17 = [15 x i8] c"i2c0/brcm,pins\00"
@.str.18 = [15 x i8] c"i2c1/brcm,pins\00"
@.str.19 = [14 x i8] c"i2s/brcm,pins\00"
@.str.20 = [19 x i8] c"pwm_pins/brcm,pins\00"
@.str.21 = [23 x i8] c"spi0_cs_pins/brcm,pins\00"
@.str.22 = [20 x i8] c"spi0_pins/brcm,pins\00"
@.str.23 = [23 x i8] c"spi1_cs_pins/brcm,pins\00"
@.str.24 = [20 x i8] c"spi1_pins/brcm,pins\00"
@.str.25 = [18 x i8] c"w1_pins/brcm,pins\00"
@.str.26 = [6 x i8] c"%s/%s\00"
define i32 @librpip_dt_file_open(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [200 x i8]
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i8* null, i8** %10
store i8* null, i8** %11
%13 = load i32, i32* %6
switch i32 %13, label %30 [
i32 1, label %14
i32 2, label %15
i32 3, label %16
i32 4, label %17
i32 5, label %18
i32 6, label %19
i32 7, label %20
i32 8, label %21
i32 9, label %22
i32 10, label %23
i32 11, label %24
i32 12, label %25
i32 13, label %26
i32 14, label %27
i32 15, label %28
i32 16, label %29
]
14: ; preds = %4
store i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8** %10
br label %30
15: ; preds = %4
store i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8** %10
br label %30
16: ; preds = %4
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8** %10
br label %30
17: ; preds = %4
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8** %10
br label %30
18: ; preds = %4
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8** %10
br label %30
19: ; preds = %4
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8** %10
br label %30
20: ; preds = %4
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8** %10
br label %30
21: ; preds = %4
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), i8** %10
br label %30
22: ; preds = %4
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i8** %10
br label %30
23: ; preds = %4
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i8** %10
br label %30
24: ; preds = %4
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0), i8** %10
br label %30
25: ; preds = %4
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), i8** %10
br label %30
26: ; preds = %4
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.12, i64 0, i64 0), i8** %10
br label %30
27: ; preds = %4
store i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.13, i64 0, i64 0), i8** %10
br label %30
28: ; preds = %4
store i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), i8** %10
br label %30
29: ; preds = %4
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i8** %10
br label %30
30: ; preds = %4, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14
%31 = load i32, i32* %7
switch i32 %31, label %42 [
i32 1, label %32
i32 2, label %33
i32 3, label %34
i32 4, label %35
i32 5, label %36
i32 6, label %37
i32 7, label %38
i32 8, label %39
i32 9, label %40
i32 10, label %41
]
32: ; preds = %30
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i8** %11
br label %42
33: ; preds = %30
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0), i8** %11
br label %42
34: ; preds = %30
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), i8** %11
br label %42
35: ; preds = %30
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i64 0, i64 0), i8** %11
br label %42
36: ; preds = %30
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.20, i64 0, i64 0), i8** %11
br label %42
37: ; preds = %30
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0), i8** %11
br label %42
38: ; preds = %30
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0), i8** %11
br label %42
39: ; preds = %30
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.23, i64 0, i64 0), i8** %11
br label %42
40: ; preds = %30
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.24, i64 0, i64 0), i8** %11
br label %42
41: ; preds = %30
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.25, i64 0, i64 0), i8** %11
br label %42
42: ; preds = %30, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32
%43 = load i8*, i8** %10
%44 = icmp ne i8* %43, null
br i1 %44, label %45, label %62
45: ; preds = %42
%46 = load i8*, i8** %11
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %62
48: ; preds = %45
%49 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%50 = load i8*, i8** %10
%51 = load i8*, i8** %11
%52 = call i32 @sprintf(i8* %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.26, i64 0, i64 0), i8* %50, i8* %51)
%53 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%54 = load i32, i32* %8
%55 = call i32 @open(i8* %53, i32 %54)
%56 = load i32*, i32** %9
store i32 %55, i32* %56
%57 = load i32*, i32** %9
%58 = load i32, i32* %57
%59 = icmp slt i32 %58, 0
%60 = zext i1 %59 to i64
%61 = select i1 %59, i32 0, i32 1
store i32 %61, i32* %5
br label %63
62: ; preds = %45, %42
store i32 0, i32* %5
br label %63
63: ; preds = %62, %48
%64 = load i32, i32* %5
ret i32 %64
}

LLVM IR (-O2):
@.str = [42 x i8] c"/sys/firmware/devicetree/base/soc/gpiomem\00"
@.str.1 = [48 x i8] c"/sys/firmware/devicetree/base/soc/gpio@7e200000\00"
@.str.2 = [47 x i8] c"/sys/firmware/devicetree/base/soc/i2c@7e205000\00"
@.str.3 = [47 x i8] c"/sys/firmware/devicetree/base/soc/i2c@7e804000\00"
@.str.4 = [47 x i8] c"/sys/firmware/devicetree/base/soc/i2s@7e203000\00"
@.str.5 = [47 x i8] c"/sys/firmware/devicetree/base/soc/pwm@7e20c000\00"
@.str.6 = [47 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e204000\00"
@.str.7 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e204000/spidev@0\00"
@.str.8 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e204000/spidev@1\00"
@.str.9 = [47 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080\00"
@.str.10 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@0\00"
@.str.11 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@1\00"
@.str.12 = [56 x i8] c"/sys/firmware/devicetree/base/soc/spi@7e215080/spidev@2\00"
@.str.13 = [48 x i8] c"/sys/firmware/devicetree/base/soc/uart@7e201000\00"
@.str.14 = [48 x i8] c"/sys/firmware/devicetree/base/soc/uart@7e215040\00"
@.str.15 = [40 x i8] c"/sys/firmware/devicetree/base/onewire@0\00"
@.str.16 = [7 x i8] c"status\00"
@.str.17 = [15 x i8] c"i2c0/brcm,pins\00"
@.str.18 = [15 x i8] c"i2c1/brcm,pins\00"
@.str.19 = [14 x i8] c"i2s/brcm,pins\00"
@.str.20 = [19 x i8] c"pwm_pins/brcm,pins\00"
@.str.21 = [23 x i8] c"spi0_cs_pins/brcm,pins\00"
@.str.22 = [20 x i8] c"spi0_pins/brcm,pins\00"
@.str.23 = [23 x i8] c"spi1_cs_pins/brcm,pins\00"
@.str.24 = [20 x i8] c"spi1_pins/brcm,pins\00"
@.str.25 = [18 x i8] c"w1_pins/brcm,pins\00"
@.str.26 = [6 x i8] c"%s/%s\00"
@reltable.librpip_dt_file_open = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.16 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.17 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.18 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.19 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.20 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.21 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.22 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.23 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.24 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.25 to i64), i64 ptrtoint ([10 x i32]* @reltable.librpip_dt_file_open to i64)) to i32)]
define i32 @librpip_dt_file_open(i32 %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca [200 x i8]
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
switch i32 %0, label %23 [
i32 1, label %7
i32 2, label %8
i32 3, label %9
i32 4, label %10
i32 5, label %11
i32 6, label %12
i32 7, label %13
i32 8, label %14
i32 9, label %15
i32 10, label %16
i32 11, label %17
i32 12, label %18
i32 13, label %19
i32 14, label %20
i32 15, label %21
i32 16, label %22
]
7: ; preds = %4
br label %23
8: ; preds = %4
br label %23
9: ; preds = %4
br label %23
10: ; preds = %4
br label %23
11: ; preds = %4
br label %23
12: ; preds = %4
br label %23
13: ; preds = %4
br label %23
14: ; preds = %4
br label %23
15: ; preds = %4
br label %23
16: ; preds = %4
br label %23
17: ; preds = %4
br label %23
18: ; preds = %4
br label %23
19: ; preds = %4
br label %23
20: ; preds = %4
br label %23
21: ; preds = %4
br label %23
22: ; preds = %4
br label %23
23: ; preds = %4, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7
%24 = phi i1 [ false, %4 ], [ true, %22 ], [ true, %21 ], [ true, %20 ], [ true, %19 ], [ true, %18 ], [ true, %17 ], [ true, %16 ], [ true, %15 ], [ true, %14 ], [ true, %13 ], [ true, %12 ], [ true, %11 ], [ true, %10 ], [ true, %9 ], [ true, %8 ], [ true, %7 ]
%25 = phi i8* [ null, %4 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), %22 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), %21 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.13, i64 0, i64 0), %20 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.12, i64 0, i64 0), %19 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), %18 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0), %17 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), %16 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), %15 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), %14 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), %13 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), %12 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), %11 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), %7 ]
%26 = add i32 %1, -1
%27 = icmp ult i32 %26, 10
%28 = xor i1 %27, true
%29 = xor i1 %24, true
%30 = or i1 %28, %29
br i1 %30, label %39, label %31
31: ; preds = %23
%32 = sext i32 %26 to i64
%33 = shl i64 %32, 2
%34 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.librpip_dt_file_open to i8*), i64 %33)
%35 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.26, i64 0, i64 0), i8* %25, i8* %34)
%36 = call i32 @open(i8* %6, i32 %2)
store i32 %36, i32* %3
%37 = xor i32 %36, -1
%38 = lshr i32 %37, 31
br label %39
39: ; preds = %23, %31
%40 = phi i32 [ %38, %31 ], [ 0, %23 ]
ret i32 %40
}