#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 */
struct fiemap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dump_fiemap(struct fiemap *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ onestore_migrate(struct fiemap *, char *);
int open(char *, int /*<<< orphan*/);
struct fiemap *read_fiemap(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ syntax(char **);
int main(int argc, char **argv) {
  int i;
  if (argc < 2) {
    syntax(argv);
    exit(EXIT_FAILURE);
  }
  for (i = 1; i < argc; i++) {
    int fd;
    if ((fd = open(argv[i], O_RDONLY)) < 0) {
      fprintf(stderr, "Cannot open file %s\n", argv[i]);
    } else {
      struct fiemap *fiemap;
      if ((fiemap = read_fiemap(fd)) != NULL)
        dump_fiemap(fiemap, argv[i]);
      onestore_migrate(fiemap, argv[i]);
      close(fd);
    }
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11b7 <main+0x37>
mov    -0x10(%rbp),%rdi
call   1070 <syntax@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1271 <main+0xf1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2e0b(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1216 <main+0x96>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdf4(%rip),%rsi
call   1050 <fprintf@plt>
jmp    125e <main+0xde>
mov    -0x18(%rbp),%edi
call   1040 <read_fiemap@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1241 <main+0xc1>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1090 <dump_fiemap@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <onestore_migrate@plt>
mov    -0x18(%rbp),%edi
call   1030 <close@plt>
jmp    1263 <main+0xe3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11be <main+0x3e>
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
cmp    $0x2,%edi
jge    11a9 <main+0x29>
mov    %r15,%rdi
call   1070 <syntax@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    %edi,%r12d
mov    $0x1,%ebx
mov    0x2e30(%rip),%r14
jmp    11e2 <main+0x62>
nopw   0x0(%rax,%rax,1)
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
mov    (%r15,%rbx,8),%rdx
lea    0xe2c(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1224 <main+0xa4>
mov    (%r15,%rbx,8),%rdi
mov    (%r14),%esi
call   1080 <open@plt>
test   %eax,%eax
js     11c0 <main+0x40>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <read_fiemap@plt>
mov    %rax,%r13
test   %rax,%rax
je     120f <main+0x8f>
mov    (%r15,%rbx,8),%rsi
mov    %r13,%rdi
call   1090 <dump_fiemap@plt>
mov    (%r15,%rbx,8),%rsi
mov    %r13,%rdi
call   1060 <onestore_migrate@plt>
mov    %ebp,%edi
call   1030 <close@plt>
jmp    11d9 <main+0x59>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.fiemap = type { i32 }
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"Cannot open file %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.fiemap*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = call i32 @syntax(i8** %12)
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
store i32 1, i32* %6
br label %17
17: ; preds = %61, %16
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %64
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = load i32, i32* @O_RDONLY
%28 = call i32 @open(i8* %26, i32 %27)
store i32 %28, i32* %7
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %38
30: ; preds = %21
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %36)
br label %60
38: ; preds = %21
%39 = load i32, i32* %7
%40 = call %struct.fiemap* @read_fiemap(i32 %39)
store %struct.fiemap* %40, %struct.fiemap** %8
%41 = icmp ne %struct.fiemap* %40, null
br i1 %41, label %42, label %50
42: ; preds = %38
%43 = load %struct.fiemap*, %struct.fiemap** %8
%44 = load i8**, i8*** %5
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @dump_fiemap(%struct.fiemap* %43, i8* %48)
br label %50
50: ; preds = %42, %38
%51 = load %struct.fiemap*, %struct.fiemap** %8
%52 = load i8**, i8*** %5
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @onestore_migrate(%struct.fiemap* %51, i8* %56)
%58 = load i32, i32* %7
%59 = call i32 @close(i32 %58)
br label %60
60: ; preds = %50, %30
br label %61
61: ; preds = %60
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %17
64: ; preds = %17
%65 = load i32, i32* @EXIT_SUCCESS
%66 = call i32 @exit(i32 %65)
unreachable
}

LLVM IR (-O2):
%struct.fiemap = type { i32 }
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"Cannot open file %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %10
6: ; preds = %2
%7 = tail call i32 @syntax(i8** %1)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %4, %31
%11 = phi i64 [ 1, %4 ], [ %32, %31 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = load i32, i32* @O_RDONLY
%15 = tail call i32 @open(i8* %13, i32 %14)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %10
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %12
%20 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %31
21: ; preds = %10
%22 = tail call %struct.fiemap* @read_fiemap(i32 %15)
%23 = icmp eq %struct.fiemap* %22, null
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i8*, i8** %12
%26 = tail call i32 @dump_fiemap(%struct.fiemap* %22, i8* %25)
br label %27
27: ; preds = %24, %21
%28 = load i8*, i8** %12
%29 = tail call i32 @onestore_migrate(%struct.fiemap* %22, i8* %28)
%30 = tail call i32 @close(i32 %15)
br label %31
31: ; preds = %27, %17
%32 = add nuw nsw i64 %11, 1
%33 = icmp eq i64 %32, %5
br i1 %33, label %34, label %10
34: ; preds = %31
%35 = load i32, i32* @EXIT_SUCCESS
%36 = tail call i32 @exit(i32 %35)
unreachable
}