#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 *, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int /*<<< orphan*/ w(int, int, int);
int main(int argc, char *argv[]) {
  int a, b, c;
  while (1) {
    scanf("%i%i%i", &a, &b, &c);
    if (a == -1 && b == -1 && c == -1)
      break;
    printf("w(%i, %i, %i) = %li\n", a, b, c, w(a, b, c));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1050 <scanf@plt>
cmpl   $0xffffffff,-0x14(%rbp)
jne    1181 <main+0x51>
cmpl   $0xffffffff,-0x18(%rbp)
jne    1181 <main+0x51>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1181 <main+0x51>
jmp    11be <main+0x8e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <w@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    %eax,%r8d
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%ebx
mov    0x10(%rsp),%ebp
mov    0xc(%rsp),%r13d
cmp    $0xffffffff,%ebx
jne    1176 <main+0x46>
cmp    $0xffffffff,%ebp
jne    1176 <main+0x46>
cmp    $0xffffffff,%r13d
je     11e4 <main+0xb4>
lea    0x14(%rsp),%r12
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r13d,%edx
call   1040 <w@plt>
lea    0xe64(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
lea    0xe47(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%ebx
mov    0x10(%rsp),%ebp
mov    0xc(%rsp),%r13d
cmp    $0xffffffff,%ebx
jne    1190 <main+0x60>
cmp    $0xffffffff,%ebp
jne    1190 <main+0x60>
cmp    $0xffffffff,%r13d
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%i%i%i\00"
@.str.1 = [21 x i8] c"w(%i, %i, %i) = %li\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %2, %20
%10 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7, i32* %8)
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %8
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %16
br label %29
20: ; preds = %16, %13, %9
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = call i32 @w(i32 %24, i32 %25, i32 %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22, i32 %23, i32 %27)
br label %9
29: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%i%i%i\00"
@.str.1 = [21 x i8] c"w(%i, %i, %i) = %li\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, -1
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, -1
%14 = select i1 %11, i1 %13, i1 false
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, -1
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %33, label %18
18: ; preds = %2, %18
%19 = phi i32 [ %30, %18 ], [ %15, %2 ]
%20 = phi i32 [ %27, %18 ], [ %12, %2 ]
%21 = phi i32 [ %25, %18 ], [ %10, %2 ]
%22 = call i32 @w(i32 %21, i32 %20, i32 %19)
%23 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %20, i32 %19, i32 %22)
%24 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, -1
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, -1
%29 = select i1 %26, i1 %28, i1 false
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, -1
%32 = select i1 %29, i1 %31, i1 false
br i1 %32, label %33, label %18
33: ; preds = %18, %2
ret i32 0
}