#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 atoi(int /*<<< orphan*/);
int trap_Cmd_Argc();
int /*<<< orphan*/ trap_Cmd_Argv(int);
int /*<<< orphan*/ trap_Cmd_ExecuteText(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ va(char *, int);
void CG_SC_ChannelRemove(void) {
  int i, id;
  for (i = 1; i < trap_Cmd_Argc(); i++) {
    id = atoi(trap_Cmd_Argv(i));
    if (id <= 0)
      continue;
    trap_Cmd_ExecuteText(0, va("menu_tvchannel_remove %i\n", id));
  }
}


x86 assembly (clang, -O0):
<CG_SC_ChannelRemove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <trap_Cmd_Argc@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jge    11c0 <CG_SC_ChannelRemove+0x70>
mov    -0x4(%rbp),%edi
call   1060 <trap_Cmd_Argv@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     119a <CG_SC_ChannelRemove+0x4a>
jmp    11b2 <CG_SC_ChannelRemove+0x62>
mov    -0x8(%rbp),%esi
lea    0xe5c(%rip),%rdi
call   1050 <va@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1040 <trap_Cmd_ExecuteText@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <CG_SC_ChannelRemove+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_SC_ChannelRemove>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <trap_Cmd_Argc@plt>
cmp    $0x2,%eax
jl     11a5 <CG_SC_ChannelRemove+0x55>
mov    $0x1,%ebx
lea    0xe94(%rip),%r14
jmp    117e <CG_SC_ChannelRemove+0x2e>
xchg   %ax,%ax
add    $0x1,%ebx
xor    %eax,%eax
call   1030 <trap_Cmd_Argc@plt>
cmp    %eax,%ebx
jge    11a5 <CG_SC_ChannelRemove+0x55>
mov    %ebx,%edi
call   1060 <trap_Cmd_Argv@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
test   %eax,%eax
jle    1170 <CG_SC_ChannelRemove+0x20>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <va@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1040 <trap_Cmd_ExecuteText@plt>
jmp    1170 <CG_SC_ChannelRemove+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"menu_tvchannel_remove %i\0A\00"
define void @CG_SC_ChannelRemove() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %1
%5 = call i32 (...) @trap_Cmd_Argc()
%6 = icmp slt i32 %4, %5
br i1 %6, label %7, label %21
7: ; preds = %3
%8 = load i32, i32* %1
%9 = call i32 @trap_Cmd_Argv(i32 %8)
%10 = call i32 @atoi(i32 %9)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %7
br label %18
14: ; preds = %7
%15 = load i32, i32* %2
%16 = call i32 @va(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @trap_Cmd_ExecuteText(i32 0, i32 %16)
br label %18
18: ; preds = %14, %13
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %3
21: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"menu_tvchannel_remove %i\0A\00"
define void @CG_SC_ChannelRemove() {
%1 = tail call i32 (...) @trap_Cmd_Argc()
%2 = icmp sgt i32 %1, 1
br i1 %2, label %3, label %15
3: ; preds = %0, %11
%4 = phi i32 [ %12, %11 ], [ 1, %0 ]
%5 = tail call i32 @trap_Cmd_Argv(i32 %4)
%6 = tail call i32 @atoi(i32 %5)
%7 = icmp slt i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = tail call i32 @va(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %6)
%10 = tail call i32 @trap_Cmd_ExecuteText(i32 0, i32 %9)
br label %11
11: ; preds = %3, %8
%12 = add nuw nsw i32 %4, 1
%13 = tail call i32 (...) @trap_Cmd_Argc()
%14 = icmp slt i32 %12, %13
br i1 %14, label %3, label %15
15: ; preds = %11, %0
ret void
}