#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(int, ...);
void main() {
  int num, temp1, temp2;
  scanf(num);
  switch (num) {
  case 0:
    printf("result:0\n");
  case 1: {
    printf("result:1\n");
  }
  case 2: {
    scanf(temp1, temp2);
    printf("result:\n", temp1 + temp2);
  }
  default: {
    temp2 = 0;
    printf("result:\n", temp2);
  }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1167 <main+0x47>
jmp    1145 <main+0x25>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1175 <main+0x55>
jmp    1156 <main+0x36>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1183 <main+0x63>
jmp    11a4 <main+0x84>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %esi,%esi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec2(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [9 x i8] c"result:0\00"
@str.3 = [9 x i8] c"result:1\00"
@str.5 = [8 x i8] c"result:\00"
define void @main() {
%1 = tail call i32 (i32, ...) @scanf(i32 undef)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 (i32, ...) @scanf(i32 undef, i32 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
ret void
}