#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 uint64_t;
struct ubi_set_vol_prop_req {
  int property;
  unsigned long long value;
};
struct ubi_rsvol_req {
  unsigned long long bytes;
  int vol_id;
};
struct ubi_rnvol_req {
  int count;
};
struct ubi_mkvol_req {
  int vol_id;
  int alignment;
  unsigned long long bytes;
  int vol_type;
  int name_len;
  char *name;
};
struct ubi_map_req {
  int dummy;
};
struct ubi_attach_req {
  int dummy;
};
typedef int /*<<< orphan*/ prop;

/* Variables and functions */
int /*<<< orphan*/ UBI_IOCATT;
int /*<<< orphan*/ UBI_IOCDET;
int /*<<< orphan*/ UBI_IOCEBCH;
int /*<<< orphan*/ UBI_IOCEBER;
int /*<<< orphan*/ UBI_IOCEBISMAP;
int /*<<< orphan*/ UBI_IOCEBMAP;
int /*<<< orphan*/ UBI_IOCEBUNMAP;
int /*<<< orphan*/ UBI_IOCMKVOL;
int /*<<< orphan*/ UBI_IOCRMVOL;
int /*<<< orphan*/ UBI_IOCRNVOL;
int /*<<< orphan*/ UBI_IOCRSVOL;
int /*<<< orphan*/ UBI_IOCSETVOLPROP;
int /*<<< orphan*/ UBI_IOCVOLUP;
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, ...);
int /*<<< orphan*/ memset(struct ubi_set_vol_prop_req *, int /*<<< orphan*/,
                          int);
int open(char *, int /*<<< orphan*/);
int main(void) {
  int fd = open("/dev/null", 0);
  struct ubi_mkvol_req mkvol = {
      .vol_id = 3,
      .alignment = 124,
      .bytes = 1125899906842624ULL,
      .vol_type = 3,
      .name_len = 7,
      .name = "foobar",
  };
  struct ubi_rsvol_req rsvol = {
      .bytes = 1125899906842624ULL,
      .vol_id = -3,
  };
  struct ubi_rnvol_req rnvol = {
      .count = 300,
  };
  struct ubi_attach_req attach;
  struct ubi_map_req map;
  struct ubi_set_vol_prop_req prop = {
      .property = 1,
      .value = 1125899906842624ULL,
  };
  uint64_t bytes = ((uint64_t)1 << 50) | 0x123;
  ioctl(fd, UBI_IOCMKVOL, &mkvol);
  ioctl(fd, UBI_IOCRSVOL, &rsvol);
  ioctl(fd, UBI_IOCRNVOL, &rnvol);
  ioctl(fd, UBI_IOCATT, &attach);
  ioctl(fd, UBI_IOCVOLUP, &bytes);
  ioctl(fd, UBI_IOCEBMAP, &map);
  ioctl(fd, UBI_IOCSETVOLPROP, &prop);
  memset(&prop, 0, sizeof(prop));
  ioctl(fd, UBI_IOCSETVOLPROP, &prop);
  ioctl(fd, UBI_IOCRMVOL, 1);
  ioctl(fd, UBI_IOCDET, 2);
  ioctl(fd, UBI_IOCEBER, 3);
  ioctl(fd, UBI_IOCEBCH, 4);
  ioctl(fd, UBI_IOCEBUNMAP, 5);
  ioctl(fd, UBI_IOCEBISMAP, 6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
xor    %esi,%esi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
mov    0x2c41(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c3e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c3b(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2c38(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe95(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe92(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea0(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xe86(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe83(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e22(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2dfb(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2dc4(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2d7d(%rip),%rax
mov    (%rax),%esi
lea    -0x48(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
lea    -0x64(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2d57(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2d60(%rip),%rax
mov    (%rax),%esi
lea    -0x60(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%edi
mov    0x2d39(%rip),%rax
mov    (%rax),%esi
lea    -0x60(%rbp),%rdx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2d52(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2cf2(%rip),%rax
mov    (%rax),%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
mov    $0x3,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2cfa(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2cda(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
mov    -0x8(%rbp),%edi
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
mov    $0x6,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xec0(%rip),%rdi
xor    %esi,%esi
call   1050 <open@plt>
mov    %eax,%ebx
movups 0x2c58(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0x2c3c(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xeb0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movl   $0x12c,0x8(%rsp)
movups 0xeac(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
lea    0x40(%rsp),%rdx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
lea    0x30(%rsp),%rdx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
lea    0x18(%rsp),%rdx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
lea    0x1c(%rsp),%rdx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2d96(%rip),%r15
mov    (%r15),%esi
lea    0x20(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    (%r15),%esi
mov    %ebx,%edi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2d19(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <ioctl@plt>
mov    0x2cfa(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <ioctl@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ubi_mkvol_req = type { i32, i32, i64, i32, i32, i8* }
%struct.ubi_rsvol_req = type { i64, i32 }
%struct.ubi_rnvol_req = type { i32 }
%struct.ubi_set_vol_prop_req = type { i32, i64 }
%struct.ubi_attach_req = type { i32 }
%struct.ubi_map_req = type { i32 }
@.str = [10 x i8] c"/dev/null\00"
@.str.1 = [7 x i8] c"foobar\00"
@__const.main.mkvol = %struct.ubi_mkvol_req { i32 3, i32 124, i64 1125899906842624, i32 3, i32 7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0) }
@__const.main.rsvol = %struct.ubi_rsvol_req { i64 1125899906842624, i32 -3 }
@__const.main.rnvol = %struct.ubi_rnvol_req { i32 300 }
@__const.main.prop = %struct.ubi_set_vol_prop_req { i32 1, i64 1125899906842624 }
@UBI_IOCMKVOL = global i32 0
@UBI_IOCRSVOL = global i32 0
@UBI_IOCRNVOL = global i32 0
@UBI_IOCATT = global i32 0
@UBI_IOCVOLUP = global i32 0
@UBI_IOCEBMAP = global i32 0
@UBI_IOCSETVOLPROP = global i32 0
@UBI_IOCRMVOL = global i32 0
@UBI_IOCDET = global i32 0
@UBI_IOCEBER = global i32 0
@UBI_IOCEBCH = global i32 0
@UBI_IOCEBUNMAP = global i32 0
@UBI_IOCEBISMAP = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.ubi_mkvol_req
%4 = alloca %struct.ubi_rsvol_req
%5 = alloca %struct.ubi_rnvol_req
%6 = alloca %struct.ubi_attach_req
%7 = alloca %struct.ubi_map_req
%8 = alloca %struct.ubi_set_vol_prop_req
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %10, i32* %2
%11 = bitcast %struct.ubi_mkvol_req* %3 to i8*
%12 = bitcast %struct.ubi_rsvol_req* %4 to i8*
%13 = bitcast %struct.ubi_rnvol_req* %5 to i8*
%14 = bitcast %struct.ubi_set_vol_prop_req* %8 to i8*
store i32 poison, i32* %9
%15 = load i32, i32* %2
%16 = load i32, i32* @UBI_IOCMKVOL
%17 = call i32 (i32, i32, ...) @ioctl(i32 %15, i32 %16, %struct.ubi_mkvol_req* %3)
%18 = load i32, i32* %2
%19 = load i32, i32* @UBI_IOCRSVOL
%20 = call i32 (i32, i32, ...) @ioctl(i32 %18, i32 %19, %struct.ubi_rsvol_req* %4)
%21 = load i32, i32* %2
%22 = load i32, i32* @UBI_IOCRNVOL
%23 = call i32 (i32, i32, ...) @ioctl(i32 %21, i32 %22, %struct.ubi_rnvol_req* %5)
%24 = load i32, i32* %2
%25 = load i32, i32* @UBI_IOCATT
%26 = call i32 (i32, i32, ...) @ioctl(i32 %24, i32 %25, %struct.ubi_attach_req* %6)
%27 = load i32, i32* %2
%28 = load i32, i32* @UBI_IOCVOLUP
%29 = call i32 (i32, i32, ...) @ioctl(i32 %27, i32 %28, i32* %9)
%30 = load i32, i32* %2
%31 = load i32, i32* @UBI_IOCEBMAP
%32 = call i32 (i32, i32, ...) @ioctl(i32 %30, i32 %31, %struct.ubi_map_req* %7)
%33 = load i32, i32* %2
%34 = load i32, i32* @UBI_IOCSETVOLPROP
%35 = call i32 (i32, i32, ...) @ioctl(i32 %33, i32 %34, %struct.ubi_set_vol_prop_req* %8)
%36 = call i32 @memset(%struct.ubi_set_vol_prop_req* %8, i32 0, i32 16)
%37 = load i32, i32* %2
%38 = load i32, i32* @UBI_IOCSETVOLPROP
%39 = call i32 (i32, i32, ...) @ioctl(i32 %37, i32 %38, %struct.ubi_set_vol_prop_req* %8)
%40 = load i32, i32* %2
%41 = load i32, i32* @UBI_IOCRMVOL
%42 = call i32 (i32, i32, ...) @ioctl(i32 %40, i32 %41, i32 1)
%43 = load i32, i32* %2
%44 = load i32, i32* @UBI_IOCDET
%45 = call i32 (i32, i32, ...) @ioctl(i32 %43, i32 %44, i32 2)
%46 = load i32, i32* %2
%47 = load i32, i32* @UBI_IOCEBER
%48 = call i32 (i32, i32, ...) @ioctl(i32 %46, i32 %47, i32 3)
%49 = load i32, i32* %2
%50 = load i32, i32* @UBI_IOCEBCH
%51 = call i32 (i32, i32, ...) @ioctl(i32 %49, i32 %50, i32 4)
%52 = load i32, i32* %2
%53 = load i32, i32* @UBI_IOCEBUNMAP
%54 = call i32 (i32, i32, ...) @ioctl(i32 %52, i32 %53, i32 5)
%55 = load i32, i32* %2
%56 = load i32, i32* @UBI_IOCEBISMAP
%57 = call i32 (i32, i32, ...) @ioctl(i32 %55, i32 %56, i32 6)
ret i32 0
}

LLVM IR (-O2):
%struct.ubi_mkvol_req = type { i32, i32, i64, i32, i32, i8* }
%struct.ubi_rsvol_req = type { i64, i32 }
%struct.ubi_set_vol_prop_req = type { i32, i64 }
%struct.ubi_rnvol_req = type { i32 }
%struct.ubi_attach_req = type { i32 }
%struct.ubi_map_req = type { i32 }
@.str = [10 x i8] c"/dev/null\00"
@.str.1 = [7 x i8] c"foobar\00"
@__const.main.mkvol = %struct.ubi_mkvol_req { i32 3, i32 124, i64 1125899906842624, i32 3, i32 7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0) }
@__const.main.rsvol = %struct.ubi_rsvol_req { i64 1125899906842624, i32 -3 }
@__const.main.prop = %struct.ubi_set_vol_prop_req { i32 1, i64 1125899906842624 }
@UBI_IOCMKVOL = global i32 0
@UBI_IOCRSVOL = global i32 0
@UBI_IOCRNVOL = global i32 0
@UBI_IOCATT = global i32 0
@UBI_IOCVOLUP = global i32 0
@UBI_IOCEBMAP = global i32 0
@UBI_IOCSETVOLPROP = global i32 0
@UBI_IOCRMVOL = global i32 0
@UBI_IOCDET = global i32 0
@UBI_IOCEBER = global i32 0
@UBI_IOCEBCH = global i32 0
@UBI_IOCEBUNMAP = global i32 0
@UBI_IOCEBISMAP = global i32 0
define i32 @main() {
%1 = alloca %struct.ubi_mkvol_req
%2 = alloca %struct.ubi_rsvol_req
%3 = alloca %struct.ubi_rnvol_req
%4 = alloca %struct.ubi_attach_req
%5 = alloca %struct.ubi_map_req
%6 = alloca %struct.ubi_set_vol_prop_req
%7 = alloca i32
%8 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
%9 = bitcast %struct.ubi_mkvol_req* %1 to i8*
%10 = bitcast %struct.ubi_rsvol_req* %2 to i8*
%11 = bitcast %struct.ubi_rnvol_req* %3 to i8*
%12 = getelementptr inbounds %struct.ubi_rnvol_req, %struct.ubi_rnvol_req* %3, i64 0, i32 0
store i32 300, i32* %12
%13 = bitcast %struct.ubi_attach_req* %4 to i8*
%14 = bitcast %struct.ubi_map_req* %5 to i8*
%15 = bitcast %struct.ubi_set_vol_prop_req* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = load i32, i32* @UBI_IOCMKVOL
%18 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %17, %struct.ubi_mkvol_req* %1)
%19 = load i32, i32* @UBI_IOCRSVOL
%20 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %19, %struct.ubi_rsvol_req* %2)
%21 = load i32, i32* @UBI_IOCRNVOL
%22 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %21, %struct.ubi_rnvol_req* %3)
%23 = load i32, i32* @UBI_IOCATT
%24 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %23, %struct.ubi_attach_req* %4)
%25 = load i32, i32* @UBI_IOCVOLUP
%26 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %25, i32* %7)
%27 = load i32, i32* @UBI_IOCEBMAP
%28 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %27, %struct.ubi_map_req* %5)
%29 = load i32, i32* @UBI_IOCSETVOLPROP
%30 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %29, %struct.ubi_set_vol_prop_req* %6)
%31 = call i32 @memset(%struct.ubi_set_vol_prop_req* %6, i32 0, i32 16)
%32 = load i32, i32* @UBI_IOCSETVOLPROP
%33 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %32, %struct.ubi_set_vol_prop_req* %6)
%34 = load i32, i32* @UBI_IOCRMVOL
%35 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %34, i32 1)
%36 = load i32, i32* @UBI_IOCDET
%37 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %36, i32 2)
%38 = load i32, i32* @UBI_IOCEBER
%39 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %38, i32 3)
%40 = load i32, i32* @UBI_IOCEBCH
%41 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %40, i32 4)
%42 = load i32, i32* @UBI_IOCEBUNMAP
%43 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %42, i32 5)
%44 = load i32, i32* @UBI_IOCEBISMAP
%45 = call i32 (i32, i32, ...) @ioctl(i32 %8, i32 %44, i32 6)
ret i32 0
}