int pointer_joke1() {
  char p[] = "%d\n";
  char a = 65;
  printf("----- START %s\n", __FUNCTION__);
  p[1] = 'c';
  printf(p, a);
  printf("\n");
  printf("** look at %s:%d **\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/reslaurentii/sandbox/refs/heads/master/src/"
         "printf_jokes.c",
         38);
  printf("----- END %s\n", __FUNCTION__);
  return 0;
}


x86 assembly (clang, -O0):
<pointer_joke1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x4(%rbp)
movb   $0x41,-0x5(%rbp)
lea    0xed8(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x63,-0x3(%rbp)
lea    -0x4(%rbp),%rdi
movsbl -0x5(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0xece(%rip),%rsi
mov    $0x26,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4f(%rip),%rdi
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pointer_joke1>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa6325,0xc(%rsp)
lea    0xecc(%rip),%rdi
lea    0xed5(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rdi
mov    $0x41,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeb7(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x26,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf46(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.pointer_joke1.p = [4 x i8] c"%d\0A\00"
@.str = [16 x i8] c"----- START %s\0A\00"
@__FUNCTION__.pointer_joke1 = [14 x i8] c"pointer_joke1\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [21 x i8] c"** look at %s:%d **\0A\00"
@.str.3 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/reslaurentii/sandbox/refs/heads/master/src/printf_jokes.c\00"
@.str.4 = [14 x i8] c"----- END %s\0A\00"
define i32 @pointer_joke1() {
%1 = alloca [4 x i8]
%2 = alloca i8
%3 = bitcast [4 x i8]* %1 to i8*
store i8 65, i8* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.pointer_joke1, i64 0, i64 0))
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 1
store i8 99, i8* %5
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* %6, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.3, i64 0, i64 0), i32 38)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.pointer_joke1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"----- START %s\0A\00"
@__FUNCTION__.pointer_joke1 = [14 x i8] c"pointer_joke1\00"
@.str.2 = [21 x i8] c"** look at %s:%d **\0A\00"
@.str.3 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/reslaurentii/sandbox/refs/heads/master/src/printf_jokes.c\00"
@.str.4 = [14 x i8] c"----- END %s\0A\00"
define i32 @pointer_joke1() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 680741, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.pointer_joke1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* %2, i32 65)
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.3, i64 0, i64 0), i32 38)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.pointer_joke1, i64 0, i64 0))
ret i32 0
}