#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 __u8;

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
long get_hc_erase_grp_size(int *);
long get_hc_wp_grp_size(int *);
scalar_t__ is_blockaddresed(int *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read_extcsd(int, int *);
int /*<<< orphan*/ set_partitioning_setting_completed(int, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
unsigned int strtol(char *, int /*<<< orphan*/ *, int);
int write_extcsd_value(int, int, int);
int do_enh_area_set(int nargs, char **argv) {
  __u8 value;
  __u8 ext_csd[512];
  int fd, ret;
  char *device;
  int dry_run = 1;
  unsigned int start_kib, length_kib, enh_start_addr, enh_size_mult;
  unsigned long align;
  {
    if (nargs != 5) {
      fprintf(stderr,
              "Usage: mmc enh_area set <-y|-n> <start KiB> <length KiB> "
              "</path/to/mmcblkX>\n");
      exit(1);
    }
  };
  if (!strcmp("-y", argv[1]))
    dry_run = 0;
  start_kib = strtol(argv[2], NULL, 10);
  length_kib = strtol(argv[3], NULL, 10);
  device = argv[4];
  fd = open(device, O_RDWR);
  if (fd < 0) {
    perror("open");
    exit(1);
  }
  ret = read_extcsd(fd, ext_csd);
  if (ret) {
    fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
    exit(1);
  }
  if (!(ext_csd[160] & (1 << 1))) {
    printf(" Device cannot have enhanced tech.\n");
    exit(1);
  }
  if (ext_csd[155]) {
    printf(" Device is already partitioned\n");
    exit(1);
  }
  align = 512l * get_hc_wp_grp_size(ext_csd) * get_hc_erase_grp_size(ext_csd);
  enh_size_mult = (length_kib + align / 2l) / align;
  enh_start_addr = start_kib * 1024 / (is_blockaddresed(ext_csd) ? 512 : 1);
  enh_start_addr /= align;
  enh_start_addr *= align;
  ret = write_extcsd_value(fd, 175, 0x1);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x1 to "
            "EXT_CSD[%d] in %s\n",
            175, device);
    exit(1);
  }
  value = (enh_start_addr >> 24) & 0xff;
  ret = write_extcsd_value(fd, 139, value);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x%02x to "
            "EXT_CSD[%d] in %s\n",
            value, 139, device);
    exit(1);
  }
  value = (enh_start_addr >> 16) & 0xff;
  ret = write_extcsd_value(fd, 138, value);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x%02x to "
            "EXT_CSD[%d] in %s\n",
            value, 138, device);
    exit(1);
  }
  value = (enh_start_addr >> 8) & 0xff;
  ret = write_extcsd_value(fd, 137, value);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x%02x to "
            "EXT_CSD[%d] in %s\n",
            value, 137, device);
    exit(1);
  }
  value = enh_start_addr & 0xff;
  ret = write_extcsd_value(fd, 136, value);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x%02x to "
            "EXT_CSD[%d] in %s\n",
            value, 136, device);
    exit(1);
  }
  value = (enh_size_mult >> 16) & 0xff;
  ret = write_extcsd_value(fd, 142, value);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x%02x to "
            "EXT_CSD[%d] in %s\n",
            value, 142, device);
    exit(1);
  }
  value = (enh_size_mult >> 8) & 0xff;
  ret = write_extcsd_value(fd, 141, value);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x%02x to "
            "EXT_CSD[%d] in %s\n",
            value, 141, device);
    exit(1);
  }
  value = enh_size_mult & 0xff;
  ret = write_extcsd_value(fd, 140, value);
  if (ret) {
    fprintf(stderr,
            "Could not write 0x%02x to "
            "EXT_CSD[%d] in %s\n",
            value, 140, device);
    exit(1);
  }
  ret = write_extcsd_value(fd, 156, (1 << 0));
  if (ret) {
    fprintf(stderr,
            "Could not write EXT_CSD_ENH_USR to "
            "EXT_CSD[%d] in %s\n",
            156, device);
    exit(1);
  }
  printf("Done setting ENH_USR area on %s\n", device);
  if (!set_partitioning_setting_completed(dry_run, device, fd))
    exit(1);
  return 0;
}


x86 assembly (clang, -O0):
<do_enh_area_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x834(%rbp)
cmpl   $0x5,-0x4(%rbp)
je     1217 <do_enh_area_set+0x47>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
lea    0xdfa(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe27(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    123e <do_enh_area_set+0x6e>
movl   $0x0,-0x834(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x838(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x83c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x830(%rbp)
mov    -0x830(%rbp),%rdi
mov    0x2d55(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x824(%rbp)
cmpl   $0x0,-0x824(%rbp)
jge    12c3 <do_enh_area_set+0xf3>
lea    0xd9c(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x824(%rbp),%edi
lea    -0x820(%rbp),%rsi
call   10a0 <read_extcsd@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     1310 <do_enh_area_set+0x140>
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
mov    -0x830(%rbp),%rdx
lea    0xd56(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x5a0(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    133a <do_enh_area_set+0x16a>
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
cmpl   $0x0,-0x5b4(%rbp)
je     135f <do_enh_area_set+0x18f>
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x820(%rbp),%rdi
call   10f0 <get_hc_wp_grp_size@plt>
shl    $0x9,%rax
mov    %rax,-0x860(%rbp)
lea    -0x820(%rbp),%rdi
call   10b0 <get_hc_erase_grp_size@plt>
mov    %rax,%rcx
mov    -0x860(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x850(%rbp)
mov    -0x83c(%rbp),%eax
mov    -0x850(%rbp),%rcx
shr    $0x1,%rcx
add    %rcx,%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x850(%rbp)
mov    %eax,-0x844(%rbp)
mov    -0x838(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x854(%rbp)
lea    -0x820(%rbp),%rdi
call   1090 <is_blockaddresed@plt>
mov    %rax,%rsi
mov    -0x854(%rbp),%eax
mov    $0x1,%ecx
mov    $0x200,%edx
cmp    $0x0,%rsi
cmovne %edx,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x840(%rbp)
mov    -0x850(%rbp),%rcx
mov    -0x840(%rbp),%eax
xor    %edx,%edx
div    %rcx
mov    %eax,-0x840(%rbp)
mov    -0x850(%rbp),%rcx
mov    -0x840(%rbp),%eax
imul   %rcx,%rax
mov    %eax,-0x840(%rbp)
mov    -0x824(%rbp),%edi
mov    $0xaf,%esi
mov    $0x1,%edx
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     147f <do_enh_area_set+0x2af>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
mov    -0x830(%rbp),%rcx
lea    0xc50(%rip),%rsi
mov    $0xaf,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x840(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x824(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x8b,%esi
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     14e6 <do_enh_area_set+0x316>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x830(%rbp),%r8
lea    0xc13(%rip),%rsi
mov    $0x8b,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x840(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x824(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x8a,%esi
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     154d <do_enh_area_set+0x37d>
mov    0x2ab4(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x830(%rbp),%r8
lea    0xbac(%rip),%rsi
mov    $0x8a,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x840(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x824(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x89,%esi
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     15b4 <do_enh_area_set+0x3e4>
mov    0x2a4d(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x830(%rbp),%r8
lea    0xb45(%rip),%rsi
mov    $0x89,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x840(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x824(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x88,%esi
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     1618 <do_enh_area_set+0x448>
mov    0x29e9(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x830(%rbp),%r8
lea    0xae1(%rip),%rsi
mov    $0x88,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x844(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x824(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x8e,%esi
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     167f <do_enh_area_set+0x4af>
mov    0x2982(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x830(%rbp),%r8
lea    0xa7a(%rip),%rsi
mov    $0x8e,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x844(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x824(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x8d,%esi
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     16e6 <do_enh_area_set+0x516>
mov    0x291b(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x830(%rbp),%r8
lea    0xa13(%rip),%rsi
mov    $0x8d,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x844(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x824(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x8c,%esi
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     174a <do_enh_area_set+0x57a>
mov    0x28b7(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x830(%rbp),%r8
lea    0x9af(%rip),%rsi
mov    $0x8c,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x824(%rbp),%edi
mov    $0x9c,%esi
mov    $0x1,%edx
call   1080 <write_extcsd_value@plt>
mov    %eax,-0x828(%rbp)
cmpl   $0x0,-0x828(%rbp)
je     179f <do_enh_area_set+0x5cf>
mov    0x285f(%rip),%rax
mov    (%rax),%edi
mov    -0x830(%rbp),%rcx
lea    0x987(%rip),%rsi
mov    $0x9c,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x830(%rbp),%rsi
lea    0x999(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x834(%rbp),%edi
mov    -0x830(%rbp),%rsi
mov    -0x824(%rbp),%edx
call   1030 <set_partitioning_setting_completed@plt>
cmp    $0x0,%eax
jne    17df <do_enh_area_set+0x60f>
mov    $0x1,%edi
call   10e0 <exit@plt>
xor    %eax,%eax
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_enh_area_set>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
cmp    $0x5,%edi
jne    1454 <do_enh_area_set+0x274>
mov    %rsi,%rbp
mov    0x8(%rsi),%rsi
lea    0xe45(%rip),%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
setne  0x7(%rsp)
mov    0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%r15d
mov    0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%r13d
mov    0x20(%rbp),%rbx
mov    0x2da3(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10d0 <open@plt>
test   %eax,%eax
js     1475 <do_enh_area_set+0x295>
mov    %eax,%r12d
lea    0x10(%rsp),%rsi
mov    %eax,%edi
call   10b0 <read_extcsd@plt>
test   %eax,%eax
jne    148b <do_enh_area_set+0x2ab>
testb  $0x2,0x290(%rsp)
02
je     14af <do_enh_area_set+0x2cf>
mov    %rbx,0x8(%rsp)
cmpl   $0x0,0x27c(%rsp)
jne    14b8 <do_enh_area_set+0x2d8>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1100 <get_hc_wp_grp_size@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   10c0 <get_hc_erase_grp_size@plt>
mov    %rax,%rbp
imul   %r14,%rbp
shl    $0x9,%rbp
mov    %r13d,%ecx
mov    %rbp,%rax
shr    %rax
add    %rcx,%rax
mov    %rax,%rcx
or     %rbp,%rcx
shr    $0x20,%rcx
je     12d4 <do_enh_area_set+0xf4>
xor    %edx,%edx
div    %rbp
mov    %rax,%rbx
jmp    12da <do_enh_area_set+0xfa>
xor    %edx,%edx
div    %ebp
mov    %eax,%ebx
shl    $0xa,%r15d
lea    0x10(%rsp),%rdi
call   10a0 <is_blockaddresed@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,8),%ecx
shr    %cl,%r15d
mov    %r15,%r13
cmp    %rbp,%r15
jb     1308 <do_enh_area_set+0x128>
mov    %r15d,%eax
xor    %edx,%edx
div    %ebp
mov    %edx,%r13d
mov    %rbx,%r14
mov    %r12d,%edi
mov    $0xaf,%esi
mov    $0x1,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    14ce <do_enh_area_set+0x2ee>
sub    %r13d,%r15d
mov    %r15,%rbp
mov    %r15d,%ebx
shr    $0x18,%ebx
mov    %r12d,%edi
mov    $0x8b,%esi
mov    %ebx,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    14e8 <do_enh_area_set+0x308>
mov    %rbp,%rax
shr    $0x10,%eax
movzbl %al,%ebx
mov    %r12d,%edi
mov    $0x8a,%esi
mov    %ebx,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    1504 <do_enh_area_set+0x324>
mov    %rbp,%rax
movzbl %ah,%ebx
mov    %r12d,%edi
mov    $0x89,%esi
mov    %ebx,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    151d <do_enh_area_set+0x33d>
movzbl %bpl,%ebx
mov    %r12d,%edi
mov    $0x88,%esi
mov    %ebx,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    1536 <do_enh_area_set+0x356>
mov    %r14,%rbx
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%ebp
mov    %r12d,%edi
mov    $0x8e,%esi
mov    %ebp,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    154f <do_enh_area_set+0x36f>
movzbl %bh,%ebp
mov    %r12d,%edi
mov    $0x8d,%esi
mov    %ebp,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    1568 <do_enh_area_set+0x388>
movzbl %bl,%ebx
mov    %r12d,%edi
mov    $0x8c,%esi
mov    %ebx,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    1581 <do_enh_area_set+0x3a1>
mov    %r12d,%edi
mov    $0x9c,%esi
mov    $0x1,%edx
call   1090 <write_extcsd_value@plt>
test   %eax,%eax
jne    15ae <do_enh_area_set+0x3ce>
mov    0x7(%rsp),%al
xor    %ebp,%ebp
mov    %al,%bpl
lea    0xce2(%rip),%rdi
mov    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1030 <set_partitioning_setting_completed@plt>
test   %eax,%eax
je     14a5 <do_enh_area_set+0x2c5>
xor    %eax,%eax
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b7d(%rip),%rax
mov    (%rax),%edi
lea    0xb9c(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xbd4(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2b46(%rip),%rax
mov    (%rax),%edi
lea    0xbba(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xc6d(%rip),%rdi
jmp    14bf <do_enh_area_set+0x2df>
lea    0xc87(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2b03(%rip),%rax
mov    (%rax),%edi
lea    0xb97(%rip),%rsi
mov    $0xaf,%edx
jmp    15c3 <do_enh_area_set+0x3e3>
mov    0x2ae9(%rip),%rax
mov    (%rax),%edi
lea    0xba7(%rip),%rsi
mov    %ebx,%edx
mov    $0x8b,%ecx
jmp    1598 <do_enh_area_set+0x3b8>
mov    0x2acd(%rip),%rax
mov    (%rax),%edi
lea    0xb8b(%rip),%rsi
mov    %ebx,%edx
mov    $0x8a,%ecx
jmp    1598 <do_enh_area_set+0x3b8>
mov    0x2ab4(%rip),%rax
mov    (%rax),%edi
lea    0xb72(%rip),%rsi
mov    %ebx,%edx
mov    $0x89,%ecx
jmp    1598 <do_enh_area_set+0x3b8>
mov    0x2a9b(%rip),%rax
mov    (%rax),%edi
lea    0xb59(%rip),%rsi
mov    %ebx,%edx
mov    $0x88,%ecx
jmp    1598 <do_enh_area_set+0x3b8>
mov    0x2a82(%rip),%rax
mov    (%rax),%edi
lea    0xb40(%rip),%rsi
mov    %ebp,%edx
mov    $0x8e,%ecx
jmp    1598 <do_enh_area_set+0x3b8>
mov    0x2a69(%rip),%rax
mov    (%rax),%edi
lea    0xb27(%rip),%rsi
mov    %ebp,%edx
mov    $0x8d,%ecx
jmp    1598 <do_enh_area_set+0x3b8>
mov    0x2a50(%rip),%rax
mov    (%rax),%edi
lea    0xb0e(%rip),%rsi
mov    %ebx,%edx
mov    $0x8c,%ecx
mov    0x8(%rsp),%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2a23(%rip),%rax
mov    (%rax),%edi
lea    0xb0e(%rip),%rsi
mov    $0x9c,%edx
mov    0x8(%rsp),%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [77 x i8] c"Usage: mmc enh_area set <-y|-n> <start KiB> <length KiB> </path/to/mmcblkX>\0A\00"
@.str.1 = [3 x i8] c"-y\00"
@O_RDWR = global i32 0
@.str.2 = [5 x i8] c"open\00"
@.str.3 = [32 x i8] c"Could not read EXT_CSD from %s\0A\00"
@.str.4 = [36 x i8] c" Device cannot have enhanced tech.\0A\00"
@.str.5 = [32 x i8] c" Device is already partitioned\0A\00"
@.str.6 = [42 x i8] c"Could not write 0x1 to EXT_CSD[%d] in %s\0A\00"
@.str.7 = [45 x i8] c"Could not write 0x%02x to EXT_CSD[%d] in %s\0A\00"
@.str.8 = [54 x i8] c"Could not write EXT_CSD_ENH_USR to EXT_CSD[%d] in %s\0A\00"
@.str.9 = [33 x i8] c"Done setting ENH_USR area on %s\0A\00"
define i32 @do_enh_area_set(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca [512 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %10
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 5
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %22
store i32 0, i32* %10
br label %29
29: ; preds = %28, %22
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @strtol(i8* %32, i32* null, i32 10)
store i32 %33, i32* %11
%34 = load i8**, i8*** %4
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @strtol(i8* %36, i32* null, i32 10)
store i32 %37, i32* %12
%38 = load i8**, i8*** %4
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
store i8* %40, i8** %9
%41 = load i8*, i8** %9
%42 = load i32, i32* @O_RDWR
%43 = call i32 @open(i8* %41, i32 %42)
store i32 %43, i32* %7
%44 = load i32, i32* %7
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %29
%47 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %29
%50 = load i32, i32* %7
%51 = getelementptr inbounds [512 x i32], [512 x i32]* %6, i64 0, i64 0
%52 = call i32 @read_extcsd(i32 %50, i32* %51)
store i32 %52, i32* %8
%53 = load i32, i32* %8
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %49
%56 = load i32, i32* @stderr
%57 = load i8*, i8** %9
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %57)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %49
%61 = getelementptr inbounds [512 x i32], [512 x i32]* %6, i64 0, i64 160
%62 = load i32, i32* %61
%63 = and i32 %62, 2
%64 = icmp ne i32 %63, 0
br i1 %64, label %68, label %65
65: ; preds = %60
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %60
%69 = getelementptr inbounds [512 x i32], [512 x i32]* %6, i64 0, i64 155
%70 = load i32, i32* %69
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %68
%76 = getelementptr inbounds [512 x i32], [512 x i32]* %6, i64 0, i64 0
%77 = call i64 @get_hc_wp_grp_size(i32* %76)
%78 = mul nsw i64 512, %77
%79 = getelementptr inbounds [512 x i32], [512 x i32]* %6, i64 0, i64 0
%80 = call i64 @get_hc_erase_grp_size(i32* %79)
%81 = mul nsw i64 %78, %80
store i64 %81, i64* %15
%82 = load i32, i32* %12
%83 = zext i32 %82 to i64
%84 = load i64, i64* %15
%85 = udiv i64 %84, 2
%86 = add i64 %83, %85
%87 = load i64, i64* %15
%88 = udiv i64 %86, %87
%89 = trunc i64 %88 to i32
store i32 %89, i32* %14
%90 = load i32, i32* %11
%91 = mul i32 %90, 1024
%92 = getelementptr inbounds [512 x i32], [512 x i32]* %6, i64 0, i64 0
%93 = call i64 @is_blockaddresed(i32* %92)
%94 = icmp ne i64 %93, 0
%95 = zext i1 %94 to i64
%96 = select i1 %94, i32 512, i32 1
%97 = udiv i32 %91, %96
store i32 %97, i32* %13
%98 = load i64, i64* %15
%99 = load i32, i32* %13
%100 = zext i32 %99 to i64
%101 = udiv i64 %100, %98
%102 = trunc i64 %101 to i32
store i32 %102, i32* %13
%103 = load i64, i64* %15
%104 = load i32, i32* %13
%105 = zext i32 %104 to i64
%106 = mul i64 %105, %103
%107 = trunc i64 %106 to i32
store i32 %107, i32* %13
%108 = load i32, i32* %7
%109 = call i32 @write_extcsd_value(i32 %108, i32 175, i32 1)
store i32 %109, i32* %8
%110 = load i32, i32* %8
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %117
112: ; preds = %75
%113 = load i32, i32* @stderr
%114 = load i8*, i8** %9
%115 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 175, i8* %114)
%116 = call i32 @exit(i32 1)
unreachable
117: ; preds = %75
%118 = load i32, i32* %13
%119 = lshr i32 %118, 24
%120 = and i32 %119, 255
store i32 %120, i32* %5
%121 = load i32, i32* %7
%122 = load i32, i32* %5
%123 = call i32 @write_extcsd_value(i32 %121, i32 139, i32 %122)
store i32 %123, i32* %8
%124 = load i32, i32* %8
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %132
126: ; preds = %117
%127 = load i32, i32* @stderr
%128 = load i32, i32* %5
%129 = load i8*, i8** %9
%130 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %128, i32 139, i8* %129)
%131 = call i32 @exit(i32 1)
unreachable
132: ; preds = %117
%133 = load i32, i32* %13
%134 = lshr i32 %133, 16
%135 = and i32 %134, 255
store i32 %135, i32* %5
%136 = load i32, i32* %7
%137 = load i32, i32* %5
%138 = call i32 @write_extcsd_value(i32 %136, i32 138, i32 %137)
store i32 %138, i32* %8
%139 = load i32, i32* %8
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %147
141: ; preds = %132
%142 = load i32, i32* @stderr
%143 = load i32, i32* %5
%144 = load i8*, i8** %9
%145 = call i32 (i32, i8*, ...) @fprintf(i32 %142, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %143, i32 138, i8* %144)
%146 = call i32 @exit(i32 1)
unreachable
147: ; preds = %132
%148 = load i32, i32* %13
%149 = lshr i32 %148, 8
%150 = and i32 %149, 255
store i32 %150, i32* %5
%151 = load i32, i32* %7
%152 = load i32, i32* %5
%153 = call i32 @write_extcsd_value(i32 %151, i32 137, i32 %152)
store i32 %153, i32* %8
%154 = load i32, i32* %8
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %162
156: ; preds = %147
%157 = load i32, i32* @stderr
%158 = load i32, i32* %5
%159 = load i8*, i8** %9
%160 = call i32 (i32, i8*, ...) @fprintf(i32 %157, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %158, i32 137, i8* %159)
%161 = call i32 @exit(i32 1)
unreachable
162: ; preds = %147
%163 = load i32, i32* %13
%164 = and i32 %163, 255
store i32 %164, i32* %5
%165 = load i32, i32* %7
%166 = load i32, i32* %5
%167 = call i32 @write_extcsd_value(i32 %165, i32 136, i32 %166)
store i32 %167, i32* %8
%168 = load i32, i32* %8
%169 = icmp ne i32 %168, 0
br i1 %169, label %170, label %176
170: ; preds = %162
%171 = load i32, i32* @stderr
%172 = load i32, i32* %5
%173 = load i8*, i8** %9
%174 = call i32 (i32, i8*, ...) @fprintf(i32 %171, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %172, i32 136, i8* %173)
%175 = call i32 @exit(i32 1)
unreachable
176: ; preds = %162
%177 = load i32, i32* %14
%178 = lshr i32 %177, 16
%179 = and i32 %178, 255
store i32 %179, i32* %5
%180 = load i32, i32* %7
%181 = load i32, i32* %5
%182 = call i32 @write_extcsd_value(i32 %180, i32 142, i32 %181)
store i32 %182, i32* %8
%183 = load i32, i32* %8
%184 = icmp ne i32 %183, 0
br i1 %184, label %185, label %191
185: ; preds = %176
%186 = load i32, i32* @stderr
%187 = load i32, i32* %5
%188 = load i8*, i8** %9
%189 = call i32 (i32, i8*, ...) @fprintf(i32 %186, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %187, i32 142, i8* %188)
%190 = call i32 @exit(i32 1)
unreachable
191: ; preds = %176
%192 = load i32, i32* %14
%193 = lshr i32 %192, 8
%194 = and i32 %193, 255
store i32 %194, i32* %5
%195 = load i32, i32* %7
%196 = load i32, i32* %5
%197 = call i32 @write_extcsd_value(i32 %195, i32 141, i32 %196)
store i32 %197, i32* %8
%198 = load i32, i32* %8
%199 = icmp ne i32 %198, 0
br i1 %199, label %200, label %206
200: ; preds = %191
%201 = load i32, i32* @stderr
%202 = load i32, i32* %5
%203 = load i8*, i8** %9
%204 = call i32 (i32, i8*, ...) @fprintf(i32 %201, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %202, i32 141, i8* %203)
%205 = call i32 @exit(i32 1)
unreachable
206: ; preds = %191
%207 = load i32, i32* %14
%208 = and i32 %207, 255
store i32 %208, i32* %5
%209 = load i32, i32* %7
%210 = load i32, i32* %5
%211 = call i32 @write_extcsd_value(i32 %209, i32 140, i32 %210)
store i32 %211, i32* %8
%212 = load i32, i32* %8
%213 = icmp ne i32 %212, 0
br i1 %213, label %214, label %220
214: ; preds = %206
%215 = load i32, i32* @stderr
%216 = load i32, i32* %5
%217 = load i8*, i8** %9
%218 = call i32 (i32, i8*, ...) @fprintf(i32 %215, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %216, i32 140, i8* %217)
%219 = call i32 @exit(i32 1)
unreachable
220: ; preds = %206
%221 = load i32, i32* %7
%222 = call i32 @write_extcsd_value(i32 %221, i32 156, i32 1)
store i32 %222, i32* %8
%223 = load i32, i32* %8
%224 = icmp ne i32 %223, 0
br i1 %224, label %225, label %230
225: ; preds = %220
%226 = load i32, i32* @stderr
%227 = load i8*, i8** %9
%228 = call i32 (i32, i8*, ...) @fprintf(i32 %226, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i32 156, i8* %227)
%229 = call i32 @exit(i32 1)
unreachable
230: ; preds = %220
%231 = load i8*, i8** %9
%232 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %231)
%233 = load i32, i32* %10
%234 = load i8*, i8** %9
%235 = load i32, i32* %7
%236 = call i32 @set_partitioning_setting_completed(i32 %233, i8* %234, i32 %235)
%237 = icmp ne i32 %236, 0
br i1 %237, label %240, label %238
238: ; preds = %230
%239 = call i32 @exit(i32 1)
unreachable
240: ; preds = %230
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [77 x i8] c"Usage: mmc enh_area set <-y|-n> <start KiB> <length KiB> </path/to/mmcblkX>\0A\00"
@.str.1 = [3 x i8] c"-y\00"
@O_RDWR = global i32 0
@.str.2 = [5 x i8] c"open\00"
@.str.3 = [32 x i8] c"Could not read EXT_CSD from %s\0A\00"
@.str.6 = [42 x i8] c"Could not write 0x1 to EXT_CSD[%d] in %s\0A\00"
@.str.7 = [45 x i8] c"Could not write 0x%02x to EXT_CSD[%d] in %s\0A\00"
@.str.8 = [54 x i8] c"Could not write EXT_CSD_ENH_USR to EXT_CSD[%d] in %s\0A\00"
@.str.9 = [33 x i8] c"Done setting ENH_USR area on %s\0A\00"
@str = [35 x i8] c" Device cannot have enhanced tech.\00"
@str.10 = [31 x i8] c" Device is already partitioned\00"
define i32 @do_enh_area_set(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i32]
%4 = bitcast [512 x i32]* %3 to i8*
%5 = icmp eq i32 %0, 5
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* dereferenceable(1) %12)
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i32
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @strtol(i8* nocapture %17, i32* null, i32 10)
%19 = getelementptr inbounds i8*, i8** %1, i64 3
%20 = load i8*, i8** %19
%21 = tail call i32 @strtol(i8* nocapture %20, i32* null, i32 10)
%22 = getelementptr inbounds i8*, i8** %1, i64 4
%23 = load i8*, i8** %22
%24 = load i32, i32* @O_RDWR
%25 = tail call i32 @open(i8* %23, i32 %24)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %10
%28 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %10
%31 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 0
%32 = call i32 @read_extcsd(i32 %25, i32* %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %30
%39 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 160
%40 = load i32, i32* %39
%41 = and i32 %40, 2
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %38
%47 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 155
%48 = load i32, i32* %47
%49 = icmp eq i32 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %46
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %46
%54 = call i64 @get_hc_wp_grp_size(i32* %31)
%55 = shl nsw i64 %54, 9
%56 = call i64 @get_hc_erase_grp_size(i32* %31)
%57 = mul nsw i64 %55, %56
%58 = zext i32 %21 to i64
%59 = lshr exact i64 %57, 1
%60 = add nuw i64 %59, %58
%61 = udiv i64 %60, %57
%62 = trunc i64 %61 to i32
%63 = shl i32 %18, 10
%64 = call i64 @is_blockaddresed(i32* %31)
%65 = icmp eq i64 %64, 0
%66 = select i1 %65, i32 0, i32 9
%67 = lshr i32 %63, %66
%68 = zext i32 %67 to i64
%69 = urem i64 %68, %57
%70 = trunc i64 %69 to i32
%71 = sub i32 %67, %70
%72 = call i32 @write_extcsd_value(i32 %25, i32 175, i32 1)
%73 = icmp eq i32 %72, 0
br i1 %73, label %78, label %74
74: ; preds = %53
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 175, i8* %23)
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %53
%79 = lshr i32 %71, 24
%80 = call i32 @write_extcsd_value(i32 %25, i32 139, i32 %79)
%81 = icmp eq i32 %80, 0
br i1 %81, label %86, label %82
82: ; preds = %78
%83 = load i32, i32* @stderr
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %79, i32 139, i8* %23)
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %78
%87 = lshr i32 %71, 16
%88 = and i32 %87, 255
%89 = call i32 @write_extcsd_value(i32 %25, i32 138, i32 %88)
%90 = icmp eq i32 %89, 0
br i1 %90, label %95, label %91
91: ; preds = %86
%92 = load i32, i32* @stderr
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %88, i32 138, i8* %23)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %86
%96 = lshr i32 %71, 8
%97 = and i32 %96, 255
%98 = call i32 @write_extcsd_value(i32 %25, i32 137, i32 %97)
%99 = icmp eq i32 %98, 0
br i1 %99, label %104, label %100
100: ; preds = %95
%101 = load i32, i32* @stderr
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %97, i32 137, i8* %23)
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %95
%105 = and i32 %71, 255
%106 = call i32 @write_extcsd_value(i32 %25, i32 136, i32 %105)
%107 = icmp eq i32 %106, 0
br i1 %107, label %112, label %108
108: ; preds = %104
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %105, i32 136, i8* %23)
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %104
%113 = lshr i32 %62, 16
%114 = and i32 %113, 255
%115 = call i32 @write_extcsd_value(i32 %25, i32 142, i32 %114)
%116 = icmp eq i32 %115, 0
br i1 %116, label %121, label %117
117: ; preds = %112
%118 = load i32, i32* @stderr
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %114, i32 142, i8* %23)
%120 = call i32 @exit(i32 1)
unreachable
121: ; preds = %112
%122 = lshr i32 %62, 8
%123 = and i32 %122, 255
%124 = call i32 @write_extcsd_value(i32 %25, i32 141, i32 %123)
%125 = icmp eq i32 %124, 0
br i1 %125, label %130, label %126
126: ; preds = %121
%127 = load i32, i32* @stderr
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %123, i32 141, i8* %23)
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %121
%131 = and i32 %62, 255
%132 = call i32 @write_extcsd_value(i32 %25, i32 140, i32 %131)
%133 = icmp eq i32 %132, 0
br i1 %133, label %138, label %134
134: ; preds = %130
%135 = load i32, i32* @stderr
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i32 %131, i32 140, i8* %23)
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %130
%139 = call i32 @write_extcsd_value(i32 %25, i32 156, i32 1)
%140 = icmp eq i32 %139, 0
br i1 %140, label %145, label %141
141: ; preds = %138
%142 = load i32, i32* @stderr
%143 = call i32 (i32, i8*, ...) @fprintf(i32 %142, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i32 156, i8* %23)
%144 = call i32 @exit(i32 1)
unreachable
145: ; preds = %138
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %23)
%147 = call i32 @set_partitioning_setting_completed(i32 %15, i8* %23, i32 %25)
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %151
149: ; preds = %145
%150 = call i32 @exit(i32 1)
unreachable
151: ; preds = %145
ret i32 0
}