#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 ffun(int);
int fun(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
void main() {
  int n, a, b;
  for (n = 100; n < 1000; n++) {
    a = fun(n, 7);
    b = fun(n, 9);
    if (ffun(a) == b)
      break;
  }
  printf("%d:%d,%d", n, a, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x64,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    1195 <main+0x65>
mov    -0x4(%rbp),%edi
mov    $0x7,%esi
call   1030 <fun@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x9,%esi
call   1030 <fun@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <ffun@plt>
cmp    -0xc(%rbp),%eax
jne    1182 <main+0x52>
jmp    1195 <main+0x65>
jmp    1187 <main+0x57>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <main+0xf>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x64,%ebx
nopl   0x0(%rax)
mov    %ebx,%edi
mov    $0x7,%esi
call   1030 <fun@plt>
mov    %eax,%r14d
mov    %ebx,%edi
mov    $0x9,%esi
call   1030 <fun@plt>
mov    %eax,%ebp
mov    %r14d,%edi
call   1050 <ffun@plt>
cmp    %ebp,%eax
je     1179 <main+0x49>
add    $0x1,%ebx
cmp    $0x3e8,%ebx
jne    1140 <main+0x10>
mov    $0x3e8,%ebx
lea    0xe80(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%d:%d,%d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 100, i32* %1
br label %4
4: ; preds = %18, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i32, i32* %1
%9 = call i32 @fun(i32 %8, i32 7)
store i32 %9, i32* %2
%10 = load i32, i32* %1
%11 = call i32 @fun(i32 %10, i32 9)
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = call i32 @ffun(i32 %12)
%14 = load i32, i32* %3
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %7
br label %21
17: ; preds = %7
br label %18
18: ; preds = %17
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %4
21: ; preds = %16, %4
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d:%d,%d\00"
define void @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 100, %0 ], [ %8, %7 ]
%3 = tail call i32 @fun(i32 %2, i32 7)
%4 = tail call i32 @fun(i32 %2, i32 9)
%5 = tail call i32 @ffun(i32 %3)
%6 = icmp eq i32 %5, %4
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 1000
br i1 %9, label %10, label %1
10: ; preds = %1, %7
%11 = phi i32 [ %2, %1 ], [ 1000, %7 ]
%12 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %3, i32 %4)
ret void
}