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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, struct AMCThread *);
int /*<<< orphan*/ pthread_detach(int /*<<< orphan*/);
int /*<<< orphan*/ pthread_exit(void *);
int /*<<< orphan*/ pthread_self();
void *_threadPoolTaskDynamic(void *arg) {
  struct AMCThread *self = (struct AMCThread *)arg;
  pthread_detach(pthread_self());
  printf(
      "##"
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/Andrew-M-C/Linux-Linux_Programming_Template/"
      "refs/heads/master/history/160229_thread_pool/AMCThreadPool.c"
      ", %d: "
      "Thread %p allocated dynamic"
      "\n",
      361, self);
  printf(
      "##"
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/Andrew-M-C/Linux-Linux_Programming_Template/"
      "refs/heads/master/history/160229_thread_pool/AMCThreadPool.c"
      ", %d: "
      "Thread item <%p> exit"
      "\n",
      365, self);
  pthread_exit(((void *)0));
  return ((void *)0);
}


x86 assembly (clang, -O0):
<_threadPoolTaskDynamic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <pthread_self@plt>
mov    %eax,%edi
call   1050 <pthread_detach@plt>
mov    -0x10(%rbp),%rdx
lea    0xe93(%rip),%rdi
mov    $0x169,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdx
lea    0xf65(%rip),%rdi
mov    $0x16d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_threadPoolTaskDynamic>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <pthread_self@plt>
mov    %eax,%edi
call   1050 <pthread_detach@plt>
lea    0xea7(%rip),%rdi
mov    $0x169,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
lea    0xf7a(%rip),%rdi
mov    $0x16d,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.AMCThread = type { i32 }
@.str = [231 x i8] c"##/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Andrew-M-C/Linux-Linux_Programming_Template/refs/heads/master/history/160229_thread_pool/AMCThreadPool.c, %d: Thread %p allocated dynamic\0A\00"
@.str.1 = [225 x i8] c"##/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Andrew-M-C/Linux-Linux_Programming_Template/refs/heads/master/history/160229_thread_pool/AMCThreadPool.c, %d: Thread item <%p> exit\0A\00"
define i8* @_threadPoolTaskDynamic(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.AMCThread*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.AMCThread*
store %struct.AMCThread* %5, %struct.AMCThread** %3
%6 = call i32 (...) @pthread_self()
%7 = call i32 @pthread_detach(i32 %6)
%8 = load %struct.AMCThread*, %struct.AMCThread** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str, i64 0, i64 0), i32 361, %struct.AMCThread* %8)
%10 = load %struct.AMCThread*, %struct.AMCThread** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([225 x i8], [225 x i8]* @.str.1, i64 0, i64 0), i32 365, %struct.AMCThread* %10)
%12 = call i32 @pthread_exit(i8* null)
ret i8* null
}

LLVM IR (-O2):
%struct.AMCThread = type { i32 }
@.str = [231 x i8] c"##/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Andrew-M-C/Linux-Linux_Programming_Template/refs/heads/master/history/160229_thread_pool/AMCThreadPool.c, %d: Thread %p allocated dynamic\0A\00"
@.str.1 = [225 x i8] c"##/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Andrew-M-C/Linux-Linux_Programming_Template/refs/heads/master/history/160229_thread_pool/AMCThreadPool.c, %d: Thread item <%p> exit\0A\00"
define noalias i8* @_threadPoolTaskDynamic(i8* %0) {
%2 = bitcast i8* %0 to %struct.AMCThread*
%3 = tail call i32 (...) @pthread_self()
%4 = tail call i32 @pthread_detach(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str, i64 0, i64 0), i32 361, %struct.AMCThread* %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([225 x i8], [225 x i8]* @.str.1, i64 0, i64 0), i32 365, %struct.AMCThread* %2)
%7 = tail call i32 @pthread_exit(i8* null)
ret i8* null
}