#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*/ fprintf(int /*<<< orphan*/, char *, int, void *);
int /*<<< orphan*/ stderr;
void *myth_test_thread(void *args) {
  int i;
  for (i = 0; i < 10; i++) {
    fprintf(stderr, "fprintf %d from Thread %p\n", i, args);
  }
  return args;
}


x86 assembly (clang, -O0):
<myth_test_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1157 <myth_test_thread+0x47>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <myth_test_thread+0x13>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myth_test_thread>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2ec1(%rip),%r15
mov    (%r15),%edi
lea    0xed7(%rip),%r14
mov    %r14,%rsi
xor    %edx,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x2,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x3,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x4,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x5,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x6,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x7,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x8,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x9,%edx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"fprintf %d from Thread %p\0A\00"
define i8* @myth_test_thread(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = load i32, i32* %3
%10 = load i8*, i8** %2
%11 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"fprintf %d from Thread %p\0A\00"
define i8* @myth_test_thread(i8* returned %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 0, i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 1, i8* %0)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 2, i8* %0)
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 3, i8* %0)
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 4, i8* %0)
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 5, i8* %0)
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 6, i8* %0)
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 7, i8* %0)
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 8, i8* %0)
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 9, i8* %0)
ret i8* %0
}