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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1169 <main+0x49>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%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    119d <main+0x7d>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <f@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <main+0x59>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
call   1040 <g@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    $0x9,%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 0, i32* %3
store i32* %3, i32** %4
store i32 0, i32* %2
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32*, i32** %4
%10 = load i32, i32* %2
%11 = call i32 @f(i32* %9, i32 %10)
br label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %5
15: ; preds = %5
%16 = load i32*, i32** %4
%17 = call i32 @g(i32* %16)
store i32 0, i32* %2
br label %18
18: ; preds = %25, %15
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 10
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32*, i32** %4
%23 = load i32, i32* %2
%24 = call i32 @f(i32* %22, i32 %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %18
28: ; preds = %18
%29 = load i32, i32* %1
ret i32 %29
}

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