#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 *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
long long timeInNanos();
void paint(char *street) {
  long long now = timeInNanos();
  strcat(street, "#");
  printf("it took Shlemiel %d nanos to paint, Enter to continue?\n",
         timeInNanos() - now);
  printf("%s", street);
  char ch;
  scanf("%c", &ch);
}


x86 assembly (clang, -O0):
<paint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <timeInNanos@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1060 <strcat@plt>
mov    $0x0,%al
call   1050 <timeInNanos@plt>
mov    %rax,%rsi
sub    -0x10(%rbp),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <scanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paint>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <timeInNanos@plt>
mov    %rax,%r14
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
xor    %eax,%eax
call   1050 <timeInNanos@plt>
sub    %r14,%rax
lea    0xe91(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"#\00"
@.str.1 = [56 x i8] c"it took Shlemiel %d nanos to paint, Enter to continue?\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [3 x i8] c"%c\00"
define void @paint(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8
store i8* %0, i8** %2
%5 = call i64 (...) @timeInNanos()
store i64 %5, i64* %3
%6 = load i8*, i8** %2
%7 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i64 (...) @timeInNanos()
%9 = load i64, i64* %3
%10 = sub nsw i64 %8, %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i64 %10)
%12 = load i8*, i8** %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"#\00"
@.str.1 = [56 x i8] c"it took Shlemiel %d nanos to paint, Enter to continue?\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [3 x i8] c"%c\00"
define void @paint(i8* %0) {
%2 = alloca i8
%3 = tail call i64 (...) @timeInNanos()
%4 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 (...) @timeInNanos()
%6 = sub nsw i64 %5, %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i64 %6)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
ret void
}