#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 */
char *addBinary(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char s1[] = "11";
  char s2[] = "1";
  char s3[] = "110010";
  char s4[] = "10111";
  printf("case 1 : %s\n", addBinary(s1, s2));
  printf("case 2 : %s\n", addBinary(s3, s4));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xed4(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecc(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xec1(%rip),%ax
mov    %ax,-0x9(%rbp)
mov    0xeac(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xea6(%rip),%ax
mov    %ax,-0xc(%rbp)
mov    0xe9e(%rip),%al
mov    %al,-0xa(%rbp)
mov    0xe96(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xe90(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x7(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <addBinary@plt>
mov    %rax,%rsi
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1040 <addBinary@plt>
mov    %rax,%rsi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movb   $0x0,0x6(%rsp)
movw   $0x3131,0x4(%rsp)
movw   $0x31,0x2(%rsp)
movl   $0x303130,0x13(%rsp)
movl   $0x30303131,0x10(%rsp)
30
movw   $0x31,0xc(%rsp)
movl   $0x31313031,0x8(%rsp)
31
lea    0x4(%rsp),%rdi
lea    0x2(%rsp),%rsi
call   1040 <addBinary@plt>
lea    0xea1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <addBinary@plt>
lea    0xe90(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.s1 = [3 x i8] c"11\00"
@__const.main.s2 = [2 x i8] c"1\00"
@__const.main.s3 = [7 x i8] c"110010\00"
@__const.main.s4 = [6 x i8] c"10111\00"
@.str = [13 x i8] c"case 1 : %s\0A\00"
@.str.1 = [13 x i8] c"case 2 : %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca [2 x i8]
%4 = alloca [7 x i8]
%5 = alloca [6 x i8]
store i32 0, i32* %1
%6 = bitcast [3 x i8]* %2 to i8*
%7 = bitcast [2 x i8]* %3 to i8*
%8 = bitcast [7 x i8]* %4 to i8*
%9 = bitcast [6 x i8]* %5 to i8*
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%12 = call i8* @addBinary(i8* %10, i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%16 = call i8* @addBinary(i8* %14, i8* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s1 = [3 x i8] c"11\00"
@__const.main.s3 = [7 x i8] c"110010\00"
@__const.main.s4 = [6 x i8] c"10111\00"
@.str = [13 x i8] c"case 1 : %s\0A\00"
@.str.1 = [13 x i8] c"case 2 : %s\0A\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = alloca i16
%3 = alloca [7 x i8]
%4 = alloca [6 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%6 = bitcast i16* %2 to i8*
store i16 49, i16* %2
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%9 = call i8* @addBinary(i8* %5, i8* %6)
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i8* @addBinary(i8* %7, i8* %8)
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %11)
ret i32 0
}