#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 */
struct vert {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ joinVerts(struct vert *, struct vert *);
struct vert *vert_new(int, int);
struct vert *quad(int x, int y, int w, int h) {
  struct vert *tl = vert_new(x, y);
  struct vert *tr = vert_new(x + w, y);
  struct vert *bl = vert_new(x, y + h);
  struct vert *br = vert_new(x + w, y + h);
  joinVerts(tl, tr);
  joinVerts(tl, bl);
  joinVerts(tr, br);
  joinVerts(bl, br);
  return tl;
}


x86 assembly (clang, -O0):
<quad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <vert_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <vert_new@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
call   1040 <vert_new@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
call   1040 <vert_new@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <joinVerts@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <joinVerts@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <joinVerts@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <joinVerts@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quad>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r12d
call   1040 <vert_new@plt>
mov    %rax,%r14
add    %r12d,%ebx
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <vert_new@plt>
mov    %rax,%r13
add    %ebp,%r15d
mov    %r12d,%edi
mov    %r15d,%esi
call   1040 <vert_new@plt>
mov    %rax,%rbp
mov    %ebx,%edi
mov    %r15d,%esi
call   1040 <vert_new@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <joinVerts@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1030 <joinVerts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <joinVerts@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <joinVerts@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.vert = type { i32 }
define %struct.vert* @quad(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.vert*
%10 = alloca %struct.vert*
%11 = alloca %struct.vert*
%12 = alloca %struct.vert*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call %struct.vert* @vert_new(i32 %13, i32 %14)
store %struct.vert* %15, %struct.vert** %9
%16 = load i32, i32* %5
%17 = load i32, i32* %7
%18 = add nsw i32 %16, %17
%19 = load i32, i32* %6
%20 = call %struct.vert* @vert_new(i32 %18, i32 %19)
store %struct.vert* %20, %struct.vert** %10
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = load i32, i32* %8
%24 = add nsw i32 %22, %23
%25 = call %struct.vert* @vert_new(i32 %21, i32 %24)
store %struct.vert* %25, %struct.vert** %11
%26 = load i32, i32* %5
%27 = load i32, i32* %7
%28 = add nsw i32 %26, %27
%29 = load i32, i32* %6
%30 = load i32, i32* %8
%31 = add nsw i32 %29, %30
%32 = call %struct.vert* @vert_new(i32 %28, i32 %31)
store %struct.vert* %32, %struct.vert** %12
%33 = load %struct.vert*, %struct.vert** %9
%34 = load %struct.vert*, %struct.vert** %10
%35 = call i32 @joinVerts(%struct.vert* %33, %struct.vert* %34)
%36 = load %struct.vert*, %struct.vert** %9
%37 = load %struct.vert*, %struct.vert** %11
%38 = call i32 @joinVerts(%struct.vert* %36, %struct.vert* %37)
%39 = load %struct.vert*, %struct.vert** %10
%40 = load %struct.vert*, %struct.vert** %12
%41 = call i32 @joinVerts(%struct.vert* %39, %struct.vert* %40)
%42 = load %struct.vert*, %struct.vert** %11
%43 = load %struct.vert*, %struct.vert** %12
%44 = call i32 @joinVerts(%struct.vert* %42, %struct.vert* %43)
%45 = load %struct.vert*, %struct.vert** %9
ret %struct.vert* %45
}

LLVM IR (-O2):
%struct.vert = type { i32 }
define %struct.vert* @quad(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call %struct.vert* @vert_new(i32 %0, i32 %1)
%6 = add nsw i32 %2, %0
%7 = tail call %struct.vert* @vert_new(i32 %6, i32 %1)
%8 = add nsw i32 %3, %1
%9 = tail call %struct.vert* @vert_new(i32 %0, i32 %8)
%10 = tail call %struct.vert* @vert_new(i32 %6, i32 %8)
%11 = tail call i32 @joinVerts(%struct.vert* %5, %struct.vert* %7)
%12 = tail call i32 @joinVerts(%struct.vert* %5, %struct.vert* %9)
%13 = tail call i32 @joinVerts(%struct.vert* %7, %struct.vert* %10)
%14 = tail call i32 @joinVerts(%struct.vert* %9, %struct.vert* %10)
ret %struct.vert* %5
}