#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*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcmp(char *, char *);
char *sum_binary(char *, char *);
int main() {
  char *result = sum_binary("0111101", "1101");
  if (!strcmp(result, "1001010")) {
    printf("PASSED\n");
  } else {
    printf("FAILED: %s\n", result);
  }
  free(result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1050 <sum_binary@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1192 <main+0x52>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a4 <main+0x64>
mov    -0x10(%rbp),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1060 <sum_binary@plt>
mov    %rax,%rbx
lea    0xe9a(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     118d <main+0x3d>
lea    0xe8f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1199 <main+0x49>
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"0111101\00"
@.str.1 = [5 x i8] c"1101\00"
@.str.2 = [8 x i8] c"1001010\00"
@.str.3 = [8 x i8] c"PASSED\0A\00"
@.str.4 = [12 x i8] c"FAILED: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @sum_binary(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %12
9: ; preds = %0
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %7
%13 = load i8*, i8** %2
%14 = call i32 @free(i8* %13)
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [8 x i8] c"0111101\00"
@.str.1 = [5 x i8] c"1101\00"
@.str.2 = [8 x i8] c"1001010\00"
@.str.4 = [12 x i8] c"FAILED: %s\0A\00"
@str = [7 x i8] c"PASSED\00"
define i32 @main() {
%1 = tail call i8* @sum_binary(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %8
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @free(i8* %1)
ret i32 0
}