#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 execute(char *, char const *, int);
int tc_detach_client(const char down_dev[], int download_limit,
                     const char up_dev[], int upload_limit, int idx) {
  int rc = 0, n;
  int id = 3 * idx + 10;
  if (download_limit > 0) {
    for (n = 2; n >= 0; n--)
      rc |= execute("filter del dev %s parent 1: prio %d", down_dev, id + n);
    for (n = 2; n >= 1; n--)
      rc |= execute("qdisc del dev %s parent 1:%d", down_dev, id + n);
    for (n = 2; n >= 0; n--)
      rc |=
          execute("class del dev %s parent 1: classid 1:%d", down_dev, id + n);
  }
  if (upload_limit > 0) {
    for (n = 2; n >= 0; n--)
      rc |= execute("filter del dev %s parent 1: prio %d", up_dev, id + n);
    for (n = 2; n >= 1; n--)
      rc |= execute("qdisc del dev %s parent 1:%d", up_dev, id + n);
    for (n = 2; n >= 0; n--)
      rc |= execute("class del dev %s parent 1: classid 1:%d", up_dev, id + n);
  }
  return rc;
}


x86 assembly (clang, -O0):
<tc_detach_client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
imul   $0x3,-0x20(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11fb <tc_detach_client+0xeb>
movl   $0x2,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     1180 <tc_detach_client+0x70>
mov    -0x8(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    -0x28(%rbp),%edx
lea    0xe99(%rip),%rdi
call   1030 <execute@plt>
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    114c <tc_detach_client+0x3c>
movl   $0x2,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
jl     11bb <tc_detach_client+0xab>
mov    -0x8(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    -0x28(%rbp),%edx
lea    0xe82(%rip),%rdi
call   1030 <execute@plt>
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1187 <tc_detach_client+0x77>
movl   $0x2,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     11f6 <tc_detach_client+0xe6>
mov    -0x8(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    -0x28(%rbp),%edx
lea    0xe64(%rip),%rdi
call   1030 <execute@plt>
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    11c2 <tc_detach_client+0xb2>
jmp    11fb <tc_detach_client+0xeb>
cmpl   $0x0,-0x1c(%rbp)
jle    12bb <tc_detach_client+0x1ab>
movl   $0x2,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     1240 <tc_detach_client+0x130>
mov    -0x18(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    -0x28(%rbp),%edx
lea    0xdd9(%rip),%rdi
call   1030 <execute@plt>
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    120c <tc_detach_client+0xfc>
movl   $0x2,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
jl     127b <tc_detach_client+0x16b>
mov    -0x18(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    -0x28(%rbp),%edx
lea    0xdc2(%rip),%rdi
call   1030 <execute@plt>
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1247 <tc_detach_client+0x137>
movl   $0x2,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     12b6 <tc_detach_client+0x1a6>
mov    -0x18(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    -0x28(%rbp),%edx
lea    0xda4(%rip),%rdi
call   1030 <execute@plt>
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1282 <tc_detach_client+0x172>
jmp    12bb <tc_detach_client+0x1ab>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tc_detach_client>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,0x20(%rsp)
lea    (%r8,%r8,2),%ebx
lea    (%r8,%r8,2),%ebp
add    $0xa,%ebp
test   %esi,%esi
mov    %ebp,0x10(%rsp)
mov    %rbx,0x18(%rsp)
jle    12dc <tc_detach_client+0x1cc>
mov    %rdi,%r15
lea    0xc(%rbx),%edx
mov    %edx,0x14(%rsp)
lea    0xeb0(%rip),%r13
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ecx,0xc(%rsp)
call   1030 <execute@plt>
mov    %eax,%r14d
add    $0xb,%ebx
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <execute@plt>
mov    %eax,%r12d
or     %r14d,%r12d
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <execute@plt>
mov    %eax,%r13d
lea    0xe95(%rip),%rdi
mov    %r15,%rsi
mov    0x14(%rsp),%ebp
mov    %ebp,%edx
call   1030 <execute@plt>
mov    %eax,%r14d
or     %r13d,%r14d
or     %r12d,%r14d
lea    0xe77(%rip),%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <execute@plt>
mov    %eax,%r13d
lea    0xe80(%rip),%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <execute@plt>
mov    %eax,%ebp
or     %r13d,%ebp
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <execute@plt>
mov    %eax,%ebx
or     %ebp,%ebx
or     %r14d,%ebx
mov    %r12,%rdi
mov    %r15,%rsi
mov    0x10(%rsp),%edx
call   1030 <execute@plt>
mov    0xc(%rsp),%ecx
mov    %eax,%ebp
or     %ebx,%ebp
test   %ecx,%ecx
jle    12cb <tc_detach_client+0x1bb>
mov    0x18(%rsp),%r15
lea    0xc(%r15),%edx
mov    %edx,0xc(%rsp)
lea    0xde6(%rip),%r13
mov    %r13,%rdi
mov    0x20(%rsp),%r14
mov    %r14,%rsi
call   1030 <execute@plt>
mov    %eax,%ebx
or     %ebp,%ebx
add    $0xb,%r15d
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <execute@plt>
mov    %eax,%r12d
mov    %r13,%rdi
mov    %r14,%rsi
mov    0x10(%rsp),%edx
call   1030 <execute@plt>
mov    %eax,%r13d
or     %r12d,%r13d
or     %ebx,%r13d
lea    0xdc2(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
call   1030 <execute@plt>
mov    %eax,%r12d
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <execute@plt>
mov    %eax,%ebp
or     %r12d,%ebp
lea    0xdb1(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <execute@plt>
mov    %eax,%ebx
or     %ebp,%ebx
or     %r13d,%ebx
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <execute@plt>
mov    %eax,%r15d
mov    %r12,%rdi
mov    %r14,%rsi
mov    0x10(%rsp),%edx
call   1030 <execute@plt>
mov    %eax,%ebp
or     %r15d,%ebp
or     %ebx,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
test   %ecx,%ecx
jg     1206 <tc_detach_client+0xf6>
jmp    12cb <tc_detach_client+0x1bb>

LLVM IR (-O0):
@.str = [36 x i8] c"filter del dev %s parent 1: prio %d\00"
@.str.1 = [29 x i8] c"qdisc del dev %s parent 1:%d\00"
@.str.2 = [40 x i8] c"class del dev %s parent 1: classid 1:%d\00"
define i32 @tc_detach_client(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %11
%14 = load i32, i32* %10
%15 = mul nsw i32 3, %14
%16 = add nsw i32 %15, 10
store i32 %16, i32* %13
%17 = load i32, i32* %7
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %65
19: ; preds = %5
store i32 2, i32* %12
br label %20
20: ; preds = %31, %19
%21 = load i32, i32* %12
%22 = icmp sge i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i8*, i8** %6
%25 = load i32, i32* %13
%26 = load i32, i32* %12
%27 = add nsw i32 %25, %26
%28 = call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %24, i32 %27)
%29 = load i32, i32* %11
%30 = or i32 %29, %28
store i32 %30, i32* %11
br label %31
31: ; preds = %23
%32 = load i32, i32* %12
%33 = add nsw i32 %32, -1
store i32 %33, i32* %12
br label %20
34: ; preds = %20
store i32 2, i32* %12
br label %35
35: ; preds = %46, %34
%36 = load i32, i32* %12
%37 = icmp sge i32 %36, 1
br i1 %37, label %38, label %49
38: ; preds = %35
%39 = load i8*, i8** %6
%40 = load i32, i32* %13
%41 = load i32, i32* %12
%42 = add nsw i32 %40, %41
%43 = call i32 @execute(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %39, i32 %42)
%44 = load i32, i32* %11
%45 = or i32 %44, %43
store i32 %45, i32* %11
br label %46
46: ; preds = %38
%47 = load i32, i32* %12
%48 = add nsw i32 %47, -1
store i32 %48, i32* %12
br label %35
49: ; preds = %35
store i32 2, i32* %12
br label %50
50: ; preds = %61, %49
%51 = load i32, i32* %12
%52 = icmp sge i32 %51, 0
br i1 %52, label %53, label %64
53: ; preds = %50
%54 = load i8*, i8** %6
%55 = load i32, i32* %13
%56 = load i32, i32* %12
%57 = add nsw i32 %55, %56
%58 = call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %54, i32 %57)
%59 = load i32, i32* %11
%60 = or i32 %59, %58
store i32 %60, i32* %11
br label %61
61: ; preds = %53
%62 = load i32, i32* %12
%63 = add nsw i32 %62, -1
store i32 %63, i32* %12
br label %50
64: ; preds = %50
br label %65
65: ; preds = %64, %5
%66 = load i32, i32* %9
%67 = icmp sgt i32 %66, 0
br i1 %67, label %68, label %114
68: ; preds = %65
store i32 2, i32* %12
br label %69
69: ; preds = %80, %68
%70 = load i32, i32* %12
%71 = icmp sge i32 %70, 0
br i1 %71, label %72, label %83
72: ; preds = %69
%73 = load i8*, i8** %8
%74 = load i32, i32* %13
%75 = load i32, i32* %12
%76 = add nsw i32 %74, %75
%77 = call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %73, i32 %76)
%78 = load i32, i32* %11
%79 = or i32 %78, %77
store i32 %79, i32* %11
br label %80
80: ; preds = %72
%81 = load i32, i32* %12
%82 = add nsw i32 %81, -1
store i32 %82, i32* %12
br label %69
83: ; preds = %69
store i32 2, i32* %12
br label %84
84: ; preds = %95, %83
%85 = load i32, i32* %12
%86 = icmp sge i32 %85, 1
br i1 %86, label %87, label %98
87: ; preds = %84
%88 = load i8*, i8** %8
%89 = load i32, i32* %13
%90 = load i32, i32* %12
%91 = add nsw i32 %89, %90
%92 = call i32 @execute(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %88, i32 %91)
%93 = load i32, i32* %11
%94 = or i32 %93, %92
store i32 %94, i32* %11
br label %95
95: ; preds = %87
%96 = load i32, i32* %12
%97 = add nsw i32 %96, -1
store i32 %97, i32* %12
br label %84
98: ; preds = %84
store i32 2, i32* %12
br label %99
99: ; preds = %110, %98
%100 = load i32, i32* %12
%101 = icmp sge i32 %100, 0
br i1 %101, label %102, label %113
102: ; preds = %99
%103 = load i8*, i8** %8
%104 = load i32, i32* %13
%105 = load i32, i32* %12
%106 = add nsw i32 %104, %105
%107 = call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %103, i32 %106)
%108 = load i32, i32* %11
%109 = or i32 %108, %107
store i32 %109, i32* %11
br label %110
110: ; preds = %102
%111 = load i32, i32* %12
%112 = add nsw i32 %111, -1
store i32 %112, i32* %12
br label %99
113: ; preds = %99
br label %114
114: ; preds = %113, %65
%115 = load i32, i32* %11
ret i32 %115
}

LLVM IR (-O2):
@.str = [36 x i8] c"filter del dev %s parent 1: prio %d\00"
@.str.1 = [29 x i8] c"qdisc del dev %s parent 1:%d\00"
@.str.2 = [40 x i8] c"class del dev %s parent 1: classid 1:%d\00"
define i32 @tc_detach_client(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = mul nsw i32 %4, 3
%7 = add nsw i32 %6, 10
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %27
9: ; preds = %5
%10 = add nsw i32 %6, 12
%11 = tail call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %10)
%12 = add nsw i32 %6, 11
%13 = tail call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %12)
%14 = or i32 %13, %11
%15 = tail call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %7)
%16 = or i32 %15, %14
%17 = tail call i32 @execute(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %10)
%18 = or i32 %17, %16
%19 = tail call i32 @execute(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %12)
%20 = or i32 %19, %18
%21 = tail call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %10)
%22 = or i32 %21, %20
%23 = tail call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %12)
%24 = or i32 %23, %22
%25 = tail call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %7)
%26 = or i32 %25, %24
br label %27
27: ; preds = %9, %5
%28 = phi i32 [ 0, %5 ], [ %26, %9 ]
%29 = icmp sgt i32 %3, 0
br i1 %29, label %30, label %49
30: ; preds = %27
%31 = add nsw i32 %6, 12
%32 = tail call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %31)
%33 = or i32 %32, %28
%34 = add nsw i32 %6, 11
%35 = tail call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %34)
%36 = or i32 %35, %33
%37 = tail call i32 @execute(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %7)
%38 = or i32 %37, %36
%39 = tail call i32 @execute(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %31)
%40 = or i32 %39, %38
%41 = tail call i32 @execute(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %34)
%42 = or i32 %41, %40
%43 = tail call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %31)
%44 = or i32 %43, %42
%45 = tail call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %34)
%46 = or i32 %45, %44
%47 = tail call i32 @execute(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %7)
%48 = or i32 %47, %46
br label %49
49: ; preds = %30, %27
%50 = phi i32 [ %28, %27 ], [ %48, %30 ]
ret i32 %50
}