#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 */
scalar_t__ Door_isOpen();
scalar_t__ Keypad_getAlarm();
scalar_t__ Keypad_getCodeEntered();
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strcat(char *, char *);
char *getAlarm() {
  char *response = (char *)malloc(sizeof(char) * 1024);
  memset(response, 0, sizeof(char) * 1024);
  if (Door_isOpen())
    strcat(response, "1");
  else
    strcat(response, "0");
  if (Keypad_getAlarm())
    strcat(response, "1");
  else
    strcat(response, "0");
  if (Keypad_getCodeEntered())
    strcat(response, "1");
  else
    strcat(response, "0");
  return response;
}


x86 assembly (clang, -O0):
<getAlarm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
mov    $0x0,%al
call   1040 <Door_isOpen@plt>
cmp    $0x0,%rax
je     11ac <getAlarm+0x4c>
mov    -0x8(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1070 <strcat@plt>
jmp    11bc <getAlarm+0x5c>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1070 <strcat@plt>
mov    $0x0,%al
call   1050 <Keypad_getAlarm@plt>
cmp    $0x0,%rax
je     11e2 <getAlarm+0x82>
mov    -0x8(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1070 <strcat@plt>
jmp    11f2 <getAlarm+0x92>
mov    -0x8(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1070 <strcat@plt>
mov    $0x0,%al
call   1080 <Keypad_getCodeEntered@plt>
cmp    $0x0,%rax
je     1218 <getAlarm+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xdf2(%rip),%rsi
call   1070 <strcat@plt>
jmp    1228 <getAlarm+0xc8>
mov    -0x8(%rbp),%rdi
lea    0xddf(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getAlarm>:
push   %r15
push   %r14
push   %rbx
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
xor    %eax,%eax
call   1040 <Door_isOpen@plt>
test   %rax,%rax
lea    0xe70(%rip),%r15
lea    0xe67(%rip),%rbx
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1070 <strcat@plt>
xor    %eax,%eax
call   1050 <Keypad_getAlarm@plt>
test   %rax,%rax
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1070 <strcat@plt>
xor    %eax,%eax
call   1080 <Keypad_getCodeEntered@plt>
test   %rax,%rax
cmove  %r15,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcat@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
define i8* @getAlarm() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 1024)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @memset(i8* %4, i32 0, i32 1024)
%6 = call i64 (...) @Door_isOpen()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
11: ; preds = %0
%12 = load i8*, i8** %1
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11, %8
%15 = call i64 (...) @Keypad_getAlarm()
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %1
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %23
20: ; preds = %14
%21 = load i8*, i8** %1
%22 = call i32 @strcat(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %20, %17
%24 = call i64 (...) @Keypad_getCodeEntered()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i8*, i8** %1
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %32
29: ; preds = %23
%30 = load i8*, i8** %1
%31 = call i32 @strcat(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %29, %26
%33 = load i8*, i8** %1
ret i8* %33
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
define i8* @getAlarm() {
%1 = tail call i64 @malloc(i32 1024)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @memset(i8* %2, i32 0, i32 1024)
%4 = tail call i64 (...) @Door_isOpen()
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%7 = tail call i32 @strcat(i8* %2, i8* %6)
%8 = tail call i64 (...) @Keypad_getAlarm()
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%11 = tail call i32 @strcat(i8* %2, i8* %10)
%12 = tail call i64 (...) @Keypad_getCodeEntered()
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%15 = tail call i32 @strcat(i8* %2, i8* %14)
ret i8* %2
}