#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 mode_t;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int umask(int);
mode_t umask_test(mode_t cmask) {
  int ret;
  printf("umask(): cmask=0x%x(O%o)\n", cmask, cmask);
  fflush(NULL);
  ret = umask(cmask);
  printf("\t\tret = 0x%x(0%o)\n", ret, ret);
  printf("\tSucceeded Phase 1\n");
  fflush(NULL);
  return ret;
}


x86 assembly (clang, -O0):
<umask_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <fflush@plt>
mov    -0x4(%rbp),%edi
call   1040 <umask@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <fflush@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umask_test>:
push   %rbx
mov    %edi,%ebx
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <fflush@plt>
mov    %ebx,%edi
call   1050 <umask@plt>
mov    %eax,%ebx
lea    0xeae(%rip),%rdi
mov    %eax,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <fflush@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"umask(): cmask=0x%x(O%o)\0A\00"
@.str.1 = [19 x i8] c"\09\09ret = 0x%x(0%o)\0A\00"
@.str.2 = [20 x i8] c"\09Succeeded Phase 1\0A\00"
define i32 @umask_test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = call i32 @fflush(i32* null)
%8 = load i32, i32* %2
%9 = call i32 @umask(i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @fflush(i32* null)
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [26 x i8] c"umask(): cmask=0x%x(O%o)\0A\00"
@.str.1 = [19 x i8] c"\09\09ret = 0x%x(0%o)\0A\00"
@str = [19 x i8] c"\09Succeeded Phase 1\00"
define i32 @umask_test(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %0)
%3 = tail call i32 @fflush(i32* null)
%4 = tail call i32 @umask(i32 %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @fflush(i32* null)
ret i32 %4
}