#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 *option(char, char, char *);
int /*<<< orphan*/ printf(char *, char *);
void fun() {
  char c, rw, s[100] = "222";
  c = 'b';
  rw = 'r';
  if (c == 'a') {
    option(c, rw, s);
    printf("%s", s);
  } else {
    printf("%ld", option(c, rw, s));
  }
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movb   $0x32,-0x70(%rbp)
movb   $0x32,-0x6f(%rbp)
movb   $0x32,-0x6e(%rbp)
movb   $0x62,-0x1(%rbp)
movb   $0x72,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jne    1193 <fun+0x63>
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
lea    -0x70(%rbp),%rdx
movsbl %cl,%edi
movsbl %al,%esi
call   1050 <option@plt>
lea    -0x70(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
jmp    11b7 <fun+0x87>
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
lea    -0x70(%rbp),%rdx
movsbl %cl,%edi
movsbl %al,%esi
call   1050 <option@plt>
mov    %rax,%rsi
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movw   $0x3232,(%rsp)
movb   $0x32,0x2(%rsp)
mov    %rsp,%rdx
mov    $0x62,%edi
mov    $0x72,%esi
call   1040 <option@plt>
lea    0xe90(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%ld\00"
define void @fun() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca [100 x i8]
%4 = bitcast [100 x i8]* %3 to i8*
%5 = bitcast i8* %4 to [100 x i8]*
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 0
store i8 50, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 1
store i8 50, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 2
store i8 50, i8* %8
store i8 98, i8* %1
store i8 114, i8* %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 97
br i1 %11, label %12, label %19
12: ; preds = %0
%13 = load i8, i8* %1
%14 = load i8, i8* %2
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%16 = call i8* @option(i8 signext %13, i8 signext %14, i8* %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %25
19: ; preds = %0
%20 = load i8, i8* %1
%21 = load i8, i8* %2
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%23 = call i8* @option(i8 signext %20, i8 signext %21, i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %19, %12
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%ld\00"
define void @fun() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
store i8 50, i8* %2
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 1
store i8 50, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 2
store i8 50, i8* %4
%5 = call i8* @option(i8 signext 98, i8 signext 114, i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}