#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*/ Fatal_Error(char *, char const *);
int /*<<< orphan*/ Scan_Long(char const *, long *);
int Get_Format_Size(const char *format) {
  long size;
  Scan_Long(format, &size);
  if (size != 0 && size != 8 && size != 16 && size != 32)
    Fatal_Error("bad format: %s", format);
  return (int)size;
}


x86 assembly (clang, -O0):
<Get_Format_Size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <Scan_Long@plt>
cmpq   $0x0,-0x10(%rbp)
je     1175 <Get_Format_Size+0x55>
cmpq   $0x8,-0x10(%rbp)
je     1175 <Get_Format_Size+0x55>
cmpq   $0x10,-0x10(%rbp)
je     1175 <Get_Format_Size+0x55>
cmpq   $0x20,-0x10(%rbp)
je     1175 <Get_Format_Size+0x55>
mov    -0x8(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1040 <Fatal_Error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_Format_Size>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
call   1030 <Scan_Long@plt>
mov    0x8(%rsp),%rax
mov    %rax,%rcx
rol    $0x3d,%rcx
cmp    $0x4,%rcx
ja     114a <Get_Format_Size+0x2a>
cmp    $0x3,%rcx
jne    115e <Get_Format_Size+0x3e>
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
call   1040 <Fatal_Error@plt>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"bad format: %s\00"
define i32 @Get_Format_Size(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @Scan_Long(i8* %4, i64* %3)
%6 = load i64, i64* %3
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = load i64, i64* %3
%10 = icmp ne i64 %9, 8
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i64, i64* %3
%13 = icmp ne i64 %12, 16
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i64, i64* %3
%16 = icmp ne i64 %15, 32
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %2
%19 = call i32 @Fatal_Error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %17, %14, %11, %8, %1
%21 = load i64, i64* %3
%22 = trunc i64 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
@.str = [15 x i8] c"bad format: %s\00"
define i32 @Get_Format_Size(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 @Scan_Long(i8* %0, i64* %2)
%5 = load i64, i64* %2
%6 = call i64 @llvm.fshl.i64(i64 %5, i64 %5, i64 61)
switch i64 %6, label %7 [
i64 4, label %10
i64 2, label %10
i64 1, label %10
i64 0, label %10
]
7: ; preds = %1
%8 = call i32 @Fatal_Error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = load i64, i64* %2
br label %10
10: ; preds = %1, %1, %1, %1, %7
%11 = phi i64 [ %5, %1 ], [ %5, %1 ], [ %5, %1 ], [ %5, %1 ], [ %9, %7 ]
%12 = trunc i64 %11 to i32
ret i32 %12
}