#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
char *get_arg(int *, char *);
int /*<<< orphan*/ reset_args();
void AddLilLs(FILE *makefile) {
  char *arg, ch;
  int flag = 0;
  reset_args();
  arg = get_arg(&flag, &ch);
  while ((arg = get_arg(&flag, &ch)) != NULL) {
    if (flag) {
      switch (ch) {
      case 'l':
        if (*arg == '\0') {
          arg = get_arg(&flag, &ch);
        }
        if (arg != NULL) {
          fprintf(makefile, " -l%s", arg);
        }
        break;
      default:
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<AddLilLs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1050 <reset_args@plt>
lea    -0x18(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1030 <get_arg@plt>
mov    %rax,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1030 <get_arg@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11e4 <AddLilLs+0xb4>
cmpl   $0x0,-0x18(%rbp)
je     11df <AddLilLs+0xaf>
mov    -0x11(%rbp),%al
sub    $0x6c,%al
jne    11d5 <AddLilLs+0xa5>
jmp    1190 <AddLilLs+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11b1 <AddLilLs+0x81>
lea    -0x18(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1030 <get_arg@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11d0 <AddLilLs+0xa0>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe35(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11da <AddLilLs+0xaa>
jmp    11da <AddLilLs+0xaa>
jmp    11df <AddLilLs+0xaf>
jmp    115b <AddLilLs+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddLilLs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
call   1050 <reset_args@plt>
lea    0x4(%rsp),%rbx
lea    0x3(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <get_arg@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <get_arg@plt>
test   %rax,%rax
je     11d3 <AddLilLs+0xa3>
lea    0x4(%rsp),%r15
lea    0x3(%rsp),%rbx
lea    0xe80(%rip),%r12
jmp    11ae <AddLilLs+0x7e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <get_arg@plt>
test   %rax,%rax
je     11d3 <AddLilLs+0xa3>
cmpl   $0x0,0x4(%rsp)
je     119e <AddLilLs+0x6e>
cmpb   $0x6c,0x3(%rsp)
jne    119e <AddLilLs+0x6e>
cmpb   $0x0,(%rax)
jne    1190 <AddLilLs+0x60>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <get_arg@plt>
test   %rax,%rax
jne    1190 <AddLilLs+0x60>
jmp    119e <AddLilLs+0x6e>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c" -l%s\00"
define void @AddLilLs(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %5
%6 = call i32 (...) @reset_args()
%7 = call i8* @get_arg(i32* %5, i8* %4)
store i8* %7, i8** %3
br label %8
8: ; preds = %34, %1
%9 = call i8* @get_arg(i32* %5, i8* %4)
store i8* %9, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %35
11: ; preds = %8
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %34
14: ; preds = %11
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
switch i32 %16, label %32 [
i32 108, label %17
]
17: ; preds = %14
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i8* @get_arg(i32* %5, i8* %4)
store i8* %23, i8** %3
br label %24
24: ; preds = %22, %17
%25 = load i8*, i8** %3
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32*, i32** %2
%29 = load i8*, i8** %3
%30 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %27, %24
br label %33
32: ; preds = %14
br label %33
33: ; preds = %32, %31
br label %34
34: ; preds = %33, %11
br label %8
35: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" -l%s\00"
define void @AddLilLs(i32* nocapture %0) {
%2 = alloca i8
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 (...) @reset_args()
%6 = call i8* @get_arg(i32* %3, i8* %2)
%7 = call i8* @get_arg(i32* %3, i8* %2)
%8 = icmp eq i8* %7, null
br i1 %8, label %28, label %9
9: ; preds = %1, %25
%10 = phi i8* [ %26, %25 ], [ %7, %1 ]
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
%13 = load i8, i8* %2
%14 = icmp eq i8 %13, 108
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %16, label %25
16: ; preds = %9
%17 = load i8, i8* %10
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = call i8* @get_arg(i32* %3, i8* %2)
%21 = icmp eq i8* %20, null
br i1 %21, label %25, label %22
22: ; preds = %16, %19
%23 = phi i8* [ %20, %19 ], [ %10, %16 ]
%24 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %22, %19, %9
%26 = call i8* @get_arg(i32* %3, i8* %2)
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %9
28: ; preds = %25, %1
ret void
}