#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *convert_to_context(int /*<<< orphan*/ *, char *,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ *convert_to_unified(int /*<<< orphan*/ *, char *,
                                       int /*<<< orphan*/);
FILE *convert_format(FILE *f, char format) {
  switch (format) {
  default:
    break;
  case 'c':
    f = convert_to_context(f, "rb", 0);
    break;
  case 'u':
    f = convert_to_unified(f, "rb", 0);
    break;
  }
  return f;
}


x86 assembly (clang, -O0):
<convert_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x63,%eax
je     115d <convert_format+0x3d>
jmp    1147 <convert_format+0x27>
mov    -0x10(%rbp),%eax
sub    $0x75,%eax
je     1178 <convert_format+0x58>
jmp    1158 <convert_format+0x38>
jmp    118e <convert_format+0x6e>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
xor    %edx,%edx
call   1040 <convert_to_context@plt>
mov    %rax,-0x8(%rbp)
jmp    118e <convert_format+0x6e>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
xor    %edx,%edx
call   1030 <convert_to_unified@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_format>:
cmp    $0x75,%esi
je     1138 <convert_format+0x18>
cmp    $0x63,%esi
jne    1146 <convert_format+0x26>
lea    0xecf(%rip),%rsi
xor    %edx,%edx
jmp    1040 <convert_to_context@plt>
lea    0xec1(%rip),%rsi
xor    %edx,%edx
jmp    1030 <convert_to_unified@plt>
mov    %rdi,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define i32* @convert_format(i32* %0, i8 signext %1) {
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %7 [
i32 99, label %8
i32 117, label %11
]
7: ; preds = %2
br label %14
8: ; preds = %2
%9 = load i32*, i32** %3
%10 = call i32* @convert_to_context(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
store i32* %10, i32** %3
br label %14
11: ; preds = %2
%12 = load i32*, i32** %3
%13 = call i32* @convert_to_unified(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
store i32* %13, i32** %3
br label %14
14: ; preds = %11, %8, %7
%15 = load i32*, i32** %3
ret i32* %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define i32* @convert_format(i32* %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %8 [
i32 99, label %4
i32 117, label %6
]
4: ; preds = %2
%5 = tail call i32* @convert_to_context(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
br label %8
6: ; preds = %2
%7 = tail call i32* @convert_to_unified(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
br label %8
8: ; preds = %2, %6, %4
%9 = phi i32* [ %0, %2 ], [ %7, %6 ], [ %5, %4 ]
ret i32* %9
}