#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*/ f(int *, int);
int /*<<< orphan*/ g(int *);
int main() {
  int i;
  int result = 1;
  int *ptrResult = &result;
  for (i = 0; i < 10; i++)
    f(ptrResult, 1);
  g(ptrResult);
  for (i = 0; i < 10; i++)
    f(ptrResult, 2);
#pragma omp taskwait
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    116b <main+0x4b>
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <main+0x25>
mov    -0x18(%rbp),%rdi
call   1040 <g@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11a1 <main+0x81>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x5b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
call   1040 <g@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
store i32 1, i32* %3
store i32* %3, i32** %4
store i32 0, i32* %2
br label %5
5: ; preds = %11, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = load i32*, i32** %4
%10 = call i32 @f(i32* %9, i32 1)
br label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %5
14: ; preds = %5
%15 = load i32*, i32** %4
%16 = call i32 @g(i32* %15)
store i32 0, i32* %2
br label %17
17: ; preds = %23, %14
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load i32*, i32** %4
%22 = call i32 @f(i32* %21, i32 2)
br label %23
23: ; preds = %20
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %17
26: ; preds = %17
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = call i32 @f(i32* %1, i32 1)
%4 = call i32 @f(i32* %1, i32 1)
%5 = call i32 @f(i32* %1, i32 1)
%6 = call i32 @f(i32* %1, i32 1)
%7 = call i32 @f(i32* %1, i32 1)
%8 = call i32 @f(i32* %1, i32 1)
%9 = call i32 @f(i32* %1, i32 1)
%10 = call i32 @f(i32* %1, i32 1)
%11 = call i32 @f(i32* %1, i32 1)
%12 = call i32 @f(i32* %1, i32 1)
%13 = call i32 @g(i32* %1)
%14 = call i32 @f(i32* %1, i32 2)
%15 = call i32 @f(i32* %1, i32 2)
%16 = call i32 @f(i32* %1, i32 2)
%17 = call i32 @f(i32* %1, i32 2)
%18 = call i32 @f(i32* %1, i32 2)
%19 = call i32 @f(i32* %1, i32 2)
%20 = call i32 @f(i32* %1, i32 2)
%21 = call i32 @f(i32* %1, i32 2)
%22 = call i32 @f(i32* %1, i32 2)
%23 = call i32 @f(i32* %1, i32 2)
ret i32 0
}