#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*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *);
scalar_t__ system(char *);
int tc_stop(void) {
  char *cmd;
  cmd = malloc(sizeof "/sbin/tc" + sizeof "eth0" + sizeof "10Mbit" + 64 + 1);
  if (cmd == NULL)
    return 1;
  snprintf(
      cmd, (sizeof "/sbin/tc" + sizeof "eth0" + sizeof "10Mbit" + 64 + 1),
      "%s qdisc del dev %s root handle 1:0 cbq bandwidth %s avpkt 1000 mpu 64",
      "/sbin/tc", "eth0", "10Mbit");
  if (system(cmd)) {
    free(cmd);
    return 1;
  }
  free(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<tc_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x56,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116d <tc_stop+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    11cf <tc_stop+0x8f>
mov    -0x10(%rbp),%rdi
mov    $0x56,%esi
lea    0xe83(%rip),%rdx
lea    0xec3(%rip),%rcx
lea    0xec5(%rip),%r8
lea    0xec3(%rip),%r9
call   1050 <snprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <system@plt>
cmp    $0x0,%rax
je     11bf <tc_stop+0x7f>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    11cf <tc_stop+0x8f>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tc_stop>:
push   %rbp
push   %rbx
push   %rax
mov    $0x56,%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     1199 <tc_stop+0x59>
mov    %rax,%rbx
lea    0xea4(%rip),%rdx
lea    0xee4(%rip),%rcx
lea    0xee6(%rip),%r8
lea    0xee4(%rip),%r9
mov    %rax,%rdi
mov    $0x56,%esi
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    119e <tc_stop+0x5e>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [71 x i8] c"%s qdisc del dev %s root handle 1:0 cbq bandwidth %s avpkt 1000 mpu 64\00"
@.str.1 = [9 x i8] c"/sbin/tc\00"
@.str.2 = [5 x i8] c"eth0\00"
@.str.3 = [7 x i8] c"10Mbit\00"
define i32 @tc_stop() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* @malloc(i32 86)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 1, i32* %1
br label %19
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @snprintf(i8* %8, i32 86, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%10 = load i8*, i8** %2
%11 = call i64 @system(i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = load i8*, i8** %2
%15 = call i32 @free(i8* %14)
store i32 1, i32* %1
br label %19
16: ; preds = %7
%17 = load i8*, i8** %2
%18 = call i32 @free(i8* %17)
store i32 0, i32* %1
br label %19
19: ; preds = %16, %13, %6
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [71 x i8] c"%s qdisc del dev %s root handle 1:0 cbq bandwidth %s avpkt 1000 mpu 64\00"
@.str.1 = [9 x i8] c"/sbin/tc\00"
@.str.2 = [5 x i8] c"eth0\00"
@.str.3 = [7 x i8] c"10Mbit\00"
define i32 @tc_stop() {
%1 = tail call dereferenceable_or_null(86) i8* @malloc(i32 86)
%2 = icmp eq i8* %1, null
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i32 @snprintf(i8* %1, i32 86, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i64 @system(i8* %1)
%6 = icmp ne i64 %5, 0
%7 = tail call i32 @free(i8* %1)
%8 = zext i1 %6 to i32
br label %9
9: ; preds = %3, %0
%10 = phi i32 [ 1, %0 ], [ %8, %3 ]
ret i32 %10
}