#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 /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int a;
  int b;
  int c;
  scanf("%d %d %d", &a, &b, &c);
  if (a + b + c == 42)
    printf("%d+%d+%d", a, b, c);
  else if (a + b * c == 42)
    printf("%d+%d*%d", a, b, c);
  else if (a * b + c == 42)
    printf("%d*%d+%d", a, b, c);
  else if (a * b * c == 42)
    printf("%d*%d*%d", a, b, c);
  else
    printf("This is not the ultimate question");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x2a,%eax
jne    1175 <main+0x55>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1222 <main+0x102>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
cmp    $0x2a,%eax
jne    11a6 <main+0x86>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121d <main+0xfd>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x2a,%eax
jne    11d5 <main+0xb5>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1218 <main+0xf8>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cmp    $0x2a,%eax
jne    1205 <main+0xe5>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1213 <main+0xf3>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1218 <main+0xf8>
jmp    121d <main+0xfd>
jmp    1222 <main+0x102>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    (%rdx,%rsi,1),%eax
mov    0xc(%rsp),%ecx
add    %ecx,%eax
cmp    $0x2a,%eax
jne    115e <main+0x3e>
lea    0xead(%rip),%rdi
jmp    1198 <main+0x78>
mov    %ecx,%eax
imul   %edx,%eax
add    %esi,%eax
cmp    $0x2a,%eax
jne    1173 <main+0x53>
lea    0xea1(%rip),%rdi
jmp    1198 <main+0x78>
mov    %edx,%eax
imul   %esi,%eax
lea    (%rax,%rcx,1),%edi
cmp    $0x2a,%edi
jne    1189 <main+0x69>
lea    0xe94(%rip),%rdi
jmp    1198 <main+0x78>
imul   %ecx,%eax
cmp    $0x2a,%eax
jne    11a6 <main+0x86>
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    119f <main+0x7f>

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [9 x i8] c"%d+%d+%d\00"
@.str.2 = [9 x i8] c"%d+%d*%d\00"
@.str.3 = [9 x i8] c"%d*%d+%d\00"
@.str.4 = [9 x i8] c"%d*%d*%d\00"
@.str.5 = [34 x i8] c"This is not the ultimate question\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = load i32, i32* %4
%10 = add nsw i32 %8, %9
%11 = icmp eq i32 %10, 42
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
br label %58
17: ; preds = %0
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = mul nsw i32 %19, %20
%22 = add nsw i32 %18, %21
%23 = icmp eq i32 %22, 42
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
br label %57
29: ; preds = %17
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = mul nsw i32 %30, %31
%33 = load i32, i32* %4
%34 = add nsw i32 %32, %33
%35 = icmp eq i32 %34, 42
br i1 %35, label %36, label %41
36: ; preds = %29
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = load i32, i32* %4
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
br label %56
41: ; preds = %29
%42 = load i32, i32* %2
%43 = load i32, i32* %3
%44 = mul nsw i32 %42, %43
%45 = load i32, i32* %4
%46 = mul nsw i32 %44, %45
%47 = icmp eq i32 %46, 42
br i1 %47, label %48, label %53
48: ; preds = %41
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %49, i32 %50, i32 %51)
br label %55
53: ; preds = %41
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %55
55: ; preds = %53, %48
br label %56
56: ; preds = %55, %36
br label %57
57: ; preds = %56, %24
br label %58
58: ; preds = %57, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [9 x i8] c"%d+%d+%d\00"
@.str.2 = [9 x i8] c"%d+%d*%d\00"
@.str.3 = [9 x i8] c"%d*%d+%d\00"
@.str.4 = [9 x i8] c"%d*%d*%d\00"
@.str.5 = [34 x i8] c"This is not the ultimate question\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = add nsw i32 %9, %8
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
%13 = icmp eq i32 %12, 42
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9, i32 %11)
br label %35
16: ; preds = %0
%17 = mul nsw i32 %11, %9
%18 = add nsw i32 %17, %8
%19 = icmp eq i32 %18, 42
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9, i32 %11)
br label %35
22: ; preds = %16
%23 = mul nsw i32 %9, %8
%24 = add nsw i32 %23, %11
%25 = icmp eq i32 %24, 42
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %9, i32 %11)
br label %35
28: ; preds = %22
%29 = mul nsw i32 %23, %11
%30 = icmp eq i32 %29, 42
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %8, i32 %9, i32 %11)
br label %35
33: ; preds = %28
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %20, %31, %33, %26, %14
ret i32 0
}