#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*/ display_thread_sched_attr(char *);
int /*<<< orphan*/ printf(char *, long, int);
int /*<<< orphan*/ sprintf(char *, char *, long);
void *printMessages(void *arg) {
  long tid;
  tid = (long)arg;
  char name[12];
  sprintf(name, "jagi_%ld", tid);
  int sleepValue;
  for (int m = 1; m <= 25; m++) {
    display_thread_sched_attr(name);
    printf(" thread number %3ld - multiplication iter num %2d", tid, m);
    long i = 1234567890;
    long j = 1234567890;
    for (int mult = 0; mult <= 123; mult++) {
      for (int inmult = 0; inmult <= 1234567; inmult++) {
        i *j;
      }
    }
  }
}


x86 assembly (clang, -O0):
<printMessages>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x24(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xead(%rip),%rsi
call   1040 <sprintf@plt>
movl   $0x1,-0x2c(%rbp)
cmpl   $0x19,-0x2c(%rbp)
jg     11ee <printMessages+0xbe>
lea    -0x24(%rbp),%rdi
call   1050 <display_thread_sched_attr@plt>
mov    -0x18(%rbp),%rsi
mov    -0x2c(%rbp),%edx
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
movq   $0x499602d2,-0x38(%rbp)
49
movq   $0x499602d2,-0x40(%rbp)
49
movl   $0x0,-0x44(%rbp)
cmpl   $0x7b,-0x44(%rbp)
jg     11db <printMessages+0xab>
movl   $0x0,-0x48(%rbp)
cmpl   $0x12d687,-0x48(%rbp)
jg     11c8 <printMessages+0x98>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11ad <printMessages+0x7d>
jmp    11cd <printMessages+0x9d>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    119c <printMessages+0x6c>
jmp    11e0 <printMessages+0xb0>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115f <printMessages+0x2f>
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMessages>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xebc(%rip),%rsi
lea    0xc(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   1040 <sprintf@plt>
mov    $0x1,%ebp
lea    0xea9(%rip),%r15
mov    %r14,%rdi
call   1050 <display_thread_sched_attr@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x1a,%ebp
jne    1160 <printMessages+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"jagi_%ld\00"
@.str.1 = [50 x i8] c" thread number %3ld - multiplication iter num %2d\00"
define i8* @printMessages(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [12 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %3
%12 = load i8*, i8** %3
%13 = ptrtoint i8* %12 to i64
store i64 %13, i64* %4
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%15 = load i64, i64* %4
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %15)
store i32 1, i32* %7
br label %17
17: ; preds = %45, %1
%18 = load i32, i32* %7
%19 = icmp sle i32 %18, 25
br i1 %19, label %20, label %48
20: ; preds = %17
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%22 = call i32 @display_thread_sched_attr(i8* %21)
%23 = load i64, i64* %4
%24 = load i32, i32* %7
%25 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i64 %23, i32 %24)
store i64 1234567890, i64* %8
store i64 1234567890, i64* %9
store i32 0, i32* %10
br label %26
26: ; preds = %41, %20
%27 = load i32, i32* %10
%28 = icmp sle i32 %27, 123
br i1 %28, label %29, label %44
29: ; preds = %26
store i32 0, i32* %11
br label %30
30: ; preds = %37, %29
%31 = load i32, i32* %11
%32 = icmp sle i32 %31, 1234567
br i1 %32, label %33, label %40
33: ; preds = %30
%34 = load i64, i64* %8
%35 = load i64, i64* %9
%36 = mul nsw i64 %34, %35
br label %37
37: ; preds = %33
%38 = load i32, i32* %11
%39 = add nsw i32 %38, 1
store i32 %39, i32* %11
br label %30
40: ; preds = %30
br label %41
41: ; preds = %40
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %26
44: ; preds = %26
br label %45
45: ; preds = %44
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %17
48: ; preds = %17
%49 = load i8*, i8** %2
ret i8* %49
}

LLVM IR (-O2):
@.str = [9 x i8] c"jagi_%ld\00"
@.str.1 = [50 x i8] c" thread number %3ld - multiplication iter num %2d\00"
define noalias i8* @printMessages(i8* %0) {
%2 = alloca [12 x i8]
%3 = ptrtoint i8* %0 to i64
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %3)
br label %7
6: ; preds = %7
ret i8* undef
7: ; preds = %1, %7
%8 = phi i32 [ 1, %1 ], [ %11, %7 ]
%9 = call i32 @display_thread_sched_attr(i8* %4)
%10 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i64 %3, i32 %8)
%11 = add nuw nsw i32 %8, 1
%12 = icmp eq i32 %11, 26
br i1 %12, label %6, label %7
}