#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*/ printf(char *, unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_self();
void __task(void *args) {
  unsigned int *value = (unsigned int *)args;
  unsigned int x, y, j;
  printf("[S] TASK %3u - %p\n", *value, pthread_self());
  x = 0;
  y = *value << 11;
  while (y--) {
    for (j = 0; j < (y << 3); ++j)
      x = x * y + *value / (1 + (x >> 2) + j);
  }
  printf("[E] TASK %3u - %p\n", *value, pthread_self());
}


x86 assembly (clang, -O0):
<__task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
shl    $0xb,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     11d1 <__task+0xb1>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x3,%ecx
cmp    %ecx,%eax
jae    11cc <__task+0xac>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x14(%rbp),%ecx
shr    $0x2,%ecx
add    $0x1,%ecx
add    -0x1c(%rbp),%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1183 <__task+0x63>
jmp    1168 <__task+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%edx
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__task>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%ebp
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xeca(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    (%rbx),%ebx
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xec4(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"[S] TASK %3u - %p\0A\00"
@.str.1 = [19 x i8] c"[E] TASK %3u - %p\0A\00"
define void @__task(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %3
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = call i32 (...) @pthread_self()
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
store i32 0, i32* %4
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = shl i32 %14, 11
store i32 %15, i32* %5
br label %16
16: ; preds = %42, %1
%17 = load i32, i32* %5
%18 = add i32 %17, -1
store i32 %18, i32* %5
%19 = icmp ne i32 %17, 0
br i1 %19, label %20, label %43
20: ; preds = %16
store i32 0, i32* %6
br label %21
21: ; preds = %39, %20
%22 = load i32, i32* %6
%23 = load i32, i32* %5
%24 = shl i32 %23, 3
%25 = icmp ult i32 %22, %24
br i1 %25, label %26, label %42
26: ; preds = %21
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = mul i32 %27, %28
%30 = load i32*, i32** %3
%31 = load i32, i32* %30
%32 = load i32, i32* %4
%33 = lshr i32 %32, 2
%34 = add i32 1, %33
%35 = load i32, i32* %6
%36 = add i32 %34, %35
%37 = udiv i32 %31, %36
%38 = add i32 %29, %37
store i32 %38, i32* %4
br label %39
39: ; preds = %26
%40 = load i32, i32* %6
%41 = add i32 %40, 1
store i32 %41, i32* %6
br label %21
42: ; preds = %21
br label %16
43: ; preds = %16
%44 = load i32*, i32** %3
%45 = load i32, i32* %44
%46 = call i32 (...) @pthread_self()
%47 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %45, i32 %46)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"[S] TASK %3u - %p\0A\00"
@.str.1 = [19 x i8] c"[E] TASK %3u - %p\0A\00"
define void @__task(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 (...) @pthread_self()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = tail call i32 (...) @pthread_self()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
ret void
}