#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 *);
int main(int argc, char *argv[]) {
  char s[100] = "a";
  option('a', 'r', s);
  printf("%s\n", s);
  printf("%ld\n", option('b', 'r', s));
  printf("%ld\n", option('c', 'r', s));
  printf("%ld\n", option('d', 'r', s));
  printf("%ld\n", option('e', 'r', s));
  printf("%ld\n", option('f', 'r', s));
  printf("%ld\n", option('g', 'r', s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movb   $0x61,-0x80(%rbp)
lea    -0x80(%rbp),%rdx
mov    $0x61,%edi
mov    $0x72,%esi
call   1050 <option@plt>
lea    -0x80(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdx
mov    $0x62,%edi
mov    $0x72,%esi
call   1050 <option@plt>
mov    %rax,%rsi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdx
mov    $0x63,%edi
mov    $0x72,%esi
call   1050 <option@plt>
mov    %rax,%rsi
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdx
mov    $0x64,%edi
mov    $0x72,%esi
call   1050 <option@plt>
mov    %rax,%rsi
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdx
mov    $0x65,%edi
mov    $0x72,%esi
call   1050 <option@plt>
mov    %rax,%rsi
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdx
mov    $0x66,%edi
mov    $0x72,%esi
call   1050 <option@plt>
mov    %rax,%rsi
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdx
mov    $0x67,%edi
mov    $0x72,%esi
call   1050 <option@plt>
mov    %rax,%rsi
lea    0xdc4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
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)
movb   $0x61,(%rsp)
mov    %rsp,%rbx
mov    $0x61,%edi
mov    $0x72,%esi
mov    %rbx,%rdx
call   1040 <option@plt>
lea    0xe91(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x62,%edi
mov    $0x72,%esi
mov    %rbx,%rdx
call   1040 <option@plt>
lea    0xe74(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x63,%edi
mov    $0x72,%esi
mov    %rbx,%rdx
call   1040 <option@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0x72,%esi
mov    %rbx,%rdx
call   1040 <option@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x65,%edi
mov    $0x72,%esi
mov    %rbx,%rdx
call   1040 <option@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x66,%edi
mov    $0x72,%esi
mov    %rbx,%rdx
call   1040 <option@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x67,%edi
mov    $0x72,%esi
mov    %rbx,%rdx
call   1040 <option@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [100 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = bitcast [100 x i8]* %5 to i8*
%7 = bitcast i8* %6 to [100 x i8]*
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i32 0, i32 0
store i8 97, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = call i8* @option(i8 signext 97, i8 signext 114, i8* %9)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%14 = call i8* @option(i8 signext 98, i8 signext 114, i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%17 = call i8* @option(i8 signext 99, i8 signext 114, i8* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%20 = call i8* @option(i8 signext 100, i8 signext 114, i8* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%23 = call i8* @option(i8 signext 101, i8 signext 114, i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%26 = call i8* @option(i8 signext 102, i8 signext 114, i8* %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%29 = call i8* @option(i8 signext 103, i8 signext 114, i8* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
store i8 97, i8* %4
%5 = call i8* @option(i8 signext 97, i8 signext 114, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i8* @option(i8 signext 98, i8 signext 114, i8* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i8* @option(i8 signext 99, i8 signext 114, i8* %4)
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i8* @option(i8 signext 100, i8 signext 114, i8* %4)
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i8* @option(i8 signext 101, i8 signext 114, i8* %4)
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i8* @option(i8 signext 102, i8 signext 114, i8* %4)
%16 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i8* @option(i8 signext 103, i8 signext 114, i8* %4)
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %17)
ret i32 0
}