#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 /*<<< orphan*/ uint64_t;

/* Variables and functions */
int do_report_zones_ioctl(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strtoull(char *, char **, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  const char *pathname = "/dev/sdm";
  uint64_t lba = 0;
  char *fname = NULL;
  int rc;
  int ii;
  for (ii = 1; ii < argc; ii++) {
    char *endptr;
    uint64_t tmp = strtoull(argv[ii], &endptr, 0);
    if (0 == *endptr) {
      lba = tmp;
    } else if (!fname) {
      fname = argv[ii];
    }
  }
  rc = do_report_zones_ioctl(fname ? fname : pathname, lba);
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cc <main+0xac>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x38(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtoull@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1199 <main+0x79>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11b9 <main+0x99>
cmpq   $0x0,-0x28(%rbp)
jne    11b4 <main+0x94>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
jmp    11b9 <main+0x99>
jmp    11be <main+0x9e>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1157 <main+0x37>
cmpq   $0x0,-0x28(%rbp)
je     11e4 <main+0xc4>
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    11ec <main+0xcc>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <do_report_zones_ioctl@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     117e <main+0x5e>
mov    %rsi,%rbx
mov    %edi,%r13d
xor    %r14d,%r14d
mov    $0x1,%ebp
mov    %rsp,%r15
xor    %r12d,%r12d
jmp    115c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%r14d
add    $0x1,%rbp
cmp    %rbp,%r13
je     1184 <main+0x64>
mov    (%rbx,%rbp,8),%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <strtoull@plt>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
je     1150 <main+0x30>
test   %r12,%r12
jne    1153 <main+0x33>
mov    (%rbx,%rbp,8),%r12
jmp    1153 <main+0x33>
xor    %r12d,%r12d
xor    %r14d,%r14d
test   %r12,%r12
lea    0xe72(%rip),%rdi
cmovne %r12,%rdi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <do_report_zones_ioctl@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/sdm\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %7
store i8* null, i8** %8
store i32 1, i32* %10
br label %13
13: ; preds = %41, %2
%14 = load i32, i32* %10
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %44
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @strtoull(i8* %22, i8** %11, i32 0)
store i32 %23, i32* %12
%24 = load i8*, i8** %11
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 0, %26
br i1 %27, label %28, label %30
28: ; preds = %17
%29 = load i32, i32* %12
store i32 %29, i32* %7
br label %40
30: ; preds = %17
%31 = load i8*, i8** %8
%32 = icmp ne i8* %31, null
br i1 %32, label %39, label %33
33: ; preds = %30
%34 = load i8**, i8*** %5
%35 = load i32, i32* %10
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
store i8* %38, i8** %8
br label %39
39: ; preds = %33, %30
br label %40
40: ; preds = %39, %28
br label %41
41: ; preds = %40
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %13
44: ; preds = %13
%45 = load i8*, i8** %8
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = load i8*, i8** %8
br label %51
49: ; preds = %44
%50 = load i8*, i8** %6
br label %51
51: ; preds = %49, %47
%52 = phi i8* [ %48, %47 ], [ %50, %49 ]
%53 = load i32, i32* %7
%54 = call i32 @do_report_zones_ioctl(i8* %52, i32 %53)
store i32 %54, i32* %9
%55 = load i32, i32* %9
ret i32 %55
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/sdm\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %27
5: ; preds = %2
%6 = bitcast i8** %3 to i8*
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %5, %22
%9 = phi i64 [ 1, %5 ], [ %25, %22 ]
%10 = phi i32 [ 0, %5 ], [ %24, %22 ]
%11 = phi i8* [ null, %5 ], [ %23, %22 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %9
%13 = load i8*, i8** %12
%14 = call i32 @strtoull(i8* %13, i8** %3, i32 0)
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %8
%19 = icmp eq i8* %11, null
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = load i8*, i8** %12
br label %22
22: ; preds = %8, %18, %20
%23 = phi i8* [ %11, %18 ], [ %21, %20 ], [ %11, %8 ]
%24 = phi i32 [ %10, %18 ], [ %10, %20 ], [ %14, %8 ]
%25 = add nuw nsw i64 %9, 1
%26 = icmp eq i64 %25, %7
br i1 %26, label %27, label %8
27: ; preds = %22, %2
%28 = phi i8* [ null, %2 ], [ %23, %22 ]
%29 = phi i32 [ 0, %2 ], [ %24, %22 ]
%30 = icmp eq i8* %28, null
%31 = select i1 %30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %28
%32 = tail call i32 @do_report_zones_ioctl(i8* %31, i32 %29)
ret i32 %32
}