#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*/ system(char *);
void create_dockspacer(int *where, int *amount) {
  int spacer_count;
  switch (*where) {
  case 1:
    for (spacer_count = 0; spacer_count < *amount; spacer_count++)
      system("defaults write com.apple.dock persistent-apps -array-add "
             "'{title-data={}; tile-type=\"spacer-tile\";}'");
    system("killall Dock");
    break;
  case 2:
    for (spacer_count = 0; spacer_count < *amount; spacer_count++)
      system("defaults write com.apple.dock persistent-others -array-add "
             "'{tile-data={}; tile-type=\"spacer-tile\";}'");
    system("killall Dock");
    break;
  }
}


x86 assembly (clang, -O0):
<create_dockspacer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     1148 <create_dockspacer+0x38>
jmp    1137 <create_dockspacer+0x27>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1189 <create_dockspacer+0x79>
jmp    11c5 <create_dockspacer+0xb5>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1178 <create_dockspacer+0x68>
lea    0xe9b(%rip),%rdi
call   1030 <system@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114f <create_dockspacer+0x3f>
lea    0xee6(%rip),%rdi
call   1030 <system@plt>
jmp    11c5 <create_dockspacer+0xb5>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11b9 <create_dockspacer+0xa9>
lea    0xecc(%rip),%rdi
call   1030 <system@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <create_dockspacer+0x80>
lea    0xea5(%rip),%rdi
call   1030 <system@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_dockspacer>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%eax
cmp    $0x1,%eax
je     1151 <create_dockspacer+0x41>
cmp    $0x2,%eax
jne    117f <create_dockspacer+0x6f>
cmpl   $0x0,(%rbx)
jle    116f <create_dockspacer+0x5f>
xor    %ebp,%ebp
lea    0xf41(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <system@plt>
add    $0x1,%ebp
cmp    (%rbx),%ebp
jl     1140 <create_dockspacer+0x30>
jmp    116f <create_dockspacer+0x5f>
cmpl   $0x0,(%rbx)
jle    116f <create_dockspacer+0x5f>
xor    %ebp,%ebp
lea    0xea1(%rip),%r14
nop
mov    %r14,%rdi
call   1030 <system@plt>
add    $0x1,%ebp
cmp    (%rbx),%ebp
jl     1160 <create_dockspacer+0x50>
lea    0xeef(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <system@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [101 x i8] c"defaults write com.apple.dock persistent-apps -array-add '{title-data={}; tile-type=\22spacer-tile\22;}'\00"
@.str.1 = [13 x i8] c"killall Dock\00"
@.str.2 = [102 x i8] c"defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type=\22spacer-tile\22;}'\00"
define void @create_dockspacer(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
switch i32 %7, label %34 [
i32 1, label %8
i32 2, label %21
]
8: ; preds = %2
store i32 0, i32* %5
br label %9
9: ; preds = %16, %8
%10 = load i32, i32* %5
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = call i32 @system(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %9
19: ; preds = %9
%20 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %34
21: ; preds = %2
store i32 0, i32* %5
br label %22
22: ; preds = %29, %21
%23 = load i32, i32* %5
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = call i32 @system(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %22
32: ; preds = %22
%33 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %2, %32, %19
ret void
}

LLVM IR (-O2):
@.str = [101 x i8] c"defaults write com.apple.dock persistent-apps -array-add '{title-data={}; tile-type=\22spacer-tile\22;}'\00"
@.str.1 = [13 x i8] c"killall Dock\00"
@.str.2 = [102 x i8] c"defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type=\22spacer-tile\22;}'\00"
define void @create_dockspacer(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
switch i32 %3, label %24 [
i32 1, label %7
i32 2, label %4
]
4: ; preds = %2
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %16, label %22
7: ; preds = %2
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7, %10
%11 = phi i32 [ %13, %10 ], [ 0, %7 ]
%12 = tail call i32 @system(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str, i64 0, i64 0))
%13 = add nuw nsw i32 %11, 1
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %10, label %22
16: ; preds = %4, %16
%17 = phi i32 [ %19, %16 ], [ 0, %4 ]
%18 = tail call i32 @system(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.2, i64 0, i64 0))
%19 = add nuw nsw i32 %17, 1
%20 = load i32, i32* %1
%21 = icmp slt i32 %19, %20
br i1 %21, label %16, label %22
22: ; preds = %16, %10, %4, %7
%23 = tail call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %2
ret void
}