#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*/ strcpy(char *, char const *);
char *space_to_hyphen(const char *s) {
  static char result[100];
  int i;
  strcpy(result, s);
  for (i = 0; result[i] != '\0'; i++) {
    if (result[i] == ' ') {
      result[i] = '-';
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<space_to_hyphen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f19(%rip),%rdi
call   1030 <strcpy@plt>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
lea    0x2f02(%rip),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1185 <space_to_hyphen+0x75>
movslq -0xc(%rbp),%rcx
lea    0x2eea(%rip),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1172 <space_to_hyphen+0x62>
movslq -0xc(%rbp),%rcx
lea    0x2ed2(%rip),%rax
movb   $0x2d,(%rax,%rcx,1)
jmp    1177 <space_to_hyphen+0x67>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <space_to_hyphen+0x23>
lea    0x2eb4(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<space_to_hyphen>:
push   %rbx
mov    %rdi,%rsi
lea    0x2f25(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
jmp    1137 <space_to_hyphen+0x27>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x2d,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1130 <space_to_hyphen+0x20>
test   %al,%al
jne    1133 <space_to_hyphen+0x23>
lea    0x2ef7(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@space_to_hyphen.result = internal global [100 x i8] zeroinitializer
define i8* @space_to_hyphen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 0), i8* %4)
store i32 0, i32* %3
br label %6
6: ; preds = %25, %1
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %6
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 32
br i1 %19, label %20, label %24
20: ; preds = %13
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 %22
store i8 45, i8* %23
br label %24
24: ; preds = %20, %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %6
28: ; preds = %6
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 0)
}

LLVM IR (-O2):
@space_to_hyphen.result = internal global [100 x i8] zeroinitializer
define i8* @space_to_hyphen(i8* %0) {
%2 = tail call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 0), i8* %0)
br label %3
3: ; preds = %8, %1
%4 = phi i64 [ %9, %8 ], [ 0, %1 ]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %8 [
i8 0, label %10
i8 32, label %7
]
7: ; preds = %3
store i8 45, i8* %5
br label %8
8: ; preds = %3, %7
%9 = add nuw i64 %4, 1
br label %3
10: ; preds = %3
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @space_to_hyphen.result, i64 0, i64 0)
}