Title: Generation of optimized semaphore synchronization code