#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 *);
void clean_extra_args(char **arguments_array, int args_count) {
  for (int i = args_count; i < 513; i++) {
    if (arguments_array[i] != NULL) {
      free(arguments_array[i]);
      arguments_array[i] = NULL;
    } else {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<clean_extra_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x201,-0x10(%rbp)
jge    1183 <clean_extra_args+0x73>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     116b <clean_extra_args+0x5b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    1170 <clean_extra_args+0x60>
jmp    1183 <clean_extra_args+0x73>
jmp    1175 <clean_extra_args+0x65>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1125 <clean_extra_args+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_extra_args>:
push   %r14
push   %rbx
push   %rax
cmp    $0x200,%esi
jg     1153 <clean_extra_args+0x43>
mov    %rdi,%r14
movslq %esi,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
test   %rdi,%rdi
je     1153 <clean_extra_args+0x43>
call   1030 <free@plt>
movq   $0x0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x201,%rbx
jne    1130 <clean_extra_args+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @clean_extra_args(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
store i32 %6, i32* %5
br label %7
7: ; preds = %30, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 513
br i1 %9, label %10, label %33
10: ; preds = %7
%11 = load i8**, i8*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %28
17: ; preds = %10
%18 = load i8**, i8*** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @free(i8* %22)
%24 = load i8**, i8*** %3
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
store i8* null, i8** %27
br label %29
28: ; preds = %10
br label %33
29: ; preds = %17
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %7
33: ; preds = %28, %7
ret void
}

LLVM IR (-O2):
define void @clean_extra_args(i8** nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 513
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = sext i32 %1 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ %5, %4 ], [ %13, %11 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = tail call i32 @free(i8* %9)
store i8* null, i8** %8
%13 = add nsw i64 %7, 1
%14 = icmp eq i64 %13, 513
br i1 %14, label %15, label %6
15: ; preds = %11, %6, %2
ret void
}