void capitalize(void *string) {
  printf("%s:%d: %s ("
         "%p->\"%s\""
         ")\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/joshuapena/cmps012b-wm-w15/refs/heads/"
         "master/mackey/labs/lab9c-voidstar-generic/examples/stringproc.c",
         23, __func__, string, *(char **)string);
  ;
  for (char *chars = *(char **)string; *chars != '\0'; ++chars) {
    *chars = toupper(*chars);
  }
}


x86 assembly (clang, -O0):
<capitalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%r8
mov    -0x8(%rbp),%rax
mov    (%rax),%r9
lea    0xec2(%rip),%rdi
lea    0xed1(%rip),%rsi
mov    $0x17,%edx
lea    0xf85(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1198 <capitalize+0x78>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1163 <capitalize+0x43>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<capitalize>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%r9
lea    0xed2(%rip),%rdi
lea    0xee1(%rip),%rsi
lea    0xf9a(%rip),%rcx
mov    $0x17,%edx
mov    %rbx,%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rbx
mov    (%rbx),%al
test   %al,%al
je     1176 <capitalize+0x56>
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <capitalize+0x40>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%s:%d: %s (%p->\22%s\22)\0A\00"
@.str.1 = [192 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/joshuapena/cmps012b-wm-w15/refs/heads/master/mackey/labs/lab9c-voidstar-generic/examples/stringproc.c\00"
@__func__.capitalize = [11 x i8] c"capitalize\00"
define void @capitalize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str.1, i64 0, i64 0), i32 23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.capitalize, i64 0, i64 0), i8* %4, i8* %7)
%9 = load i8*, i8** %2
%10 = bitcast i8* %9 to i8**
%11 = load i8*, i8** %10
store i8* %11, i8** %3
br label %12
12: ; preds = %24, %1
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 @toupper(i32 %20)
%22 = trunc i32 %21 to i8
%23 = load i8*, i8** %3
store i8 %22, i8* %23
br label %24
24: ; preds = %17
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %3
br label %12
27: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s:%d: %s (%p->\22%s\22)\0A\00"
@.str.1 = [192 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/joshuapena/cmps012b-wm-w15/refs/heads/master/mackey/labs/lab9c-voidstar-generic/examples/stringproc.c\00"
@__func__.capitalize = [11 x i8] c"capitalize\00"
define void @capitalize(i8* %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str.1, i64 0, i64 0), i32 23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.capitalize, i64 0, i64 0), i8* %0, i8* %3)
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %9, %1
ret void
9: ; preds = %1, %9
%10 = phi i8 [ %16, %9 ], [ %6, %1 ]
%11 = phi i8* [ %15, %9 ], [ %5, %1 ]
%12 = sext i8 %10 to i32
%13 = tail call i32 @toupper(i32 %12)
%14 = trunc i32 %13 to i8
store i8 %14, i8* %11
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %8, label %9
}