#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 /*<<< orphan*/ do_report_zones_ioctl(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strtoull(char *, char **, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  const char *pathname = "/mnt/testb/x/blah.txt";
  uint64_t lba = 0;
  char *fname = NULL;
  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];
    }
  }
  do_report_zones_ioctl(fname ? fname : pathname, lba);
  return 0;
}


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,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cc <main+0xac>
mov    -0x10(%rbp),%rax
movslq -0x2c(%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 -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
jmp    11b9 <main+0x99>
jmp    11be <main+0x9e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%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>
xor    %eax,%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
call   1040 <do_report_zones_ioctl@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"/mnt/testb/x/blah.txt\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 ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %28
%32 = tail call i32 @do_report_zones_ioctl(i8* %31, i32 %29)
ret i32 0
}