#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 scalar_t__ uint64_t;

/* Variables and functions */
int format(char *, int, scalar_t__, char *);
scalar_t__ getsize(char *);
int /*<<< orphan*/ instructions();
int /*<<< orphan*/ isalnum(char);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    instructions();
    return 1;
  }
  char volname[16];
  uint64_t sectors;
  int bsize;
  int devicearg;
  devicearg = -1;
  strcpy(volname, "usbstick");
  bsize = 4096;
  int p = 1;
  while (p < argc) {
    if (strcmp(argv[p], "-n") == 0) {
      if (p + 1 >= argc) {
        printf("you need to specify a string if you use -n flag\n");
        return 1;
      }
      int len = strlen(argv[p + 1]);
      if (len < 16) {
        int l, test = 1;
        for (l = 0; l < len; l++)
          if (!isalnum(argv[p + 1][l]))
            test = 0;
        if (!test) {
          printf("volname contains illegal chars\n");
          return 1;
        }
        strcpy(volname, argv[p + 1]);
        p += 2;
      } else {
        printf("volname bigger than 15 letters\n");
        return 1;
      }
    } else if (strcmp(argv[p], "-b") == 0) {
      if (p + 1 >= argc) {
        printf("you are missing the blocksize parameter\n");
        return 1;
      }
      int r = sscanf(argv[p + 1], "%d", &bsize);
      if (bsize < 512 || bsize > 8096) {
        printf("blocksize must be between 512 and 8096.\n");
        return 1;
      }
      if (r == 0 || (bsize != bsize >> 9 << 9)) {
        printf("blocksize is not a valid multiple of 512.\n");
        return 1;
      }
      p += 2;
    } else
      devicearg = p++;
  }
  if (devicearg < 1) {
    printf("you must specify a device to format\n");
    return 1;
  }
  sectors = getsize(argv[devicearg]);
  if (sectors == 0) {
    printf("the device '%s' isn't a valid block device!\n", argv[devicearg]);
    return 2;
  }
  int sw = format(argv[devicearg], bsize, sectors, volname);
  if (sw == 0) {
    printf("Formatting OK.\n");
  } else
    printf("Error occured during formatting: %d\n", sw);
  return sw;
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    11c3 <main+0x33>
mov    $0x0,%al
call   1030 <instructions@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
movl   $0xffffffff,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x1000,-0x2c(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1429 <main+0x299>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe02(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1328 <main+0x198>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     123f <main+0xaf>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x10,-0x38(%rbp)
jge    1309 <main+0x179>
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    12bd <main+0x12d>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1070 <isalnum@plt>
cmp    $0x0,%eax
jne    12aa <main+0x11a>
movl   $0x0,-0x40(%rbp)
jmp    12af <main+0x11f>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1270 <main+0xe0>
cmpl   $0x0,-0x40(%rbp)
jne    12e1 <main+0x151>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
mov    -0x34(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x34(%rbp)
jmp    1323 <main+0x193>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
jmp    1424 <main+0x294>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd42(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1411 <main+0x281>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     1373 <main+0x1e3>
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd1e(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x200,-0x2c(%rbp)
jl     13b1 <main+0x221>
cmpl   $0x1fa0,-0x2c(%rbp)
jle    13cb <main+0x23b>
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
cmpl   $0x0,-0x44(%rbp)
je     13e9 <main+0x259>
mov    -0x2c(%rbp),%eax
mov    -0x2c(%rbp),%ecx
sar    $0x9,%ecx
shl    $0x9,%ecx
cmp    %ecx,%eax
je     1403 <main+0x273>
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
mov    -0x34(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x34(%rbp)
jmp    141f <main+0x28f>
mov    -0x34(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
mov    %eax,-0x30(%rbp)
jmp    1424 <main+0x294>
jmp    11e8 <main+0x58>
cmpl   $0x1,-0x30(%rbp)
jge    144d <main+0x2bd>
lea    0xcc6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e6 <main+0x356>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10b0 <getsize@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1493 <main+0x303>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xca5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14e6 <main+0x356>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1090 <format@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    14cf <main+0x33f>
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14e0 <main+0x350>
mov    -0x48(%rbp),%esi
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%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
sub    $0x28,%rsp
cmp    $0x1,%edi
jg     11bf <main+0x1f>
xor    %eax,%eax
call   1030 <instructions@plt>
jmp    13c1 <main+0x221>
mov    %rsi,%rbx
mov    %edi,%r15d
lea    0xe34(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1040 <strcpy@plt>
movl   $0x1000,0x4(%rsp)
mov    $0x1,%r14d
mov    $0xffffffff,%r13d
lea    0xe18(%rip),%r12
mov    %r15d,0x8(%rsp)
jmp    120f <main+0x6f>
nopl   0x0(%rax,%rax,1)
mov    %r14d,%r13d
mov    %ebp,%r14d
cmp    %r15d,%ebp
jge    1331 <main+0x191>
movslq %r14d,%rbp
mov    (%rbx,%rbp,8),%rdi
mov    %r12,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12a0 <main+0x100>
mov    (%rbx,%rbp,8),%rdi
lea    0xdde(%rip),%rsi
call   1090 <strcmp@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    1200 <main+0x60>
cmp    %r15d,%ebp
jge    139a <main+0x1fa>
movslq %ebp,%rax
mov    (%rbx,%rax,8),%rdi
lea    0xdbd(%rip),%rsi
lea    0x4(%rsp),%rdx
call   10b0 <sscanf@plt>
mov    0x4(%rsp),%ecx
lea    -0x1fa1(%rcx),%edx
cmp    $0xffffe25e,%edx
jbe    13a3 <main+0x203>
test   %eax,%eax
je     13ac <main+0x20c>
mov    %ecx,%eax
and    $0xfffffe00,%eax
cmp    %eax,%ecx
jne    13ac <main+0x20c>
add    $0x2,%r14d
mov    %r14d,%ebp
jmp    1203 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%r14),%eax
cmp    %r15d,%eax
jge    137f <main+0x1df>
movslq %eax,%r12
mov    (%rbx,%r12,8),%rdi
call   1060 <strlen@plt>
cmp    $0xf,%eax
jg     1388 <main+0x1e8>
test   %eax,%eax
jle    1310 <main+0x170>
mov    %r13d,0xc(%rsp)
mov    %eax,%ebp
mov    $0x1,%r15d
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx,%r12,8),%rax
movsbl (%rax,%r13,1),%edi
call   1080 <isalnum@plt>
test   %eax,%eax
cmove  %eax,%r15d
add    $0x1,%r13
cmp    %r13,%rbp
jne    12e0 <main+0x140>
test   %r15d,%r15d
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%r13d
je     13b5 <main+0x215>
mov    (%rbx,%r12,8),%rsi
lea    0x10(%rsp),%rdi
call   1040 <strcpy@plt>
add    $0x2,%r14d
mov    %r14d,%ebp
lea    0xcdd(%rip),%r12
jmp    1203 <main+0x63>
test   %r13d,%r13d
jle    1391 <main+0x1f1>
mov    %r13d,%ebp
mov    (%rbx,%rbp,8),%rdi
call   10c0 <getsize@plt>
mov    (%rbx,%rbp,8),%rdx
test   %rax,%rax
je     13d7 <main+0x237>
mov    0x4(%rsp),%esi
lea    0x10(%rsp),%rcx
mov    %rdx,%rdi
mov    %rax,%rdx
call   10a0 <format@plt>
test   %eax,%eax
je     13ef <main+0x24f>
mov    %eax,%ebx
lea    0xccb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    13c6 <main+0x226>
lea    0xdc9(%rip),%rdi
jmp    13bc <main+0x21c>
lea    0xd82(%rip),%rdi
jmp    13bc <main+0x21c>
lea    0xcdb(%rip),%rdi
jmp    13bc <main+0x21c>
lea    0xd48(%rip),%rdi
jmp    13bc <main+0x21c>
lea    0xd17(%rip),%rdi
jmp    13bc <main+0x21c>
lea    0xce4(%rip),%rdi
jmp    13bc <main+0x21c>
lea    0xd74(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc34(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%ebx
jmp    13c6 <main+0x226>
lea    0xc6e(%rip),%rdi
call   1050 <puts@plt>
xor    %ebx,%ebx
jmp    13c6 <main+0x226>

LLVM IR (-O0):
@.str = [9 x i8] c"usbstick\00"
@.str.1 = [3 x i8] c"-n\00"
@.str.2 = [49 x i8] c"you need to specify a string if you use -n flag\0A\00"
@.str.3 = [32 x i8] c"volname contains illegal chars\0A\00"
@.str.4 = [32 x i8] c"volname bigger than 15 letters\0A\00"
@.str.5 = [3 x i8] c"-b\00"
@.str.6 = [41 x i8] c"you are missing the blocksize parameter\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [41 x i8] c"blocksize must be between 512 and 8096.\0A\00"
@.str.9 = [43 x i8] c"blocksize is not a valid multiple of 512.\0A\00"
@.str.10 = [37 x i8] c"you must specify a device to format\0A\00"
@.str.11 = [45 x i8] c"the device '%s' isn't a valid block device!\0A\00"
@.str.12 = [16 x i8] c"Formatting OK.\0A\00"
@.str.13 = [37 x i8] c"Error occured during formatting: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (...) @instructions()
store i32 1, i32* %3
br label %183
20: ; preds = %2
store i32 -1, i32* %9
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%22 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 4096, i32* %8
store i32 1, i32* %10
br label %23
23: ; preds = %142, %20
%24 = load i32, i32* %10
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %143
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %94
35: ; preds = %27
%36 = load i32, i32* %10
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %4
%39 = icmp sge i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %183
42: ; preds = %35
%43 = load i8**, i8*** %5
%44 = load i32, i32* %10
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %43, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @strlen(i8* %48)
store i32 %49, i32* %11
%50 = load i32, i32* %11
%51 = icmp slt i32 %50, 16
br i1 %51, label %52, label %91
52: ; preds = %42
store i32 1, i32* %13
store i32 0, i32* %12
br label %53
53: ; preds = %72, %52
%54 = load i32, i32* %12
%55 = load i32, i32* %11
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %75
57: ; preds = %53
%58 = load i8**, i8*** %5
%59 = load i32, i32* %10
%60 = add nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %58, i64 %61
%63 = load i8*, i8** %62
%64 = load i32, i32* %12
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
%67 = load i8, i8* %66
%68 = call i32 @isalnum(i8 signext %67)
%69 = icmp ne i32 %68, 0
br i1 %69, label %71, label %70
70: ; preds = %57
store i32 0, i32* %13
br label %71
71: ; preds = %70, %57
br label %72
72: ; preds = %71
%73 = load i32, i32* %12
%74 = add nsw i32 %73, 1
store i32 %74, i32* %12
br label %53
75: ; preds = %53
%76 = load i32, i32* %13
%77 = icmp ne i32 %76, 0
br i1 %77, label %80, label %78
78: ; preds = %75
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %183
80: ; preds = %75
%81 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%82 = load i8**, i8*** %5
%83 = load i32, i32* %10
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %82, i64 %85
%87 = load i8*, i8** %86
%88 = call i32 @strcpy(i8* %81, i8* %87)
%89 = load i32, i32* %10
%90 = add nsw i32 %89, 2
store i32 %90, i32* %10
br label %93
91: ; preds = %42
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %183
93: ; preds = %80
br label %142
94: ; preds = %27
%95 = load i8**, i8*** %5
%96 = load i32, i32* %10
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %95, i64 %97
%99 = load i8*, i8** %98
%100 = call i64 @strcmp(i8* %99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %138
102: ; preds = %94
%103 = load i32, i32* %10
%104 = add nsw i32 %103, 1
%105 = load i32, i32* %4
%106 = icmp sge i32 %104, %105
br i1 %106, label %107, label %109
107: ; preds = %102
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %183
109: ; preds = %102
%110 = load i8**, i8*** %5
%111 = load i32, i32* %10
%112 = add nsw i32 %111, 1
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8*, i8** %110, i64 %113
%115 = load i8*, i8** %114
%116 = call i32 @sscanf(i8* %115, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %8)
store i32 %116, i32* %14
%117 = load i32, i32* %8
%118 = icmp slt i32 %117, 512
br i1 %118, label %122, label %119
119: ; preds = %109
%120 = load i32, i32* %8
%121 = icmp sgt i32 %120, 8096
br i1 %121, label %122, label %124
122: ; preds = %119, %109
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %183
124: ; preds = %119
%125 = load i32, i32* %14
%126 = icmp eq i32 %125, 0
br i1 %126, label %133, label %127
127: ; preds = %124
%128 = load i32, i32* %8
%129 = load i32, i32* %8
%130 = ashr i32 %129, 9
%131 = shl i32 %130, 9
%132 = icmp ne i32 %128, %131
br i1 %132, label %133, label %135
133: ; preds = %127, %124
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %183
135: ; preds = %127
%136 = load i32, i32* %10
%137 = add nsw i32 %136, 2
store i32 %137, i32* %10
br label %141
138: ; preds = %94
%139 = load i32, i32* %10
%140 = add nsw i32 %139, 1
store i32 %140, i32* %10
store i32 %139, i32* %9
br label %141
141: ; preds = %138, %135
br label %142
142: ; preds = %141, %93
br label %23
143: ; preds = %23
%144 = load i32, i32* %9
%145 = icmp slt i32 %144, 1
br i1 %145, label %146, label %148
146: ; preds = %143
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %183
148: ; preds = %143
%149 = load i8**, i8*** %5
%150 = load i32, i32* %9
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i8*, i8** %149, i64 %151
%153 = load i8*, i8** %152
%154 = call i64 @getsize(i8* %153)
store i64 %154, i64* %7
%155 = load i64, i64* %7
%156 = icmp eq i64 %155, 0
br i1 %156, label %157, label %164
157: ; preds = %148
%158 = load i8**, i8*** %5
%159 = load i32, i32* %9
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8*, i8** %158, i64 %160
%162 = load i8*, i8** %161
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i8* %162)
store i32 2, i32* %3
br label %183
164: ; preds = %148
%165 = load i8**, i8*** %5
%166 = load i32, i32* %9
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i8*, i8** %165, i64 %167
%169 = load i8*, i8** %168
%170 = load i32, i32* %8
%171 = load i64, i64* %7
%172 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%173 = call i32 @format(i8* %169, i32 %170, i64 %171, i8* %172)
store i32 %173, i32* %15
%174 = load i32, i32* %15
%175 = icmp eq i32 %174, 0
br i1 %175, label %176, label %178
176: ; preds = %164
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
br label %181
178: ; preds = %164
%179 = load i32, i32* %15
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %179)
br label %181
181: ; preds = %178, %176
%182 = load i32, i32* %15
store i32 %182, i32* %3
br label %183
183: ; preds = %181, %157, %146, %133, %122, %107, %91, %78, %40, %18
%184 = load i32, i32* %3
ret i32 %184
}

LLVM IR (-O2):
@.str = [9 x i8] c"usbstick\00"
@.str.1 = [3 x i8] c"-n\00"
@.str.5 = [3 x i8] c"-b\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.11 = [45 x i8] c"the device '%s' isn't a valid block device!\0A\00"
@.str.13 = [37 x i8] c"Error occured during formatting: %d\0A\00"
@str = [15 x i8] c"Formatting OK.\00"
@str.14 = [36 x i8] c"you must specify a device to format\00"
@str.15 = [42 x i8] c"blocksize is not a valid multiple of 512.\00"
@str.16 = [40 x i8] c"blocksize must be between 512 and 8096.\00"
@str.17 = [40 x i8] c"you are missing the blocksize parameter\00"
@str.18 = [31 x i8] c"volname bigger than 15 letters\00"
@str.19 = [31 x i8] c"volname contains illegal chars\00"
@str.20 = [48 x i8] c"you need to specify a string if you use -n flag\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca i32
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @instructions()
br label %111
8: ; preds = %2
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%10 = bitcast i32* %4 to i8*
%11 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 4096, i32* %4
br label %12
12: ; preds = %8, %84
%13 = phi i32 [ %86, %84 ], [ -1, %8 ]
%14 = phi i32 [ %85, %84 ], [ 1, %8 ]
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %56
20: ; preds = %12
%21 = add nsw i32 %14, 1
%22 = icmp slt i32 %21, %0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.20, i64 0, i64 0))
br label %109
25: ; preds = %20
%26 = sext i32 %21 to i64
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strlen(i8* %28)
%30 = icmp slt i32 %29, 16
br i1 %30, label %31, label %50
31: ; preds = %25
%32 = icmp sgt i32 %29, 0
br i1 %32, label %33, label %52
33: ; preds = %31
%34 = zext i32 %29 to i64
br label %35
35: ; preds = %33, %35
%36 = phi i64 [ 0, %33 ], [ %44, %35 ]
%37 = phi i32 [ 1, %33 ], [ %43, %35 ]
%38 = load i8*, i8** %27
%39 = getelementptr inbounds i8, i8* %38, i64 %36
%40 = load i8, i8* %39
%41 = call i32 @isalnum(i8 signext %40)
%42 = icmp eq i32 %41, 0
%43 = select i1 %42, i32 0, i32 %37
%44 = add nuw nsw i64 %36, 1
%45 = icmp eq i64 %44, %34
br i1 %45, label %46, label %35
46: ; preds = %35
%47 = icmp eq i32 %43, 0
br i1 %47, label %48, label %52
48: ; preds = %46
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.19, i64 0, i64 0))
br label %109
50: ; preds = %25
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.18, i64 0, i64 0))
br label %109
52: ; preds = %31, %46
%53 = load i8*, i8** %27
%54 = call i32 @strcpy(i8* %9, i8* %53)
%55 = add nsw i32 %14, 2
br label %84
56: ; preds = %12
%57 = load i8*, i8** %16
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
%60 = add nsw i32 %14, 1
br i1 %59, label %61, label %84
61: ; preds = %56
%62 = icmp slt i32 %60, %0
br i1 %62, label %65, label %63
63: ; preds = %61
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.17, i64 0, i64 0))
br label %109
65: ; preds = %61
%66 = sext i32 %60 to i64
%67 = getelementptr inbounds i8*, i8** %1, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @sscanf(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%70 = load i32, i32* %4
%71 = add i32 %70, -8097
%72 = icmp ult i32 %71, -7585
br i1 %72, label %73, label %75
73: ; preds = %65
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.16, i64 0, i64 0))
br label %109
75: ; preds = %65
%76 = icmp ne i32 %69, 0
%77 = and i32 %70, -512
%78 = icmp eq i32 %70, %77
%79 = select i1 %76, i1 %78, i1 false
br i1 %79, label %82, label %80
80: ; preds = %75
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.15, i64 0, i64 0))
br label %109
82: ; preds = %75
%83 = add nsw i32 %14, 2
br label %84
84: ; preds = %56, %82, %52
%85 = phi i32 [ %55, %52 ], [ %83, %82 ], [ %60, %56 ]
%86 = phi i32 [ %13, %52 ], [ %13, %82 ], [ %14, %56 ]
%87 = icmp slt i32 %85, %0
br i1 %87, label %12, label %88
88: ; preds = %84
%89 = icmp slt i32 %86, 1
br i1 %89, label %90, label %92
90: ; preds = %88
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.14, i64 0, i64 0))
br label %109
92: ; preds = %88
%93 = zext i32 %86 to i64
%94 = getelementptr inbounds i8*, i8** %1, i64 %93
%95 = load i8*, i8** %94
%96 = call i64 @getsize(i8* %95)
%97 = icmp eq i64 %96, 0
%98 = load i8*, i8** %94
br i1 %97, label %99, label %101
99: ; preds = %92
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i8* %98)
br label %109
101: ; preds = %92
%102 = load i32, i32* %4
%103 = call i32 @format(i8* %98, i32 %102, i64 %96, i8* %9)
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %101
%106 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %109
107: ; preds = %101
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %103)
br label %109
109: ; preds = %73, %80, %48, %50, %105, %107, %99, %90, %63, %23
%110 = phi i32 [ 1, %23 ], [ 1, %63 ], [ 1, %90 ], [ 2, %99 ], [ %103, %107 ], [ 0, %105 ], [ 1, %50 ], [ 1, %48 ], [ 1, %80 ], [ 1, %73 ]
br label %111
111: ; preds = %109, %6
%112 = phi i32 [ 1, %6 ], [ %110, %109 ]
ret i32 %112
}