#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 request_info {
  int dummy;
};

/* Variables and functions */
int sscanf(char *, char *, unsigned int *, char *);
int /*<<< orphan*/ tcpd_jump(char *, char *);
int /*<<< orphan*/ umask(unsigned int);
void umask_option(char *value, struct request_info *request) {
  unsigned mask;
  char junk;
  if (sscanf(value, "%o%c", &mask, &junk) != 1 || (mask & 0777) != mask)
    tcpd_jump("bad umask value: \"%s\"", value);
  (void)umask(mask);
}


x86 assembly (clang, -O0):
<umask_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x15(%rbp),%rcx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1172 <umask_option+0x42>
mov    -0x14(%rbp),%eax
and    $0x1ff,%eax
cmp    -0x14(%rbp),%eax
je     1182 <umask_option+0x52>
mov    -0x8(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1030 <tcpd_jump@plt>
mov    -0x14(%rbp),%edi
call   1040 <umask@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umask_option>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xec1(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0xb(%rsp),%rcx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    115f <umask_option+0x2f>
mov    0xc(%rsp),%edi
cmp    $0x200,%edi
jb     1172 <umask_option+0x42>
lea    0xe9f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <tcpd_jump@plt>
mov    0xc(%rsp),%edi
call   1040 <umask@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.request_info = type { i32 }
@.str = [5 x i8] c"%o%c\00"
@.str.1 = [22 x i8] c"bad umask value: \22%s\22\00"
define void @umask_option(i8* %0, %struct.request_info* %1) {
%3 = alloca i8*
%4 = alloca %struct.request_info*
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
store %struct.request_info* %1, %struct.request_info** %4
%7 = load i8*, i8** %3
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %5, i8* %6)
%9 = icmp ne i32 %8, 1
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* %5
%12 = and i32 %11, 511
%13 = load i32, i32* %5
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %10, %2
%16 = load i8*, i8** %3
%17 = call i32 @tcpd_jump(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %15, %10
%19 = load i32, i32* %5
%20 = call i32 @umask(i32 %19)
ret void
}

LLVM IR (-O2):
%struct.request_info = type { i32 }
@.str = [5 x i8] c"%o%c\00"
@.str.1 = [22 x i8] c"bad umask value: \22%s\22\00"
define void @umask_option(i8* %0, %struct.request_info* nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %3 to i8*
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i8* %4)
%7 = icmp eq i32 %6, 1
%8 = load i32, i32* %3
%9 = icmp ult i32 %8, 512
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = call i32 @tcpd_jump(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%13 = load i32, i32* %3
br label %14
14: ; preds = %2, %11
%15 = phi i32 [ %8, %2 ], [ %13, %11 ]
%16 = call i32 @umask(i32 %15)
ret void
}