int m(int *p) {
  int x = (((printf("yo\n"), 3)) + ((printf("yo\n"), 3)) + (g(p)) + (g(p)));
  return (((g(p)) + (g(p)) + (x) + (x)));
}


x86 assembly (clang, -O0):
<m>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <g@plt>
add    $0x6,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <g@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <g@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <g@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
add    -0xc(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <g@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <g@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <g@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <g@plt>
add    %r14d,%eax
lea    (%rax,%rbp,2),%eax
add    $0xc,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"yo\0A\00"
define i32 @m(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = load i32*, i32** %2
%7 = call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %6)
%8 = add nsw i32 6, %7
%9 = load i32*, i32** %2
%10 = call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %9)
%11 = add nsw i32 %8, %10
store i32 %11, i32* %3
%12 = load i32*, i32** %2
%13 = call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %12)
%14 = load i32*, i32** %2
%15 = call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %14)
%16 = add nsw i32 %13, %15
%17 = load i32, i32* %3
%18 = add nsw i32 %16, %17
%19 = load i32, i32* %3
%20 = add nsw i32 %18, %19
ret i32 %20
}

LLVM IR (-O2):
@str.1 = [3 x i8] c"yo\00"
define i32 @m(i32* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.1, i64 0, i64 0))
%4 = tail call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %0)
%5 = add nsw i32 %4, 6
%6 = tail call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %0)
%7 = add nsw i32 %5, %6
%8 = tail call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %0)
%9 = tail call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %0)
%10 = add nsw i32 %9, %8
%11 = shl i32 %7, 1
%12 = add i32 %10, %11
ret i32 %12
}