#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*/ printf(char *, int);
scalar_t__ strcmp(char const *, char *);
int test_function(int a, char b, short c, unsigned int d, int e,
                  const char *buf1, const char *buf2, int *output_var) {
  if (strcmp(buf1, "c00lpass1337") == 0) {
    *output_var = 1234;
    return 0xc001f00d;
  }
  if (strcmp(buf2, "secretadminpass") == 0) {
    *output_var = 3456;
    return 0xa1f;
  }
  if (a == b) {
    *output_var = 4567;
    return 0xc0bb13;
  }
  printf("c=%x\n", c);
  printf("d=%x\n", d);
  printf("e=%x\n", e);
  if (c + d + e == 0x98989898) {
    *output_var = 345987;
    return 0x8000;
  }
  *output_var = -1;
  return 0;
}


x86 assembly (clang, -O0):
<test_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dx,%ax
mov    %sil,%dl
mov    0x18(%rbp),%rsi
mov    0x10(%rbp),%rsi
mov    %edi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %ax,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    117b <test_function+0x5b>
mov    0x18(%rbp),%rax
movl   $0x4d2,(%rax)
movl   $0xc001f00d,-0x4(%rbp)
jmp    123a <test_function+0x11a>
mov    0x10(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <test_function+0x8b>
mov    0x18(%rbp),%rax
movl   $0xd80,(%rax)
movl   $0xa1f,-0x4(%rbp)
jmp    123a <test_function+0x11a>
mov    -0x8(%rbp),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    11d0 <test_function+0xb0>
mov    0x18(%rbp),%rax
movl   $0x11d7,(%rax)
movl   $0xc0bb13,-0x4(%rbp)
jmp    123a <test_function+0x11a>
movswl -0xc(%rbp),%esi
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
movswl -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    $0x98989898,%eax
jne    1229 <test_function+0x109>
mov    0x18(%rbp),%rax
movl   $0x54783,(%rax)
movl   $0x8000,-0x4(%rbp)
jmp    123a <test_function+0x11a>
mov    0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_function>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x48(%rsp),%r13
lea    0xebc(%rip),%rsi
mov    %r9,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     117a <test_function+0x5a>
mov    0x40(%rsp),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1186 <test_function+0x66>
movsbl %bl,%eax
cmp    %ebp,%eax
jne    1192 <test_function+0x72>
mov    $0xc0bb13,%eax
mov    $0x11d7,%ecx
jmp    11e3 <test_function+0xc3>
mov    $0xc001f00d,%eax
mov    $0x4d2,%ecx
jmp    11e3 <test_function+0xc3>
mov    $0xa1f,%eax
mov    $0xd80,%ecx
jmp    11e3 <test_function+0xc3>
movswl %r12w,%ebx
lea    0xe80(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
add    %r15d,%ebx
add    %r14d,%ebx
xor    %eax,%eax
cmp    $0x98989898,%ebx
sete   %al
mov    $0x54783,%edx
mov    $0xffffffff,%ecx
cmove  %edx,%ecx
shl    $0xf,%eax
mov    %ecx,0x0(%r13)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"c00lpass1337\00"
@.str.1 = [16 x i8] c"secretadminpass\00"
@.str.2 = [6 x i8] c"c=%x\0A\00"
@.str.3 = [6 x i8] c"d=%x\0A\00"
@.str.4 = [6 x i8] c"e=%x\0A\00"
define i32 @test_function(i32 %0, i8 signext %1, i16 signext %2, i32 %3, i32 %4, i8* %5, i8* %6, i32* %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8
%12 = alloca i16
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32*
store i32 %0, i32* %10
store i8 %1, i8* %11
store i16 %2, i16* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i8* %5, i8** %15
store i8* %6, i8** %16
store i32* %7, i32** %17
%18 = load i8*, i8** %15
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %8
%22 = load i32*, i32** %17
store i32 1234, i32* %22
store i32 -1073614835, i32* %9
br label %55
23: ; preds = %8
%24 = load i8*, i8** %16
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load i32*, i32** %17
store i32 3456, i32* %28
store i32 2591, i32* %9
br label %55
29: ; preds = %23
%30 = load i32, i32* %10
%31 = load i8, i8* %11
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %30, %32
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = load i32*, i32** %17
store i32 4567, i32* %35
store i32 12630803, i32* %9
br label %55
36: ; preds = %29
%37 = load i16, i16* %12
%38 = sext i16 %37 to i32
%39 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %13
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %14
%43 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = load i16, i16* %12
%45 = sext i16 %44 to i32
%46 = load i32, i32* %13
%47 = add i32 %45, %46
%48 = load i32, i32* %14
%49 = add i32 %47, %48
%50 = icmp eq i32 %49, -1734829928
br i1 %50, label %51, label %53
51: ; preds = %36
%52 = load i32*, i32** %17
store i32 345987, i32* %52
store i32 32768, i32* %9
br label %55
53: ; preds = %36
%54 = load i32*, i32** %17
store i32 -1, i32* %54
store i32 0, i32* %9
br label %55
55: ; preds = %53, %51, %34, %27, %21
%56 = load i32, i32* %9
ret i32 %56
}

LLVM IR (-O2):
@.str = [13 x i8] c"c00lpass1337\00"
@.str.1 = [16 x i8] c"secretadminpass\00"
@.str.2 = [6 x i8] c"c=%x\0A\00"
@.str.3 = [6 x i8] c"d=%x\0A\00"
@.str.4 = [6 x i8] c"e=%x\0A\00"
define i32 @test_function(i32 %0, i8 signext %1, i16 signext %2, i32 %3, i32 %4, i8* %5, i8* %6, i32* nocapture writeonly %7) {
%9 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %8
%12 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %11
%15 = sext i8 %1 to i32
%16 = icmp eq i32 %15, %0
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = sext i16 %2 to i32
%19 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %3)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%22 = add i32 %18, %3
%23 = add i32 %22, %4
%24 = icmp eq i32 %23, -1734829928
%25 = select i1 %24, i32 345987, i32 -1
%26 = select i1 %24, i32 32768, i32 0
br label %27
27: ; preds = %17, %14, %11, %8
%28 = phi i32 [ 1234, %8 ], [ 3456, %11 ], [ 4567, %14 ], [ %25, %17 ]
%29 = phi i32 [ -1073614835, %8 ], [ 2591, %11 ], [ 12630803, %14 ], [ %26, %17 ]
store i32 %28, i32* %7
ret i32 %29
}