#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int set_addon(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int ret = 0;
  if (argc > 2) {
    ret = set_addon(argv[1], argv[2]);
  } else if (argc > 1) {
    ret = set_addon(argv[1], NULL);
  } else {
    fprintf(stderr, "update_addon Version %s (C) by Uwe Langhammer\n", "1.0");
    fprintf(stderr, "usage: %s <id> [<descr>]\n", argv[0]);
    ret = 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1164 <main+0x44>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <set_addon@plt>
mov    %eax,-0x14(%rbp)
jmp    11cb <main+0xab>
cmpl   $0x1,-0x8(%rbp)
jle    1187 <main+0x67>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <set_addon@plt>
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0xa6>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
lea    0xe91(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
jmp    11cb <main+0xab>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jl     1136 <main+0x16>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
jmp    1141 <main+0x21>
cmp    $0x2,%edi
jne    114d <main+0x2d>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <set_addon@plt>
mov    0x2e8c(%rip),%r14
mov    (%r14),%edi
lea    0xea2(%rip),%rsi
lea    0xeca(%rip),%rdx
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"update_addon Version %s (C) by Uwe Langhammer\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [26 x i8] c"usage: %s <id> [<descr>]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @set_addon(i8* %12, i8* %15)
store i32 %16, i32* %6
br label %34
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @set_addon(i8* %23, i8* null)
store i32 %24, i32* %6
br label %33
25: ; preds = %17
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %31)
store i32 1, i32* %6
br label %33
33: ; preds = %25, %20
br label %34
34: ; preds = %33, %9
%35 = load i32, i32* %6
ret i32 %35
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"update_addon Version %s (C) by Uwe Langhammer\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [26 x i8] c"usage: %s <id> [<descr>]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @set_addon(i8* %6, i8* %8)
br label %22
10: ; preds = %2
%11 = icmp eq i32 %0, 2
br i1 %11, label %12, label %16
12: ; preds = %10
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @set_addon(i8* %14, i8* null)
br label %22
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %12, %16, %4
%23 = phi i32 [ %9, %4 ], [ %15, %12 ], [ 1, %16 ]
ret i32 %23
}