#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 */
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int greater_lengthof(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char a[] = "0123456789";
  char b[] = "01234";
  printf("a:\n\tString = [%s]\n\tsizeof() = [%ld]\n", a, sizeof(a));
  printf("b:\n\tString = [%s]\n\tsizeof() = [%ld]\n", b, sizeof(b));
  printf("Greater length = [%d]\n", greater_lengthof(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xebf(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xeb7(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xeb1(%rip),%ax
mov    %ax,-0x11(%rbp)
lea    -0xf(%rbp),%rsi
lea    0xea4(%rip),%rdi
mov    $0xb,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x15(%rbp),%rsi
lea    0xeb2(%rip),%rdi
mov    $0x6,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xf(%rbp),%rdi
lea    -0x15(%rbp),%rsi
call   1040 <greater_lengthof@plt>
mov    %eax,%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x3736353433323130,%rax
35 36 37
mov    %rax,0x8(%rsp)
movl   $0x393837,0xf(%rsp)
movw   $0x34,0x4(%rsp)
movl   $0x33323130,(%rsp)
lea    0xebe(%rip),%rdi
lea    0x8(%rsp),%r14
mov    $0xb,%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    %rsp,%rbx
mov    $0x6,%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <greater_lengthof@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.a = [11 x i8] c"0123456789\00"
@__const.main.b = [6 x i8] c"01234\00"
@.str = [37 x i8] c"a:\0A\09String = [%s]\0A\09sizeof() = [%ld]\0A\00"
@.str.1 = [37 x i8] c"b:\0A\09String = [%s]\0A\09sizeof() = [%ld]\0A\00"
@.str.2 = [23 x i8] c"Greater length = [%d]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca [6 x i8]
store i32 0, i32* %1
%4 = bitcast [11 x i8]* %2 to i8*
%5 = bitcast [6 x i8]* %3 to i8*
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %6, i64 11)
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %8, i64 6)
%10 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%12 = call i32 @greater_lengthof(i8* %10, i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [11 x i8] c"0123456789\00"
@__const.main.b = [6 x i8] c"01234\00"
@.str = [37 x i8] c"a:\0A\09String = [%s]\0A\09sizeof() = [%ld]\0A\00"
@.str.1 = [37 x i8] c"b:\0A\09String = [%s]\0A\09sizeof() = [%ld]\0A\00"
@.str.2 = [23 x i8] c"Greater length = [%d]\0A\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %3, i64 11)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %4, i64 6)
%7 = call i32 @greater_lengthof(i8* %3, i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}