#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 */

/* Variables and functions */
int /*<<< orphan*/ errx(int, char *, ...);
int /*<<< orphan*/ printf(char *, char *, char const *);
int /*<<< orphan*/ qset_config(int, char **, int, char const *);
int /*<<< orphan*/ read_nqsets(char const *, int *, int *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int setup_lro(int argc, char *argv[], int start_arg, const char *iff_name) {
  int sq, nq, lq;
  char sbuf0[0];
  if (argc == start_arg)
    errx(1, "missing argument to enable/disable lro");
  if (argc > 4)
    errx(1, "too many arguments");
  read_nqsets(iff_name, &sq, &nq);
  argv[4] = "lro";
  if (!strcmp(argv[3], "on") || !strcmp(argv[3], "1"))
    argv[5] = "1";
  else if (!strcmp(argv[3], "off") || !strcmp(argv[3], "0"))
    argv[5] = "0";
  else
    errx(1, "bad argument \"%s\"; must be \"on\" or \"off\"", argv[3]);
  lq = sq + nq;
  while (sq < lq) {
    sprintf(sbuf0, "%i", sq);
    argv[3] = sbuf0;
    qset_config(6, argv, 3, iff_name);
    sq++;
  }
  printf("%s LRO for all Queues on %s\n",
         !strcmp(argv[5], "1") ? "Enabled" : "Disabled", iff_name);
  return 0;
}


x86 assembly (clang, -O0):
<setup_lro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1195 <setup_lro+0x35>
mov    $0x1,%edi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
cmpl   $0x4,-0x4(%rbp)
jle    11b2 <setup_lro+0x52>
mov    $0x1,%edi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
mov    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <read_nqsets@plt>
mov    -0x10(%rbp),%rax
lea    0xe55(%rip),%rcx
mov    %rcx,0x20(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe59(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     120c <setup_lro+0xac>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe3f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1220 <setup_lro+0xc0>
mov    -0x10(%rbp),%rax
lea    0xe26(%rip),%rcx
mov    %rcx,0x28(%rax)
jmp    128e <setup_lro+0x12e>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe10(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     125a <setup_lro+0xfa>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdf7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    126e <setup_lro+0x10e>
mov    -0x10(%rbp),%rax
lea    0xdde(%rip),%rcx
mov    %rcx,0x28(%rax)
jmp    1289 <setup_lro+0x129>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xdc3(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
jmp    128e <setup_lro+0x12e>
mov    -0x24(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    12e7 <setup_lro+0x187>
lea    -0x2d(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xdbd(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x2d(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    $0x6,%edi
mov    $0x3,%edx
call   1060 <qset_config@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1297 <setup_lro+0x137>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xd47(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %cl
xor    $0xff,%cl
lea    0xd8b(%rip),%rsi
lea    0xd7c(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
mov    -0x20(%rbp),%rdx
lea    0xd4d(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_lro>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rsi,%r12
mov    %edi,%ebx
cmp    %edx,%edi
jne    118b <setup_lro+0x2b>
lea    0xe81(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <errx@plt>
cmp    $0x5,%ebx
jl     11a3 <setup_lro+0x43>
lea    0xe90(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <errx@plt>
lea    0x4(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
call   1030 <read_nqsets@plt>
lea    0xe67(%rip),%rax
mov    %rax,0x20(%r12)
mov    0x18(%r12),%r15
lea    0xe6d(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     122a <setup_lro+0xca>
lea    0xe5d(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     122a <setup_lro+0xca>
lea    0xe4c(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1233 <setup_lro+0xd3>
lea    0xe3d(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1233 <setup_lro+0xd3>
lea    0xe2c(%rip),%rsi
mov    $0x1,%edi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <errx@plt>
jmp    123f <setup_lro+0xdf>
lea    0xe0c(%rip),%rax
jmp    123a <setup_lro+0xda>
lea    0xe09(%rip),%rax
mov    %rax,0x28(%r12)
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
jle    1294 <setup_lro+0x134>
mov    0x4(%rsp),%edx
add    %edx,%ebp
lea    0xe1a(%rip),%r15
lea    0xb(%rsp),%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %rbx,0x18(%r12)
mov    $0x6,%edi
mov    %r12,%rsi
mov    $0x3,%edx
mov    %r14,%rcx
call   1060 <qset_config@plt>
mov    0x4(%rsp),%edx
add    $0x1,%edx
mov    %edx,0x4(%rsp)
cmp    %ebp,%edx
jl     1260 <setup_lro+0x100>
mov    0x28(%r12),%rdi
lea    0xd9d(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
lea    0xde0(%rip),%rax
lea    0xde1(%rip),%rsi
cmove  %rax,%rsi
lea    0xdb1(%rip),%rdi
mov    %r14,%rdx
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"missing argument to enable/disable lro\00"
@.str.1 = [19 x i8] c"too many arguments\00"
@.str.2 = [4 x i8] c"lro\00"
@.str.3 = [3 x i8] c"on\00"
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [4 x i8] c"off\00"
@.str.6 = [2 x i8] c"0\00"
@.str.7 = [41 x i8] c"bad argument \22%s\22; must be \22on\22 or \22off\22\00"
@.str.8 = [3 x i8] c"%i\00"
@.str.9 = [29 x i8] c"%s LRO for all Queues on %s\0A\00"
@.str.10 = [8 x i8] c"Enabled\00"
@.str.11 = [9 x i8] c"Disabled\00"
define i32 @setup_lro(i32 %0, i8** %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [0 x i8]
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%13 = load i32, i32* %5
%14 = load i32, i32* %7
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %4
%17 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %4
%19 = load i32, i32* %5
%20 = icmp sgt i32 %19, 4
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
%24 = load i8*, i8** %8
%25 = call i32 @read_nqsets(i8* %24, i32* %9, i32* %10)
%26 = load i8**, i8*** %6
%27 = getelementptr inbounds i8*, i8** %26, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %27
%28 = load i8**, i8*** %6
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
%31 = call i32 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %23
%34 = load i8**, i8*** %6
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @strcmp(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %33, %23
%40 = load i8**, i8*** %6
%41 = getelementptr inbounds i8*, i8** %40, i64 5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %41
br label %63
42: ; preds = %33
%43 = load i8**, i8*** %6
%44 = getelementptr inbounds i8*, i8** %43, i64 3
%45 = load i8*, i8** %44
%46 = call i32 @strcmp(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %54
48: ; preds = %42
%49 = load i8**, i8*** %6
%50 = getelementptr inbounds i8*, i8** %49, i64 3
%51 = load i8*, i8** %50
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %48, %42
%55 = load i8**, i8*** %6
%56 = getelementptr inbounds i8*, i8** %55, i64 5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8** %56
br label %62
57: ; preds = %48
%58 = load i8**, i8*** %6
%59 = getelementptr inbounds i8*, i8** %58, i64 3
%60 = load i8*, i8** %59
%61 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %57, %54
br label %63
63: ; preds = %62, %39
%64 = load i32, i32* %9
%65 = load i32, i32* %10
%66 = add nsw i32 %64, %65
store i32 %66, i32* %11
br label %67
67: ; preds = %71, %63
%68 = load i32, i32* %9
%69 = load i32, i32* %11
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %83
71: ; preds = %67
%72 = getelementptr inbounds [0 x i8], [0 x i8]* %12, i64 0, i64 0
%73 = load i32, i32* %9
%74 = call i32 @sprintf(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %73)
%75 = getelementptr inbounds [0 x i8], [0 x i8]* %12, i64 0, i64 0
%76 = load i8**, i8*** %6
%77 = getelementptr inbounds i8*, i8** %76, i64 3
store i8* %75, i8** %77
%78 = load i8**, i8*** %6
%79 = load i8*, i8** %8
%80 = call i32 @qset_config(i32 6, i8** %78, i32 3, i8* %79)
%81 = load i32, i32* %9
%82 = add nsw i32 %81, 1
store i32 %82, i32* %9
br label %67
83: ; preds = %67
%84 = load i8**, i8*** %6
%85 = getelementptr inbounds i8*, i8** %84, i64 5
%86 = load i8*, i8** %85
%87 = call i32 @strcmp(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%88 = icmp ne i32 %87, 0
%89 = xor i1 %88, true
%90 = zext i1 %89 to i64
%91 = select i1 %89, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0)
%92 = load i8*, i8** %8
%93 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i8* %91, i8* %92)
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"missing argument to enable/disable lro\00"
@.str.1 = [19 x i8] c"too many arguments\00"
@.str.2 = [4 x i8] c"lro\00"
@.str.3 = [3 x i8] c"on\00"
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [4 x i8] c"off\00"
@.str.6 = [2 x i8] c"0\00"
@.str.7 = [41 x i8] c"bad argument \22%s\22; must be \22on\22 or \22off\22\00"
@.str.8 = [3 x i8] c"%i\00"
@.str.9 = [29 x i8] c"%s LRO for all Queues on %s\0A\00"
@.str.10 = [8 x i8] c"Enabled\00"
@.str.11 = [9 x i8] c"Disabled\00"
define i32 @setup_lro(i32 %0, i8** %1, i32 %2, i8* %3) {
%5 = alloca [0 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = getelementptr inbounds [0 x i8], [0 x i8]* %5, i64 0, i64 0
%11 = icmp eq i32 %0, %2
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %4
%15 = icmp sgt i32 %0, 4
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = call i32 @read_nqsets(i8* %3, i32* %6, i32* %7)
%20 = getelementptr inbounds i8*, i8** %1, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = call i32 @strcmp(i8* dereferenceable(1) %22, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %18
%26 = call i32 @strcmp(i8* dereferenceable(1) %22, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25, %18
%29 = getelementptr inbounds i8*, i8** %1, i64 5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %29
br label %40
30: ; preds = %25
%31 = call i32 @strcmp(i8* dereferenceable(1) %22, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = call i32 @strcmp(i8* dereferenceable(1) %22, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33, %30
%37 = getelementptr inbounds i8*, i8** %1, i64 5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8** %37
br label %40
38: ; preds = %33
%39 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i8* %22)
br label %40
40: ; preds = %36, %38, %28
%41 = load i32, i32* %6
%42 = load i32, i32* %7
%43 = add nsw i32 %42, %41
%44 = icmp sgt i32 %42, 0
br i1 %44, label %45, label %52
45: ; preds = %40, %45
%46 = phi i32 [ %50, %45 ], [ %41, %40 ]
%47 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %46)
store i8* %10, i8** %21
%48 = call i32 @qset_config(i32 6, i8** %1, i32 3, i8* %3)
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
%51 = icmp slt i32 %50, %43
br i1 %51, label %45, label %52
52: ; preds = %45, %40
%53 = getelementptr inbounds i8*, i8** %1, i64 5
%54 = load i8*, i8** %53
%55 = call i32 @strcmp(i8* dereferenceable(1) %54, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp eq i32 %55, 0
%57 = select i1 %56, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0)
%58 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i8* %57, i8* %3)
ret i32 0
}