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

/* Variables and functions */
int /*<<< orphan*/ logError(char *, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_yield();
int /*<<< orphan*/ push_count(struct Queue *, int);
int /*<<< orphan*/ queue_close(struct Queue *);
struct Queue *queue_open(char const *);
void *writerThread(void *templatep) {
  const char *template = (const char *)templatep;
  struct Queue *q;
  q = queue_open(template);
  push_count(q, 100);
  pthread_yield();
  push_count(q, 100);
  logError("queue_close(q)",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c",
           144, queue_close(q));
  return NULL;
}


x86 assembly (clang, -O0):
<writerThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <queue_open@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x64,%esi
call   1060 <push_count@plt>
mov    $0x0,%al
call   1070 <pthread_yield@plt>
mov    -0x18(%rbp),%rdi
mov    $0x64,%esi
call   1060 <push_count@plt>
mov    -0x18(%rbp),%rdi
call   1040 <queue_close@plt>
mov    %eax,%ecx
lea    0xe5a(%rip),%rdi
lea    0xe62(%rip),%rsi
mov    $0x90,%edx
call   1030 <logError@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writerThread>:
push   %rbx
call   1050 <queue_open@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x64,%esi
call   1060 <push_count@plt>
xor    %eax,%eax
call   1070 <pthread_yield@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1060 <push_count@plt>
mov    %rbx,%rdi
call   1040 <queue_close@plt>
lea    0xe77(%rip),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x90,%edx
mov    %eax,%ecx
call   1030 <logError@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.Queue = type { i32 }
@.str = [15 x i8] c"queue_close(q)\00"
@.str.1 = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c\00"
define i8* @writerThread(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca %struct.Queue*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call %struct.Queue* @queue_open(i8* %6)
store %struct.Queue* %7, %struct.Queue** %4
%8 = load %struct.Queue*, %struct.Queue** %4
%9 = call i32 @push_count(%struct.Queue* %8, i32 100)
%10 = call i32 (...) @pthread_yield()
%11 = load %struct.Queue*, %struct.Queue** %4
%12 = call i32 @push_count(%struct.Queue* %11, i32 100)
%13 = load %struct.Queue*, %struct.Queue** %4
%14 = call i32 @queue_close(%struct.Queue* %13)
%15 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.1, i64 0, i64 0), i32 144, i32 %14)
ret i8* null
}

LLVM IR (-O2):
%struct.Queue = type { i32 }
@.str = [15 x i8] c"queue_close(q)\00"
@.str.1 = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c\00"
define noalias i8* @writerThread(i8* %0) {
%2 = tail call %struct.Queue* @queue_open(i8* %0)
%3 = tail call i32 @push_count(%struct.Queue* %2, i32 100)
%4 = tail call i32 (...) @pthread_yield()
%5 = tail call i32 @push_count(%struct.Queue* %2, i32 100)
%6 = tail call i32 @queue_close(%struct.Queue* %2)
%7 = tail call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.1, i64 0, i64 0), i32 144, i32 %6)
ret i8* null
}