#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*/ atoi(char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ print_info(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  if (argc != 3) {
    fputs("Usage:\n", stdout);
    fputs("  ./print-info device input\n", stdout);
    return 2;
  };
  print_info(argv[1], atoi(argv[2]));
  return 0;
}


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)
cmpl   $0x3,-0x8(%rbp)
je     1186 <main+0x56>
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
lea    0xea0(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%esi
lea    0xe93(%rip),%rdi
call   1030 <fputs@plt>
movl   $0x2,-0x4(%rbp)
jmp    11b1 <main+0x81>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <print_info@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    1151 <main+0x21>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%rdi
call   1040 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <print_info@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e88(%rip),%rbx
mov    (%rbx),%esi
lea    0xe9f(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xe99(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x2,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@stdout = global i32 0
@.str.1 = [29 x i8] c" ./print-info device input\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stdout
%10 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %11)
store i32 2, i32* %3
br label %22
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = call i32 @print_info(i8* %16, i32 %20)
store i32 0, i32* %3
br label %22
22: ; preds = %13, %8
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [8 x i8] c"Usage:\0A\00"
@stdout = global i32 0
@.str.1 = [29 x i8] c" ./print-info device input\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %16
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = tail call i32 @print_info(i8* %11, i32 %14)
br label %16
16: ; preds = %9, %4
%17 = phi i32 [ 2, %4 ], [ 0, %9 ]
ret i32 %17
}