void show_where(string, index) char *string;
int index;
{
  char junk[1024];
  int i;
  for (i = 0; i < index; i++)
    junk[i] = ' ';
  junk[index] = '^';
  junk[index + 1] = 0;
  plintf("%s\n%s\n", string, junk);
}


x86 assembly (clang, -O0):
<show_where>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x414(%rbp)
mov    -0x414(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115e <show_where+0x4e>
movslq -0x414(%rbp),%rax
movb   $0x20,-0x410(%rbp,%rax,1)
20
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    112c <show_where+0x1c>
movslq -0xc(%rbp),%rax
movb   $0x5e,-0x410(%rbp,%rax,1)
5e
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x410(%rbp,%rax,1)
mov    -0x8(%rbp),%rsi
lea    -0x410(%rbp),%rdx
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <plintf@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_where>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
test   %esi,%esi
jle    1141 <show_where+0x21>
mov    %ebp,%edx
mov    %rsp,%rdi
mov    $0x20,%esi
call   1030 <memset@plt>
movslq %ebp,%rax
movw   $0x5e,(%rsp,%rax,1)
lea    0xeaf(%rip),%rdi
mov    %rsp,%rdx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <plintf@plt>
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s\0A%s\0A\00"
define void @show_where(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1024 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %15, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %13
store i8 32, i8* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
br label %7
18: ; preds = %7
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %20
store i8 94, i8* %21
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %3
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%28 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @plintf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %26, i8* %27)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s\0A%s\0A\00"
define void @show_where(i8* %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %2
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %10
store i8 94, i8* %11
%12 = add nsw i32 %1, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %13
store i8 0, i8* %14
%15 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @plintf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
ret void
}