#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 passwd {
  int pw_uid;
};

/* Variables and functions */
struct passwd *getpwnam(char const *);
scalar_t__ strcmp(char const *, char *);
int Bank_int_GetUnixID(const char *Username) {
  int uid;
  if (strcmp(Username, ">sales") == 0) {
    uid = -1;
  } else if (strcmp(Username, ">countersum") == 0) {
    uid = -2;
  } else {
    struct passwd *pwd;
    pwd = getpwnam(Username);
    if (!pwd)
      return -1;
    uid = pwd->pw_uid;
  }
  return uid;
}


x86 assembly (clang, -O0):
<Bank_int_GetUnixID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1152 <Bank_int_GetUnixID+0x32>
movl   $0xffffffff,-0x14(%rbp)
jmp    11aa <Bank_int_GetUnixID+0x8a>
mov    -0x10(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1178 <Bank_int_GetUnixID+0x58>
movl   $0xfffffffe,-0x14(%rbp)
jmp    11a5 <Bank_int_GetUnixID+0x85>
mov    -0x10(%rbp),%rdi
call   1040 <getpwnam@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    119c <Bank_int_GetUnixID+0x7c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b0 <Bank_int_GetUnixID+0x90>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    11aa <Bank_int_GetUnixID+0x8a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bank_int_GetUnixID>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed3(%rip),%rsi
call   1030 <strcmp@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     1166 <Bank_int_GetUnixID+0x46>
lea    0xec4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1161 <Bank_int_GetUnixID+0x41>
mov    %rbx,%rdi
call   1040 <getpwnam@plt>
test   %rax,%rax
je     1166 <Bank_int_GetUnixID+0x46>
mov    (%rax),%ebp
jmp    1166 <Bank_int_GetUnixID+0x46>
mov    $0xfffffffe,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i32 }
@.str = [7 x i8] c">sales\00"
@.str.1 = [12 x i8] c">countersum\00"
define i32 @Bank_int_GetUnixID(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.passwd*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %4
br label %26
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 -2, i32* %4
br label %25
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = call %struct.passwd* @getpwnam(i8* %16)
store %struct.passwd* %17, %struct.passwd** %5
%18 = load %struct.passwd*, %struct.passwd** %5
%19 = icmp ne %struct.passwd* %18, null
br i1 %19, label %21, label %20
20: ; preds = %15
store i32 -1, i32* %2
br label %28
21: ; preds = %15
%22 = load %struct.passwd*, %struct.passwd** %5
%23 = getelementptr inbounds %struct.passwd, %struct.passwd* %22, i32 0, i32 0
%24 = load i32, i32* %23
store i32 %24, i32* %4
br label %25
25: ; preds = %21, %14
br label %26
26: ; preds = %25, %9
%27 = load i32, i32* %4
store i32 %27, i32* %2
br label %28
28: ; preds = %26, %20
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@.str = [7 x i8] c">sales\00"
@.str.1 = [12 x i8] c">countersum\00"
define i32 @Bank_int_GetUnixID(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = tail call %struct.passwd* @getpwnam(i8* %0)
%9 = icmp eq %struct.passwd* %8, null
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = getelementptr inbounds %struct.passwd, %struct.passwd* %8, i64 0, i32 0
%12 = load i32, i32* %11
br label %13
13: ; preds = %7, %1, %4, %10
%14 = phi i32 [ %12, %10 ], [ -1, %1 ], [ -2, %4 ], [ -1, %7 ]
ret i32 %14
}