#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 */
struct metasurface {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ msurf_disable(struct metasurface *, int);
int /*<<< orphan*/ msurf_enable(struct metasurface *, int);
int /*<<< orphan*/ stderr;
void msurf_set_inside(struct metasurface *ms, int inside) {
  switch (inside) {
  case 1:
    msurf_enable(ms, 1);
    break;
  case 0:
    msurf_disable(ms, 1);
    break;
  default:
    fprintf(stderr, "msurf_inside expects MSURF_GREATER or MSURF_LESS\n");
  }
}


x86 assembly (clang, -O0):
<msurf_set_inside>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1176 <msurf_set_inside+0x46>
jmp    1152 <msurf_set_inside+0x22>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
jne    1189 <msurf_set_inside+0x59>
jmp    1163 <msurf_set_inside+0x33>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <msurf_enable@plt>
jmp    119e <msurf_set_inside+0x6e>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1050 <msurf_disable@plt>
jmp    119e <msurf_set_inside+0x6e>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msurf_set_inside>:
test   %esi,%esi
je     1143 <msurf_set_inside+0x13>
cmp    $0x1,%esi
jne    114d <msurf_set_inside+0x1d>
mov    $0x1,%esi
jmp    1040 <msurf_enable@plt>
mov    $0x1,%esi
jmp    1050 <msurf_disable@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.metasurface = type { i32 }
@stderr = global i32 0
@.str = [50 x i8] c"msurf_inside expects MSURF_GREATER or MSURF_LESS\0A\00"
define void @msurf_set_inside(%struct.metasurface* %0, i32 %1) {
%3 = alloca %struct.metasurface*
%4 = alloca i32
store %struct.metasurface* %0, %struct.metasurface** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %12 [
i32 1, label %6
i32 0, label %9
]
6: ; preds = %2
%7 = load %struct.metasurface*, %struct.metasurface** %3
%8 = call i32 @msurf_enable(%struct.metasurface* %7, i32 1)
br label %15
9: ; preds = %2
%10 = load %struct.metasurface*, %struct.metasurface** %3
%11 = call i32 @msurf_disable(%struct.metasurface* %10, i32 1)
br label %15
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %12, %9, %6
ret void
}

LLVM IR (-O2):
%struct.metasurface = type { i32 }
@stderr = global i32 0
@.str = [50 x i8] c"msurf_inside expects MSURF_GREATER or MSURF_LESS\0A\00"
define void @msurf_set_inside(%struct.metasurface* %0, i32 %1) {
switch i32 %1, label %7 [
i32 1, label %3
i32 0, label %5
]
3: ; preds = %2
%4 = tail call i32 @msurf_enable(%struct.metasurface* %0, i32 1)
br label %10
5: ; preds = %2
%6 = tail call i32 @msurf_disable(%struct.metasurface* %0, i32 1)
br label %10
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %5, %3
ret void
}