#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*/ printf(char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ whetstonemain(int, char **);
int whetstone_command(int argc, char *argv[]) {
  int n = 0;
  char *args[] = {"whetstone", "5", ""};
  printf("Running Whetstone Command!\n");
  while (strlen(args[n]))
    n++;
  whetstonemain(n, args);
  printf("Completed Whetstone\n");
  return (0);
}


x86 assembly (clang, -O0):
<whetstone_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2cb3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cb0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cad(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
je     1199 <whetstone_command+0x69>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1173 <whetstone_command+0x43>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1030 <whetstonemain@plt>
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whetstone_command>:
sub    $0x18,%rsp
mov    0x2ce5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
nopl   0x0(%rax)
mov    0x8(%rsp,%rdi,8),%rax
add    $0x1,%rdi
cmpb   $0x0,(%rax)
jne    1150 <whetstone_command+0x30>
mov    %rsp,%rsi
call   1040 <whetstonemain@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"whetstone\00"
@.str.1 = [2 x i8] c"5\00"
@.str.2 = [1 x i8] zeroinitializer
@__const.whetstone_command.args = [3 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [28 x i8] c"Running Whetstone Command!\0A\00"
@.str.4 = [21 x i8] c"Completed Whetstone\0A\00"
define i32 @whetstone_command(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca [3 x i8*]
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
%7 = bitcast [3 x i8*]* %6 to i8*
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %16, %2
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [3 x i8*], [3 x i8*]* %6, i64 0, i64 %11
%13 = load i8*, i8** %12
%14 = call i64 @strlen(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %9
19: ; preds = %9
%20 = load i32, i32* %5
%21 = getelementptr inbounds [3 x i8*], [3 x i8*]* %6, i64 0, i64 0
%22 = call i32 @whetstonemain(i32 %20, i8** %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"whetstone\00"
@.str.1 = [2 x i8] c"5\00"
@.str.2 = [1 x i8] zeroinitializer
@__const.whetstone_command.args = [3 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0)]
@str = [27 x i8] c"Running Whetstone Command!\00"
@str.5 = [20 x i8] c"Completed Whetstone\00"
define i32 @whetstone_command(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8*]
%4 = bitcast [3 x i8*]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %2, %6
%7 = phi i64 [ 1, %2 ], [ %12, %6 ]
%8 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %7
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
%12 = add nuw i64 %7, 1
br i1 %11, label %13, label %6
13: ; preds = %6
%14 = trunc i64 %7 to i32
%15 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%16 = call i32 @whetstonemain(i32 %14, i8** %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}