#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 lock {
  int dummy;
};

/* Variables and functions */
struct lock *create_lock();
int /*<<< orphan*/ create_philosopher(struct lock *, struct lock *);
int main() {
  struct lock *forkA = create_lock();
  struct lock *forkB = create_lock();
  struct lock *forkC = create_lock();
  create_philosopher(forkA, forkB);
  create_philosopher(forkB, forkC);
  create_philosopher(forkA, forkC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <create_lock@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <create_lock@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <create_lock@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <create_philosopher@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <create_philosopher@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <create_philosopher@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <create_lock@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <create_lock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <create_lock@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <create_philosopher@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <create_philosopher@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <create_philosopher@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.lock = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.lock*
%3 = alloca %struct.lock*
%4 = alloca %struct.lock*
store i32 0, i32* %1
%5 = call %struct.lock* (...) @create_lock()
store %struct.lock* %5, %struct.lock** %2
%6 = call %struct.lock* (...) @create_lock()
store %struct.lock* %6, %struct.lock** %3
%7 = call %struct.lock* (...) @create_lock()
store %struct.lock* %7, %struct.lock** %4
%8 = load %struct.lock*, %struct.lock** %2
%9 = load %struct.lock*, %struct.lock** %3
%10 = call i32 @create_philosopher(%struct.lock* %8, %struct.lock* %9)
%11 = load %struct.lock*, %struct.lock** %3
%12 = load %struct.lock*, %struct.lock** %4
%13 = call i32 @create_philosopher(%struct.lock* %11, %struct.lock* %12)
%14 = load %struct.lock*, %struct.lock** %2
%15 = load %struct.lock*, %struct.lock** %4
%16 = call i32 @create_philosopher(%struct.lock* %14, %struct.lock* %15)
ret i32 0
}

LLVM IR (-O2):
%struct.lock = type { i32 }
define i32 @main() {
%1 = tail call %struct.lock* (...) @create_lock()
%2 = tail call %struct.lock* (...) @create_lock()
%3 = tail call %struct.lock* (...) @create_lock()
%4 = tail call i32 @create_philosopher(%struct.lock* %1, %struct.lock* %2)
%5 = tail call i32 @create_philosopher(%struct.lock* %2, %struct.lock* %3)
%6 = tail call i32 @create_philosopher(%struct.lock* %1, %struct.lock* %3)
ret i32 0
}