#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct atmif_sioc {
  int number;
  int length;
  TYPE_2__ *arg;
};
struct TYPE_3__ {
  int min;
  int init;
  int max;
};
struct TYPE_4__ {
  TYPE_1__ level;
  void *buftype;
};
typedef TYPE_2__ pool_levels;
typedef int /*<<< orphan*/ pl;

/* Variables and functions */
int /*<<< orphan*/ NS_ADJBUFLEV;
void *NS_BUFTYPE_HUGE;
void *NS_BUFTYPE_IOVEC;
void *NS_BUFTYPE_LARGE;
void *NS_BUFTYPE_SMALL;
int /*<<< orphan*/ NS_SETBUFLEV;
int /*<<< orphan*/ PF_ATMPVC;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ ioctl(int, int /*<<< orphan*/, struct atmif_sioc *);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int strtol(char *, char **, int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  char *name, *end;
  int itf, min, init, max;
  int s;
  pool_levels pl;
  int btype;
  struct atmif_sioc sioc;
  name = argv[0];
  if (argc != 6 && argc != 3)
    usage(name);
  itf = strtol(argv[1], &end, 0);
  if (end == argv[1] || itf < 0)
    usage(name);
  if (argc == 6) {
    min = strtol(argv[3], &end, 0);
    if (end == argv[3] || min <= 0)
      usage(name);
    init = strtol(argv[4], &end, 0);
    if (end == argv[4] || init <= 0)
      usage(name);
    max = strtol(argv[5], &end, 0);
    if (end == argv[5] || max <= 0)
      usage(name);
    if (min >= init || init >= max)
      usage(name);
    switch (*argv[2]) {
    case 's':
      pl.buftype = NS_BUFTYPE_SMALL;
      break;
    case 'l':
      pl.buftype = NS_BUFTYPE_LARGE;
      break;
    case 'h':
      pl.buftype = NS_BUFTYPE_HUGE;
      break;
    case 'i':
      pl.buftype = NS_BUFTYPE_IOVEC;
      break;
    default:
      usage(name);
    }
    sioc.number = itf;
    sioc.arg = &pl;
    sioc.length = sizeof(pl);
    pl.level.min = min;
    pl.level.init = init;
    pl.level.max = max;
    s = socket(PF_ATMPVC, SOCK_DGRAM, 0);
    if (s < 0) {
      perror("socket");
      return 2;
    }
    if (ioctl(s, NS_SETBUFLEV, &sioc) < 0) {
      perror("ioctl NS_SETBUFLEV");
      return 3;
    }
  } else {
    switch (*argv[2]) {
    case 's':
      btype = NS_BUFTYPE_SMALL;
      break;
    case 'l':
      btype = NS_BUFTYPE_LARGE;
      break;
    case 'h':
      btype = NS_BUFTYPE_HUGE;
      break;
    case 'i':
      btype = NS_BUFTYPE_IOVEC;
      break;
    default:
      usage(name);
    }
    sioc.number = itf;
    sioc.arg = (void *)btype;
    sioc.length = sizeof(void *);
    s = socket(PF_ATMPVC, SOCK_DGRAM, 0);
    if (s < 0) {
      perror("socket");
      return 2;
    }
    if (ioctl(s, NS_ADJBUFLEV, &sioc) < 0) {
      perror("ioctl NS_ADJBUFLEV");
      return 3;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x6,-0x8(%rbp)
je     1191 <main+0x41>
cmpl   $0x3,-0x8(%rbp)
je     1191 <main+0x41>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     11c3 <main+0x73>
cmpl   $0x0,-0x24(%rbp)
jge    11cc <main+0x7c>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
cmpl   $0x6,-0x8(%rbp)
jne    13cf <main+0x27f>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x18(%rcx),%rax
je     1208 <main+0xb8>
cmpl   $0x0,-0x28(%rbp)
jg     1211 <main+0xc1>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x20(%rcx),%rax
je     1243 <main+0xf3>
cmpl   $0x0,-0x2c(%rbp)
jg     124c <main+0xfc>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x28(%rcx),%rax
je     127e <main+0x12e>
cmpl   $0x0,-0x30(%rbp)
jg     1287 <main+0x137>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    129f <main+0x14f>
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jl     12a8 <main+0x158>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
add    $0xffffff98,%eax
mov    %eax,%ecx
mov    %rcx,-0x70(%rbp)
sub    $0xb,%eax
ja     1325 <main+0x1d5>
mov    -0x70(%rbp),%rax
lea    0xd60(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2cd0(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    132e <main+0x1de>
mov    0x2ccd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    132e <main+0x1de>
mov    0x2cb2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    132e <main+0x1de>
mov    0x2caf(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    132e <main+0x1de>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x68(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x18,-0x64(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    0x2c8c(%rip),%rax
mov    (%rax),%edi
mov    0x2c73(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1070 <socket@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1393 <main+0x243>
lea    0xcde(%rip),%rdi
call   1060 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    14e7 <main+0x397>
mov    -0x34(%rbp),%edi
mov    0x2c0b(%rip),%rax
mov    (%rax),%esi
lea    -0x68(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    13ca <main+0x27a>
lea    0xcae(%rip),%rdi
call   1060 <perror@plt>
movl   $0x3,-0x4(%rbp)
jmp    14e7 <main+0x397>
jmp    14e0 <main+0x390>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
add    $0xffffff98,%eax
mov    %eax,%ecx
mov    %rcx,-0x78(%rbp)
sub    $0xb,%eax
ja     1448 <main+0x2f8>
mov    -0x78(%rbp),%rax
lea    0xc09(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2ba9(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x54(%rbp)
jmp    1451 <main+0x301>
mov    0x2ba7(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x54(%rbp)
jmp    1451 <main+0x301>
mov    0x2b8d(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x54(%rbp)
jmp    1451 <main+0x301>
mov    0x2b8b(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x54(%rbp)
jmp    1451 <main+0x301>
mov    -0x18(%rbp),%rdi
call   1050 <usage@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x68(%rbp)
movslq -0x54(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x8,-0x64(%rbp)
mov    0x2b7b(%rip),%rax
mov    (%rax),%edi
mov    0x2b62(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1070 <socket@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    14a4 <main+0x354>
lea    0xbcd(%rip),%rdi
call   1060 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    14e7 <main+0x397>
mov    -0x34(%rbp),%edi
mov    0x2b4a(%rip),%rax
mov    (%rax),%esi
lea    -0x68(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    14db <main+0x38b>
lea    0xbb0(%rip),%rdi
call   1060 <perror@plt>
movl   $0x3,-0x4(%rbp)
jmp    14e7 <main+0x397>
jmp    14e0 <main+0x390>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
mov    (%rsi),%r12
cmp    $0x3,%edi
je     1178 <main+0x28>
cmp    $0x6,%ebx
je     1178 <main+0x28>
mov    %r12,%rdi
call   1050 <usage@plt>
mov    0x8(%rbp),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%rax
cmp    0x8(%rbp),%rax
je     1265 <main+0x115>
test   %r14d,%r14d
js     1265 <main+0x115>
cmp    $0x6,%ebx
jne    1276 <main+0x126>
mov    0x18(%rbp),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,%r15d
mov    0x8(%rsp),%rax
cmp    0x18(%rbp),%rax
je     11cf <main+0x7f>
test   %r15d,%r15d
jg     11d7 <main+0x87>
mov    %r12,%rdi
call   1050 <usage@plt>
mov    0x20(%rbp),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rax
cmp    0x20(%rbp),%rax
je     11f8 <main+0xa8>
test   %ebx,%ebx
jg     1200 <main+0xb0>
mov    %r12,%rdi
call   1050 <usage@plt>
mov    0x28(%rbp),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,%r13d
mov    0x8(%rsp),%rax
cmp    0x28(%rbp),%rax
je     1223 <main+0xd3>
test   %r13d,%r13d
jg     122b <main+0xdb>
mov    %r12,%rdi
call   1050 <usage@plt>
cmp    %ebx,%r15d
jge    1235 <main+0xe5>
cmp    %r13d,%ebx
jl     123d <main+0xed>
mov    %r12,%rdi
call   1050 <usage@plt>
mov    0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffff98,%eax
cmp    $0xb,%eax
ja     12ae <main+0x15e>
lea    0xddd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d55(%rip),%rax
jmp    12c8 <main+0x178>
mov    %r12,%rdi
call   1050 <usage@plt>
cmp    $0x6,%ebx
je     11ac <main+0x5c>
mov    0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffff98,%eax
cmp    $0xb,%eax
ja     134b <main+0x1fb>
lea    0xd70(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d18(%rip),%rax
jmp    1367 <main+0x217>
mov    0x2d1c(%rip),%rax
jmp    12c8 <main+0x178>
mov    %r12,%rdi
call   1050 <usage@plt>
jmp    12d0 <main+0x180>
mov    0x2d01(%rip),%rax
jmp    12c8 <main+0x178>
mov    0x2ce8(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
mov    %r14d,0x10(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,0x18(%rsp)
movl   $0x18,0x14(%rsp)
mov    %r15d,0x20(%rsp)
mov    %ebx,0x24(%rsp)
mov    %r13d,0x28(%rsp)
mov    0x2cec(%rip),%rax
mov    (%rax),%edi
mov    0x2cd3(%rip),%rax
mov    (%rax),%esi
xor    %ebx,%ebx
xor    %edx,%edx
call   1070 <socket@plt>
test   %eax,%eax
js     13c8 <main+0x278>
mov    0x2c89(%rip),%rcx
mov    (%rcx),%esi
lea    0x10(%rsp),%rdx
mov    %eax,%edi
call   1030 <ioctl@plt>
test   %rax,%rax
jns    13b7 <main+0x267>
lea    0xd2a(%rip),%rdi
jmp    13e2 <main+0x292>
mov    0x2c7f(%rip),%rax
jmp    1367 <main+0x217>
mov    %r12,%rdi
call   1050 <usage@plt>
xor    %eax,%eax
jmp    136a <main+0x21a>
mov    0x2c62(%rip),%rax
jmp    1367 <main+0x217>
mov    0x2c49(%rip),%rax
mov    (%rax),%rax
mov    %r14d,0x10(%rsp)
cltq
mov    %rax,0x18(%rsp)
movl   $0x8,0x14(%rsp)
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
xor    %ebx,%ebx
xor    %edx,%edx
call   1070 <socket@plt>
test   %eax,%eax
js     13c8 <main+0x278>
mov    0x2c54(%rip),%rcx
mov    (%rcx),%esi
lea    0x10(%rsp),%rdx
mov    %eax,%edi
call   1030 <ioctl@plt>
test   %rax,%rax
js     13db <main+0x28b>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc91(%rip),%rdi
call   1060 <perror@plt>
mov    $0x2,%ebx
jmp    13b7 <main+0x267>
lea    0xc98(%rip),%rdi
call   1060 <perror@plt>
mov    $0x3,%ebx
jmp    13b7 <main+0x267>

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__, i8* }
%struct.TYPE_3__ = type { i32, i32, i32 }
%struct.atmif_sioc = type { i32, i32, %struct.TYPE_4__* }
@NS_BUFTYPE_SMALL = global i8* null
@NS_BUFTYPE_LARGE = global i8* null
@NS_BUFTYPE_HUGE = global i8* null
@NS_BUFTYPE_IOVEC = global i8* null
@PF_ATMPVC = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [7 x i8] c"socket\00"
@NS_SETBUFLEV = global i32 0
@.str.1 = [19 x i8] c"ioctl NS_SETBUFLEV\00"
@NS_ADJBUFLEV = global i32 0
@.str.2 = [19 x i8] c"ioctl NS_ADJBUFLEV\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.TYPE_4__
%14 = alloca i32
%15 = alloca %struct.atmif_sioc
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
store i8* %18, i8** %6
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 6
br i1 %20, label %21, label %27
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 3
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = call i32 @usage(i8* %25)
br label %27
27: ; preds = %24, %21, %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strtol(i8* %30, i8** %7, i32 0)
store i32 %31, i32* %8
%32 = load i8*, i8** %7
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = icmp eq i8* %32, %35
br i1 %36, label %40, label %37
37: ; preds = %27
%38 = load i32, i32* %8
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %37, %27
%41 = load i8*, i8** %6
%42 = call i32 @usage(i8* %41)
br label %43
43: ; preds = %40, %37
%44 = load i32, i32* %4
%45 = icmp eq i32 %44, 6
br i1 %45, label %46, label %155
46: ; preds = %43
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 3
%49 = load i8*, i8** %48
%50 = call i32 @strtol(i8* %49, i8** %7, i32 0)
store i32 %50, i32* %9
%51 = load i8*, i8** %7
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
%55 = icmp eq i8* %51, %54
br i1 %55, label %59, label %56
56: ; preds = %46
%57 = load i32, i32* %9
%58 = icmp sle i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56, %46
%60 = load i8*, i8** %6
%61 = call i32 @usage(i8* %60)
br label %62
62: ; preds = %59, %56
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 4
%65 = load i8*, i8** %64
%66 = call i32 @strtol(i8* %65, i8** %7, i32 0)
store i32 %66, i32* %10
%67 = load i8*, i8** %7
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 4
%70 = load i8*, i8** %69
%71 = icmp eq i8* %67, %70
br i1 %71, label %75, label %72
72: ; preds = %62
%73 = load i32, i32* %10
%74 = icmp sle i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %72, %62
%76 = load i8*, i8** %6
%77 = call i32 @usage(i8* %76)
br label %78
78: ; preds = %75, %72
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 5
%81 = load i8*, i8** %80
%82 = call i32 @strtol(i8* %81, i8** %7, i32 0)
store i32 %82, i32* %11
%83 = load i8*, i8** %7
%84 = load i8**, i8*** %5
%85 = getelementptr inbounds i8*, i8** %84, i64 5
%86 = load i8*, i8** %85
%87 = icmp eq i8* %83, %86
br i1 %87, label %91, label %88
88: ; preds = %78
%89 = load i32, i32* %11
%90 = icmp sle i32 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %88, %78
%92 = load i8*, i8** %6
%93 = call i32 @usage(i8* %92)
br label %94
94: ; preds = %91, %88
%95 = load i32, i32* %9
%96 = load i32, i32* %10
%97 = icmp sge i32 %95, %96
br i1 %97, label %102, label %98
98: ; preds = %94
%99 = load i32, i32* %10
%100 = load i32, i32* %11
%101 = icmp sge i32 %99, %100
br i1 %101, label %102, label %105
102: ; preds = %98, %94
%103 = load i8*, i8** %6
%104 = call i32 @usage(i8* %103)
br label %105
105: ; preds = %102, %98
%106 = load i8**, i8*** %5
%107 = getelementptr inbounds i8*, i8** %106, i64 2
%108 = load i8*, i8** %107
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
switch i32 %110, label %123 [
i32 115, label %111
i32 108, label %114
i32 104, label %117
i32 105, label %120
]
111: ; preds = %105
%112 = load i8*, i8** @NS_BUFTYPE_SMALL
%113 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 1
store i8* %112, i8** %113
br label %126
114: ; preds = %105
%115 = load i8*, i8** @NS_BUFTYPE_LARGE
%116 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 1
store i8* %115, i8** %116
br label %126
117: ; preds = %105
%118 = load i8*, i8** @NS_BUFTYPE_HUGE
%119 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 1
store i8* %118, i8** %119
br label %126
120: ; preds = %105
%121 = load i8*, i8** @NS_BUFTYPE_IOVEC
%122 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 1
store i8* %121, i8** %122
br label %126
123: ; preds = %105
%124 = load i8*, i8** %6
%125 = call i32 @usage(i8* %124)
br label %126
126: ; preds = %123, %120, %117, %114, %111
%127 = load i32, i32* %8
%128 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %15, i32 0, i32 0
store i32 %127, i32* %128
%129 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %15, i32 0, i32 2
store %struct.TYPE_4__* %13, %struct.TYPE_4__** %129
%130 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %15, i32 0, i32 1
store i32 24, i32* %130
%131 = load i32, i32* %9
%132 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%133 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %132, i32 0, i32 0
store i32 %131, i32* %133
%134 = load i32, i32* %10
%135 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%136 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %135, i32 0, i32 1
store i32 %134, i32* %136
%137 = load i32, i32* %11
%138 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%139 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %138, i32 0, i32 2
store i32 %137, i32* %139
%140 = load i32, i32* @PF_ATMPVC
%141 = load i32, i32* @SOCK_DGRAM
%142 = call i32 @socket(i32 %140, i32 %141, i32 0)
store i32 %142, i32* %12
%143 = load i32, i32* %12
%144 = icmp slt i32 %143, 0
br i1 %144, label %145, label %147
145: ; preds = %126
%146 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %3
br label %201
147: ; preds = %126
%148 = load i32, i32* %12
%149 = load i32, i32* @NS_SETBUFLEV
%150 = call i64 @ioctl(i32 %148, i32 %149, %struct.atmif_sioc* %15)
%151 = icmp slt i64 %150, 0
br i1 %151, label %152, label %154
152: ; preds = %147
%153 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i32 3, i32* %3
br label %201
154: ; preds = %147
br label %200
155: ; preds = %43
%156 = load i8**, i8*** %5
%157 = getelementptr inbounds i8*, i8** %156, i64 2
%158 = load i8*, i8** %157
%159 = load i8, i8* %158
%160 = sext i8 %159 to i32
switch i32 %160, label %173 [
i32 115, label %161
i32 108, label %164
i32 104, label %167
i32 105, label %170
]
161: ; preds = %155
%162 = load i8*, i8** @NS_BUFTYPE_SMALL
%163 = ptrtoint i8* %162 to i32
store i32 %163, i32* %14
br label %176
164: ; preds = %155
%165 = load i8*, i8** @NS_BUFTYPE_LARGE
%166 = ptrtoint i8* %165 to i32
store i32 %166, i32* %14
br label %176
167: ; preds = %155
%168 = load i8*, i8** @NS_BUFTYPE_HUGE
%169 = ptrtoint i8* %168 to i32
store i32 %169, i32* %14
br label %176
170: ; preds = %155
%171 = load i8*, i8** @NS_BUFTYPE_IOVEC
%172 = ptrtoint i8* %171 to i32
store i32 %172, i32* %14
br label %176
173: ; preds = %155
%174 = load i8*, i8** %6
%175 = call i32 @usage(i8* %174)
br label %176
176: ; preds = %173, %170, %167, %164, %161
%177 = load i32, i32* %8
%178 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %15, i32 0, i32 0
store i32 %177, i32* %178
%179 = load i32, i32* %14
%180 = sext i32 %179 to i64
%181 = inttoptr i64 %180 to i8*
%182 = bitcast i8* %181 to %struct.TYPE_4__*
%183 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %15, i32 0, i32 2
store %struct.TYPE_4__* %182, %struct.TYPE_4__** %183
%184 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %15, i32 0, i32 1
store i32 8, i32* %184
%185 = load i32, i32* @PF_ATMPVC
%186 = load i32, i32* @SOCK_DGRAM
%187 = call i32 @socket(i32 %185, i32 %186, i32 0)
store i32 %187, i32* %12
%188 = load i32, i32* %12
%189 = icmp slt i32 %188, 0
br i1 %189, label %190, label %192
190: ; preds = %176
%191 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %3
br label %201
192: ; preds = %176
%193 = load i32, i32* %12
%194 = load i32, i32* @NS_ADJBUFLEV
%195 = call i64 @ioctl(i32 %193, i32 %194, %struct.atmif_sioc* %15)
%196 = icmp slt i64 %195, 0
br i1 %196, label %197, label %199
197: ; preds = %192
%198 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 3, i32* %3
br label %201
199: ; preds = %192
br label %200
200: ; preds = %199, %154
store i32 0, i32* %3
br label %201
201: ; preds = %200, %197, %190, %152, %145
%202 = load i32, i32* %3
ret i32 %202
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { %struct.TYPE_3__, i8* }
%struct.TYPE_3__ = type { i32, i32, i32 }
%struct.atmif_sioc = type { i32, i32, %struct.TYPE_4__* }
@NS_BUFTYPE_SMALL = global i8* null
@NS_BUFTYPE_LARGE = global i8* null
@NS_BUFTYPE_HUGE = global i8* null
@NS_BUFTYPE_IOVEC = global i8* null
@PF_ATMPVC = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [7 x i8] c"socket\00"
@NS_SETBUFLEV = global i32 0
@.str.1 = [19 x i8] c"ioctl NS_SETBUFLEV\00"
@NS_ADJBUFLEV = global i32 0
@.str.2 = [19 x i8] c"ioctl NS_ADJBUFLEV\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca %struct.TYPE_4__
%5 = alloca %struct.atmif_sioc
%6 = bitcast i8** %3 to i8*
%7 = bitcast %struct.TYPE_4__* %4 to i8*
%8 = bitcast %struct.atmif_sioc* %5 to i8*
%9 = load i8*, i8** %1
switch i32 %0, label %10 [
i32 6, label %12
i32 3, label %12
]
10: ; preds = %2
%11 = tail call i32 @usage(i8* %9)
br label %12
12: ; preds = %2, %2, %10
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strtol(i8* %14, i8** %3, i32 0)
%16 = load i8*, i8** %3
%17 = load i8*, i8** %13
%18 = icmp eq i8* %16, %17
%19 = icmp slt i32 %15, 0
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = tail call i32 @usage(i8* %9)
br label %23
23: ; preds = %12, %21
%24 = icmp eq i32 %0, 6
br i1 %24, label %25, label %102
25: ; preds = %23
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = call i32 @strtol(i8* %27, i8** %3, i32 0)
%29 = load i8*, i8** %3
%30 = load i8*, i8** %26
%31 = icmp eq i8* %29, %30
%32 = icmp slt i32 %28, 1
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %34, label %36
34: ; preds = %25
%35 = tail call i32 @usage(i8* %9)
br label %36
36: ; preds = %25, %34
%37 = getelementptr inbounds i8*, i8** %1, i64 4
%38 = load i8*, i8** %37
%39 = call i32 @strtol(i8* %38, i8** %3, i32 0)
%40 = load i8*, i8** %3
%41 = load i8*, i8** %37
%42 = icmp eq i8* %40, %41
%43 = icmp slt i32 %39, 1
%44 = select i1 %42, i1 true, i1 %43
br i1 %44, label %45, label %47
45: ; preds = %36
%46 = tail call i32 @usage(i8* %9)
br label %47
47: ; preds = %36, %45
%48 = getelementptr inbounds i8*, i8** %1, i64 5
%49 = load i8*, i8** %48
%50 = call i32 @strtol(i8* %49, i8** %3, i32 0)
%51 = load i8*, i8** %3
%52 = load i8*, i8** %48
%53 = icmp eq i8* %51, %52
%54 = icmp slt i32 %50, 1
%55 = select i1 %53, i1 true, i1 %54
br i1 %55, label %56, label %58
56: ; preds = %47
%57 = tail call i32 @usage(i8* %9)
br label %58
58: ; preds = %47, %56
%59 = icmp slt i32 %28, %39
%60 = icmp slt i32 %39, %50
%61 = select i1 %59, i1 %60, i1 false
br i1 %61, label %64, label %62
62: ; preds = %58
%63 = tail call i32 @usage(i8* %9)
br label %64
64: ; preds = %58, %62
%65 = getelementptr inbounds i8*, i8** %1, i64 2
%66 = load i8*, i8** %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
switch i32 %68, label %81 [
i32 115, label %69
i32 108, label %72
i32 104, label %75
i32 105, label %78
]
69: ; preds = %64
%70 = load i8*, i8** @NS_BUFTYPE_SMALL
%71 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 1
store i8* %70, i8** %71
br label %83
72: ; preds = %64
%73 = load i8*, i8** @NS_BUFTYPE_LARGE
%74 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 1
store i8* %73, i8** %74
br label %83
75: ; preds = %64
%76 = load i8*, i8** @NS_BUFTYPE_HUGE
%77 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 1
store i8* %76, i8** %77
br label %83
78: ; preds = %64
%79 = load i8*, i8** @NS_BUFTYPE_IOVEC
%80 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 1
store i8* %79, i8** %80
br label %83
81: ; preds = %64
%82 = tail call i32 @usage(i8* %9)
br label %83
83: ; preds = %81, %78, %75, %72, %69
%84 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %5, i64 0, i32 0
store i32 %15, i32* %84
%85 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %5, i64 0, i32 2
store %struct.TYPE_4__* %4, %struct.TYPE_4__** %85
%86 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %5, i64 0, i32 1
store i32 24, i32* %86
%87 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 0
store i32 %28, i32* %87
%88 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 1
store i32 %39, i32* %88
%89 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 2
store i32 %50, i32* %89
%90 = load i32, i32* @PF_ATMPVC
%91 = load i32, i32* @SOCK_DGRAM
%92 = call i32 @socket(i32 %90, i32 %91, i32 0)
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %83
%95 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %141
96: ; preds = %83
%97 = load i32, i32* @NS_SETBUFLEV
%98 = call i64 @ioctl(i32 %92, i32 %97, %struct.atmif_sioc* %5)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %141
100: ; preds = %96
%101 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %141
102: ; preds = %23
%103 = getelementptr inbounds i8*, i8** %1, i64 2
%104 = load i8*, i8** %103
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
switch i32 %106, label %119 [
i32 115, label %107
i32 108, label %110
i32 104, label %113
i32 105, label %116
]
107: ; preds = %102
%108 = load i8*, i8** @NS_BUFTYPE_SMALL
%109 = ptrtoint i8* %108 to i64
br label %121
110: ; preds = %102
%111 = load i8*, i8** @NS_BUFTYPE_LARGE
%112 = ptrtoint i8* %111 to i64
br label %121
113: ; preds = %102
%114 = load i8*, i8** @NS_BUFTYPE_HUGE
%115 = ptrtoint i8* %114 to i64
br label %121
116: ; preds = %102
%117 = load i8*, i8** @NS_BUFTYPE_IOVEC
%118 = ptrtoint i8* %117 to i64
br label %121
119: ; preds = %102
%120 = tail call i32 @usage(i8* %9)
br label %121
121: ; preds = %119, %116, %113, %110, %107
%122 = phi i64 [ 0, %119 ], [ %118, %116 ], [ %115, %113 ], [ %112, %110 ], [ %109, %107 ]
%123 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %5, i64 0, i32 0
store i32 %15, i32* %123
%124 = shl i64 %122, 32
%125 = ashr exact i64 %124, 32
%126 = inttoptr i64 %125 to %struct.TYPE_4__*
%127 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %5, i64 0, i32 2
store %struct.TYPE_4__* %126, %struct.TYPE_4__** %127
%128 = getelementptr inbounds %struct.atmif_sioc, %struct.atmif_sioc* %5, i64 0, i32 1
store i32 8, i32* %128
%129 = load i32, i32* @PF_ATMPVC
%130 = load i32, i32* @SOCK_DGRAM
%131 = tail call i32 @socket(i32 %129, i32 %130, i32 0)
%132 = icmp slt i32 %131, 0
br i1 %132, label %133, label %135
133: ; preds = %121
%134 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %141
135: ; preds = %121
%136 = load i32, i32* @NS_ADJBUFLEV
%137 = call i64 @ioctl(i32 %131, i32 %136, %struct.atmif_sioc* %5)
%138 = icmp slt i64 %137, 0
br i1 %138, label %139, label %141
139: ; preds = %135
%140 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %141
141: ; preds = %96, %135, %139, %133, %100, %94
%142 = phi i32 [ 2, %94 ], [ 3, %100 ], [ 2, %133 ], [ 3, %139 ], [ 0, %135 ], [ 0, %96 ]
ret i32 %142
}