#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 */

/* Variables and functions */
int /*<<< orphan*/ fgets(void *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ pthread_exit(char *);
int /*<<< orphan*/ stdin;
void *threadWork(void *input) {
  printf("  Thread function is running. Argument passed was: %s \n",
         (char *)input);
  printf("  Enter the new message to edit the original message to:");
  fgets(input, 25, stdin);
  pthread_exit("  Thank you for the CPU time");
}


x86 assembly (clang, -O0):
<threadWork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
mov    $0x19,%esi
call   1040 <fgets@plt>
lea    0xef7(%rip),%rdi
call   1050 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threadWork>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x19,%esi
call   1040 <fgets@plt>
lea    0xf01(%rip),%rdi
pop    %rbx
jmp    1050 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [56 x i8] c" Thread function is running. Argument passed was: %s \0A\00"
@.str.1 = [57 x i8] c" Enter the new message to edit the original message to:\00"
@stdin = global i32 0
@.str.2 = [29 x i8] c" Thank you for the CPU time\00"
define i8* @threadWork(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 25, i32 %8)
%10 = call i32 @pthread_exit(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [56 x i8] c" Thread function is running. Argument passed was: %s \0A\00"
@.str.1 = [57 x i8] c" Enter the new message to edit the original message to:\00"
@stdin = global i32 0
@.str.2 = [29 x i8] c" Thank you for the CPU time\00"
define noalias i8* @threadWork(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = tail call i32 @fgets(i8* %0, i32 25, i32 %4)
%6 = tail call i32 @pthread_exit(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
ret i8* undef
}